flwor

FLWOR query in eXist gives: XML Parsing Error: no root element found

陌路散爱 提交于 2021-02-11 15:14:37
问题 I'm looking to adapt the simplest possible FLWOR possible from BaseX to eXist as below. Error in eXist : XML Parsing Error: no root element found Location: http://localhost:8080/exist/rest/db/scripts/notes.xq Line Number 1, Column 1: Query: xquery version "3.0"; for $note in collection("/db/temp/notes") return $note Collection: <notes> <note> foo </note> <note> bar </note> <note> baz </note> </notes> from BaseX : nicholas@mordor:~/basex$ nicholas@mordor:~/basex$ cat notes.xq xquery version "3

Why does Firefox show: XML Parsing Error: junk after document element?

限于喜欢 提交于 2021-02-11 14:22:57
问题 Error: yet from the console, desired output: nicholas@mordor:~$ nicholas@mordor:~$ curl http://localhost:8080/exist/rest/db/scripts/notes.xq <notes> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> <note> foo </note> <note> bar </note> </notes> <notes> <note> foo </note> <note> bar </note> <note> baz </note> </notes>nicholas@mordor:~$ nicholas@mordor:~$ nicholas@mordor:~$ lynx http://localhost:8080/exist/rest/db/scripts

how to include the value of position() in an Xquery result?

六月ゝ 毕业季﹏ 提交于 2021-02-11 14:22:48
问题 Without using tumbling windows, how is the position itself included in a result? Obviously "$p" should be the "index" of each $item in $items. That being said, iteration isn't guaranteed to be sequential at all. output: <result> <items> <item pos="$p">5</item> <item pos="$p">3</item> <item pos="$p">7</item> <item pos="$p">2</item> <item pos="$p">7</item> <item pos="$p">3</item> </items> </result> query: xquery version "3.1"; let $items := (5,3,7,2,7,3) return <result> <items> { for $item in

nested looping within Xquery results in a mismatch? and idioms

北城以北 提交于 2021-02-11 12:29:38
问题 I'm playing with the bookstore XML from w3schools: <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt

Xquery FLWOR with group by

天大地大妈咪最大 提交于 2021-02-07 19:12:01
问题 I want to group all movies by genre and then list all movie titles in this genre. My XML movie database looks as following: <movies> <movie> <title>A History of Violence</title> <year>2005</year> <country>USA</country> <genre>Crime</genre> <summary>Tom Stall, a humble family man and owner of a popular neighborhood restaurant, lives a quiet but fulfilling existence in the Midwest. One night Tom foils a crime at his place of business and, to his chagrin, is plastered all over the news for his

Converting xml to csv from XQuery in BaseX

不想你离开。 提交于 2021-02-07 08:38:53
问题 The reason for which I'm writing is because I have a database of approx 1k of xmls in BaseX. I already cleaned it and got the info I wanted. Nevertheless, I want to be able to export that data in the CSV format. When I tried with the code given in the BaseX documentation it gave me this: Desc,Cantidad,Valor,Fecha,Lugar,UUID ,,,,, ,,,,, And it should show the data between the commas. What I am asking is how should I modify my code in order for the data to appear. My code is the following:

Converting xml to csv from XQuery in BaseX

非 Y 不嫁゛ 提交于 2021-02-07 08:37:41
问题 The reason for which I'm writing is because I have a database of approx 1k of xmls in BaseX. I already cleaned it and got the info I wanted. Nevertheless, I want to be able to export that data in the CSV format. When I tried with the code given in the BaseX documentation it gave me this: Desc,Cantidad,Valor,Fecha,Lugar,UUID ,,,,, ,,,,, And it should show the data between the commas. What I am asking is how should I modify my code in order for the data to appear. My code is the following:

how to count the number of elements in XML?

泄露秘密 提交于 2021-01-29 15:12:12
问题 I'm looking to get basic metadata about the data within a database. Specifically, the number of line elements which are surrouned by the root text element. Analogous to what I'd expect COUNT to return in SQL -- a single integer. the database: thufir@dur:~/flwor/group$ thufir@dur:~/flwor/group$ basex BaseX 9.0.1 [Standalone] Try 'help' to get more information. > > open people Database 'people' was opened in 225.24 ms. > > xquery / <text> <line>people</line> <line>joe</line> <line>phone1</line>

How to set the serialization parameters for exporting data with BaseX?

落花浮王杯 提交于 2021-01-29 09:25:28
问题 How can I export what originated as a JSONArray object into a valid JSON file? It seems to be a matter of setting some export options. exporting the data file as XML : thufir@dur:~/flwor/foo$ thufir@dur:~/flwor/foo$ basex BaseX 9.0.1 [Standalone] Try 'help' to get more information. > > open foo_json Database 'foo_json' was opened in 383.76 ms. > > set parser json PARSER: json > > export /home/thufir/flwor/foo Database 'foo_json' was exported in 16.11 ms. > > exit Enjoy life. thufir@dur:~

How to parse a date and time (timestamp) to query for a range with XML?

放肆的年华 提交于 2020-12-27 07:13:42
问题 this is a start: > > XQUERY fn:parse-ietf-date('Tue, 18 Jun 2019 13:10:56 GMT') 2019-06-18T13:10:56Z Query executed in 425.5 ms. > from the basex console. need to apply to the query for a searchable date. see also: Inverse function to format-date Google chat, or "hangouts" exports its data as JSON. The dates are in UTC as a String, looking at least similar to: Thursday, 17-Dec-20 14:29:33 UTC in RFC 2822 https://www.unixtimestamp.com/ Assuming RFC 2822, or similar, then how would that String