[basex-talk] Variable value

2023-06-14 Thread Giuseppe G. A. Celano
Hi, I have stambled upon an unexpected issue concerning the value of a variable (in BaseX 10.6), which seems to be affected by an independent function. I have a function like page:open-url($an1) which takes a url as a parameter and opens a document. The url usually consists of an invariable p

Re: [basex-talk] JSON serialization

2023-04-27 Thread Giuseppe G. A. Celano
Hi Christian, This is the code: {data()} Ciao, Giuseppe > On 27. Apr 2023, at 13:38, Christian Grün wrote: > > Hi Giuseppe, > > I’m sorry, I fail to understand how to simulate your use case. Could > you please provide us with a minimized code snippet for testing? > >> I have the comment no

Re: [basex-talk] JSON serialization

2023-04-27 Thread Giuseppe G. A. Celano
Hi Christian, I have the comment node . If I extract its content with data() in an element, I get the following: -, and it seems there is no way to force - to become - within the element: I found a workaround to replace - with a dash '-', and this seems the best solution at the mom

[basex-talk] JSON serialization

2023-04-26 Thread Giuseppe G. A. Celano
Hi all! I have a few XML documents, whose content I would also like to provide in JSON. The XML files contain many strings encoded within comments, such as

Re: [basex-talk] Pretty print

2022-11-17 Thread Giuseppe G. A. Celano
Hi, it is: declare option output:method 'xml'; declare option output:indent 'yes’; doc(“myfile.xml”) Best, Giuseppe Dr. Giuseppe G. A. Celano DFG-project leader Universität Leipzig Institute of Computer Science, NLP Augustusplatz 10 Tel: +4934132223 04109 Leipzig Deutschla

[basex-talk] Pretty print

2022-11-17 Thread Giuseppe G. A. Celano
Hi, I am trying to prettyprint an XML file. I tried the serialization option “indent”=“yes”, but it does not work as expected. On BaseX 9, the prettyprint was the default setting: how to get the same result in BaseX 10 (and later)? Thanks. Best, Giuseppe

[basex-talk] Java 11

2022-09-13 Thread Giuseppe G. A. Celano
Hi All, On the BaseX website (https://basex.org/download/ ), it is specified that “Java 11 is required to install and run BaseX (10.1)” . Since it is not specified “Java 11 or higher”, I am wondering whether this requirement is actually meant to be strict. Thanks!

Re: [basex-talk] Integers as attribute values

2022-04-26 Thread Giuseppe G. A. Celano
Thank you, Christian, as always very useful! > On 26. Apr 2022, at 19:54, Christian Grün wrote: > > Hi Giuseppe, > > Is this due to the fact that BaseX tries to convert the values of @n of all > div elements into a number and, if it happens that the @n values returned are > all numbers, then

[basex-talk] Integers as attribute values

2022-04-26 Thread Giuseppe G. A. Celano
Hi Everyone, I have an xml document with elements such as . If I run the query doc(“file.xml")//div[@subtype="chapter"]//*/parent::div[@n=21], I get the relevant div element, even if 21 is passed as an integer. On the other hand, if I type doc(“file.xmll")//div[@n=21], I get the error "Cannot c

Re: [basex-talk] file:read-text

2021-01-12 Thread Giuseppe G. A. Celano
I have found that a few files are not txt, but binary ones. I can open them with file:read-binary. However, the reference to XML can be confusing because I am not dealing with XML. > On 12. Jan 2021, at 13:41, Martin Honnen wrote: > > > > On 12.01.2021 13:33, Giuseppe G.

[basex-talk] file:read-text

2021-01-12 Thread Giuseppe G. A. Celano
Hi, I am trying to open a bunch of files with file:read-text, but I get the error [file:io-error] invalid XML character: #0, even I am not dealing with XML. Any idea why this happens? Thanks! Best, Giuseppe

[basex-talk] Database access in a function

2020-12-18 Thread Giuseppe G. A. Celano
Hi, I have a script where I join two databases. It works. However, when I try to put the content of this script in a function, and then call it (with the databases being the arguments), the execution is slowed down (I guess the indexes are not properly accessed). Is there a way to overcome this

Re: [basex-talk] Sequence comparison

2020-11-26 Thread Giuseppe G. A. Celano
Hi Martin, What I was looking for is a “quick way” to get a comparison such that an item (when it is repeated more than once) is returned only as many times as it appears in both sequences. For example, in for $a in (1,2,3,5,3,3) where $a = (1,3,2,3, 2) group by $k := $a return {$a} you get

Re: [basex-talk] Sequence comparison

2020-11-25 Thread Giuseppe G. A. Celano
> On 25. Nov 2020, at 09:11, Martin Honnen wrote: > > Am 25.11.2020 um 08:39 schrieb Martin Honnen: >> Am 25.11.2020 um 06:37 schrieb Giuseppe G. A. Celano: >> >>> I have to compare two sequences and find common items, irrespective of >>> their positi

[basex-talk] Sequence comparison

2020-11-24 Thread Giuseppe G. A. Celano
Hi, I have to compare two sequences and find common items, irrespective of their positions: for $a in (1,2,3,5,3) for $u in (1,3,2,3) where $a = $u group by $o := $a return {$a} This returns 1 2 3 3 3 3 I would like 3 to be repeated only twice (i.e., each item in the first sequence should

[basex-talk] Improper use/potential bug error

2020-11-21 Thread Giuseppe G. A. Celano
Hi, I got an "Improper use? Potential bug?” error (see below) with a (complex) query which actually works when applied to many files (but not to all). This is the query (temporary links): https://git.informatik.uni-leipzig.de/celano/latinnlp/-/blob/master/scripts/03.00_normalize_spelling.xq <

[basex-talk] - in comments

2020-11-17 Thread Giuseppe G. A. Celano
Hi, /data() is printed as - , while "-” as - (even if both are xs:string): is there a reason? In any case, is there a function to convert into - ? Thanks. Best, Giuseppe

Re: [basex-talk] Progress bar

2020-11-11 Thread Giuseppe G. A. Celano
Hi Christian, Great! I am using trace((), “my message"). Do you know if there is a way to avoid printing the parentheses ()? Ciao, Giuseppe > On 11. Nov 2020, at 12:19, Christian Grün wrote: > > Hi Giuseppe, > >> I have written a BaseX script (which applies a few functions to files in a

[basex-talk] Progress bar

2020-11-11 Thread Giuseppe G. A. Celano
I have written a BaseX script (which applies a few functions to files in a directory), which I run at the command line. Is there a "trick" to get a progress bar for that (other than calling BaseX from a different programming language having some progress bar library)? Thanks. Best, Giuseppe

Re: [basex-talk] Joining large files

2020-07-13 Thread Giuseppe G. A. Celano
ib_parses//row > for $lemma in $lemmas($parse/field[@name = 'lemma_id']) > return (# db:copynode false #) { > element wf { >{ $parse/* }, >{ $lemma/* } > } > } > > > > On 7/11/20, Giuseppe G. A. Celano wrote: >> Hi, >> >> I am trying to p

Re: [basex-talk] Joining large files

2020-07-11 Thread Giuseppe G. A. Celano
It is the remnant of a previous version of the script, but it does not affect the query, as far as I have seen. It is deleted now. > On Jul 11, 2020, at 3:05 PM, Martin Honnen wrote: > > Am 11.07.2020 um 14:41 schrieb Giuseppe G. A. Celano: > >> I am trying to perfor

[basex-talk] Joining large files

2020-07-11 Thread Giuseppe G. A. Celano
Hi, I am trying to perform a join operation between two large XML files (~490 MB and ~40 MB), which are the result of the automatic conversion of old sql dumps into XML files. I created two databases for the files. The query I wrote to join them is correct because it works when I limit the join

[basex-talk] Position of attributes using copy/modify

2020-07-06 Thread Giuseppe G. A. Celano
Hi, I know that the order of attributes in XML is not relevant, but I am wondering whether there is a way to add an attribute as the last one using copy/modify expression. The “as last” option seems not to work for attributes. Cheers, Giuseppe

[basex-talk] Writing

2020-06-11 Thread Giuseppe G. A. Celano
Hi, I would like to print a comment containing only a dash (i.e., ) , but this is not allowed. I tried to use "-" instead of - in comment { "-” }, but such a string is converted to ‘-', so the error is still there. How can I print ? Should I simply use <->? In any case, I see that data()

[basex-talk] Text index

2019-12-12 Thread Giuseppe G. A. Celano
Hi, I am wondering whether it is possible to use indexes in a script even if a database is not created explicitly/previously. I see that sometimes, when comparing different XML texts accessed via doc(), text indexes are automatically created/used, but it is not clear to me whether/how I can sp

Re: [basex-talk] running in parallel

2019-12-09 Thread Giuseppe G. A. Celano
running system programs, fork-join() + proc:execute() is extremely useful. Giuseppe > On 9. Dec 2019, at 18:54, Giuseppe G. A. Celano > wrote: > > Thanks for your answers! > > I have run an experiment, and I confirm that fork-join() actually works, even > if the gain is

Re: [basex-talk] running in parallel

2019-12-09 Thread Giuseppe G. A. Celano
Thanks for your answers! I have run an experiment, and I confirm that fork-join() actually works, even if the gain is not as expected. Most importantly, I noticed that the amount of RAM made available is crucial: with 2MB the sequential script was very slow, while with 5/7MB it works fine. (2,

Re: [basex-talk] Join

2019-11-29 Thread Giuseppe G. A. Celano
t; Adding the text() step is one of them, so this could be the reason why > you need to add this step manually. > > Hope this helps, > Christian > > PS: I will see if there’s a chance to enable the discussed > optimization for documents with namespaces. > > > > On Th

[basex-talk] Join

2019-11-27 Thread Giuseppe G. A. Celano
Hi, I have the following query: count( for $r in doc("hib_parses.xml")//row let $i := doc("hib_lemmas.xml")//row[field[@name="lemma_lang_id"][. = "3"]] where $r/field[@name="lemma_id"] = $i/field[@name="lemma_id"] return $r ) I have noticed that the where clause needs to be changed into

Re: [basex-talk] proc:system

2019-11-13 Thread Giuseppe G. A. Celano
I would expect just some text, as with proc:system("ls") Usage: /usr/local/bin/tesseract --help | --help-extra | --version /usr/local/bin/tesseract --list-langs /usr/local/bin/tesseract imagename outputbase [options...] [configfile...] OCR options: -l LANG[+LANG]Specify languag

Re: [basex-talk] proc:system

2019-11-13 Thread Giuseppe G. A. Celano
Hi Christian, Interestingly, proc:execute("/usr/local/bin/tesseract") works (I have BaseX 9.2). proc:system("/usr/local/bin/tesseract") returns the following: > SET DEBUG true DEBUG: true > XQUERY proc:system("/usr/local/bin/tesseract") org.basex.query.QueryException: at org.basex.quer

[basex-talk] proc:system

2019-11-13 Thread Giuseppe G. A. Celano
Hi, When I try to run proc:system("/usr/local/bin/tesseract") I get the error [proc:code0001] Similarly: proc:system("tesseract") returns [proc:error] Cannot run program "tesseract": error=2, No such file or directory Similarly: proc:system("tesseract", (), map {"dir" : "/usr/local/bin/"})

[basex-talk] HTTP request

2019-10-18 Thread Giuseppe G. A. Celano
Hi, I have a curl request of the kind curl --data "something" http://something which I would like to perform using the HTTP module, but I cannot specify the data argument in the query. Any help? The following does not work: http:send-request(, 'http://something' , "somet

Re: [basex-talk] GUI, visualization panels

2019-09-10 Thread Giuseppe G. A. Celano
he issue so far. > > One thing, did you open a database first? Visualization are only available on > (opened) databases (not in-memory documents, such as XML read from > filesystem, http, ...) > > Kind regards, > Alex > >> On 7. Sep 2019, at 15:56, Giu

[basex-talk] GUI, visualization panels

2019-09-07 Thread Giuseppe G. A. Celano
Hi, Apparently, I cannot access the visualization panels in the GUI on my Mac (10.13.6) (they cannot be selected): am I missing anything? Thanks. Best, Giuseppe

Re: [basex-talk] xs:string("<")

2019-08-25 Thread Giuseppe G. A. Celano
Thanks! > On Aug 25, 2019, at 2:26 PM, Martin Honnen wrote: > > Am 25.08.2019 um 14:16 schrieb Giuseppe G. A. Celano: >> >> >> I am wondering why xs:string("&") is not possible, but xs:string("<") is >> (although XML does not all

[basex-talk] xs:string("<")

2019-08-25 Thread Giuseppe G. A. Celano
Hi, I am wondering why xs:string("&") is not possible, but xs:string("<") is (although XML does not allow both ). Is there any reason? Thanks. Best, Giuseppe

Re: [basex-talk] Map serialization

2019-08-19 Thread Giuseppe G. A. Celano
instead. If the output needs to be further > processed, the JSON functions may be the ones to choose. > > In which context do you work with serialized maps? > > Cheers, > Christian > > [1] https://www.w3.org/TR/xslt-xquery-serialization-31/ > > > > On Mon,

[basex-talk] Map serialization

2019-08-18 Thread Giuseppe G. A. Celano
Hi When maps are serialized, the text nodes of an element (e.g., r/text()) are serialized without quotes and tests with "instance-of" show that they actually are text nodes: Couldn't they be serialized with quotes? I see that with data(), the text is serialized with quotes although it is xs:u

Re: [basex-talk] Binary module

2019-08-14 Thread Giuseppe G. A. Celano
Hi Christian, Thanks! I missed that specification. Is there any reason why only the first octet is provided? More in general, I was interested to test how many bits/octects are used to represent an integer. > On Aug 14, 2019, at 10:58 AM, Christian Grün > wrote: > > bin:length(convert:integ

Re: [basex-talk] Binary module

2019-08-14 Thread Giuseppe G. A. Celano
t;>} >> } >> } > > Depending on the input string and it’s encoding (i.e. ‚a' will only need one > byte, but ‚ä' already needs two, ‚•' will even need three in utf8) your > string is converted to xs:base64Binary and the bin:length() function will > count

[basex-talk] Binary module

2019-08-13 Thread Giuseppe G. A. Celano
Hi I am playing around with the binary module. I have two simple questions: 1) convert:string-to-base64("sàà") returns sàà : what does it mean? I see in the documentation that I need to use string() to see the value of xs:base64Binary (c8Ogw6A=), but shouldn't xs:base64Binary already be outputt

Re: [basex-talk] Tumbling window

2019-04-03 Thread Giuseppe G. A. Celano
Thanks. I was close :) Dr. Giuseppe G. A. Celano DFG-project leader <http://gepris.dfg.de/gepris/projekt/408121292> Universität Leipzig Institute of Computer Science, NLP Augustusplatz 10 Tel: +4934132223 04109 Leipzig Deutschland E-mail: cel...@informatik.uni-leipzig.de <m

[basex-talk] Tumbling window

2019-04-03 Thread Giuseppe G. A. Celano
I have written the following code: for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".") start $a when fn:true() end $b next $r when ($b = "." and $r = "]") or $b = "." return {$s} which returns: this is a

Re: [basex-talk] Write functions in sequence

2019-03-12 Thread Giuseppe G. A. Celano
enting on this, but would there be a way to force completion of evaluation without embedding? > On Mar 12, 2019, at 11:44 AM, Giuseppe G. A. Celano > wrote: > > let $o := file:create-dir("/Users/mycomputer/prova") > let $o2 := file:write("/Users/mycomputer/prov

Re: [basex-talk] Write functions in sequence

2019-03-12 Thread Giuseppe G. A. Celano
$o2, $o3) This actually works. In my real example the writing of $o2 requires e few seconds. It might be that $o3 is evaluated while $o2 is still running? Dr. Giuseppe G. A. Celano DFG-project leader <http://gepris.dfg.de/gepris/projekt/408121292> Universität Leipzig Institute of Compu

[basex-talk] Write functions in sequence

2019-03-12 Thread Giuseppe G. A. Celano
Hi I wrote a single script which should do: write a file -> open this file -> write another different file. I put the write expressions in the right sequence, but it seems that the second one cannot happen because the file created by the first write function has not yet been created at the tim

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-20 Thread Giuseppe G. A. Celano
27;s the tail call :) >> else $prices >> ) >> }; >> >> >> { >> local:sum((), $bookstore/book) >> } >> > > You can check if your query is tail-call optimized using the query info > panel:

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread Giuseppe G. A. Celano
; { > let $sum := $sum + $books[1]/price > return ( > { $sum }, > $books[2] ! local:sum(tail($books), $sum) > ) > }; > > > { > local:sum($bookstore/book, 0) > } > > > > Jonathan > > On Mon, Feb 18, 2019 a

[basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread Giuseppe G. A. Celano
I am writing a recursive function which is similar to the one here: https://stackoverflow.com/questions/27702718/to-add-values-in-cumulative-format Interestingly, local:sum() works if there are not many . However with 38000 book element I get the error "Stack Overflow: Try tail recursion". Any

[basex-talk] If clause

2019-02-18 Thread Giuseppe G. A. Celano
Hi, I see that in BaseX 9.1.2 an expression such as "if (3) then 4 " does not raise an error, even if the "else" part is missing. Is this correct? Ciao, Giuseppe

Re: [basex-talk] proc:execute

2019-02-14 Thread Giuseppe G. A. Celano
t LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 absolute-path/python absolute-path/main.py and then I run in Basex proc:system("bash", "path-to-the-bash-file"). This works! Ciao, Giuseppe Dr. Giuseppe G. A. Celano DFG-project leader <http://gepris.d

Re: [basex-talk] proc:execute

2019-02-12 Thread Giuseppe G. A. Celano
" LC_ALL= Is there a way to force BaseX to start with utf-8? Thanks. Ciao, Giuseppe > On Feb 12, 2019, at 9:12 AM, Giuseppe G. A. Celano > wrote: > > Hi Liam > > Thanks. My locale is actually "en_US.UTF-8", so I do not know why the error > is raised >

Re: [basex-talk] proc:execute

2019-02-12 Thread Giuseppe G. A. Celano
Hi Liam Thanks. My locale is actually "en_US.UTF-8", so I do not know why the error is raised > On Feb 12, 2019, at 6:30 AM, Liam R. E. Quin wrote: > > On Tue, 2019-02-12 at 01:42 +0100, Giuseppe G. A. Celano wrote: >> UnicodeDecodeError: 'ascii' codec

[basex-talk] proc:execute

2019-02-11 Thread Giuseppe G. A. Celano
Hi, I am trying to run a parser via proc:execute/system. While if I run it from the command line, it works, it does not, if I run it via BaseX. More precisely, I get the following error: Traceback (most recent call last): File "main.py", line 325, in test_data = loader.load(param

Re: [basex-talk] BaseX 9.1.1

2018-12-17 Thread Giuseppe G. A. Celano
Awesome! Thank you so much for making BaseX better and better! Ciao, Giuseppe Dr. Giuseppe G. A. Celano DFG-project leader <http://gepris.dfg.de/gepris/projekt/408121292> Universität Leipzig Institute of Computer Science, NLP Augustusplatz 10 Tel: +4934132223 04109 Leipzig Deutschland

Re: [basex-talk] restxq

2018-11-11 Thread Giuseppe G. A. Celano
other basex folder. Ciao, Giuseppe > On Nov 9, 2018, at 6:21 PM, Andy Bunce wrote: > > Hi Giuseppe, > > You can use the dba app to see what settings are in use. Goto url > /dba/settings and check WEBPATH. > > /Andy > > > On Fri, 9 Nov 2018 at 13:10, Gi

Re: [basex-talk] restxq

2018-11-09 Thread Giuseppe G. A. Celano
t; > On 09/11/18 13:30, Christian Grün wrote: >> …difficult to tell. Could you please provide us with a minimized >> version and tell us the exact steps how to proceed (1. download >> basex91.zip, 2. unzip, etc.)? >> On Fri, Nov 9, 2018 at 1:03 PM Giuseppe G. A. Celano >

[basex-talk] restxq

2018-11-09 Thread Giuseppe G. A. Celano
I am trying to make a RESTXQ webservice I created with BaseX 8.3 available in Basex 9.2. I simply copied my "file.xqm" into the webapp folder but, when I type the path of a function contained in it, it does not work ("No function found that matches the request."). Strangely enough, when I minima