Questions tagged [xquery-3.0]

Use this tag for questions specific to XQuery version 3.0 and no other version.

XQuery 3.0 introduces the following new features:

  • Functions are first-class items which can be passed as parameters to other functions

  • Functions and variables support public and private annotations

  • Union types are allowed in function arguments

  • XML Schema 1.1 is supported

  • Clauses added to FLWOR expressions:

    • group by: assigns tuples in the input tuple stream to a group, returns a tuple for each group

    • tumbling window: destructing assignment of a sequence during iteration without intersection

    • sliding window: destructing assignment of a sequence during iteration with intersection

    • count clause: binds a variable to the position in each tuple in the tuple stream

    • allowing empty: facilitates outer joins as in SQL

  • decimal format declaration: adds a decimal format to the statically known decimal formats

  • try/catch expressions: allows for user defined recovery from errors

  • switch expressions: allows for user defined branching logic

References

159 questions
1
vote
2 answers

How to iterate over a map in XQuery?

Let's say I have map defined in XQuery like this: declare namespace map="http://www.w3.org/2005/xpath-functions/map"; let $x := map{'a':1, 'b':2} How do I iterate through $x without knowing the keys? For example: for $key, $value in $x (: Some…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
1
vote
1 answer

Efficiently grouping elements that exists in both documents (inner join) in Xquery

I have the following data: 1 Maths 2 Science 2 Advanced…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
1
vote
1 answer

Efficient way of finding elements that exists in one document but not the other in XQuery

I have the following data: 1 Maths 2 Science 2 Advanced…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
1
vote
1 answer

how to use group by in xquery version 1.0

I am working on a FLWOR XQuery expression and I want to use the group by in my code. but it gives me this error everytime I use group by "XPST0003: To use XQuery 3.0 syntax, you must request XQuery version 3.0 both in the prolog and in the command…
Ajmal Razeel
  • 1,663
  • 7
  • 27
  • 51
1
vote
2 answers

XQuery: How to retrieve the contents of an element once only despite multiple occurrences of a searchterm?

I have an XML file with a bunch of elements in it (see below). I would like to extract most of the informations given in the container and put them in a (X)HTML document. I'm able to perform a search and get the wanted element…
smo
  • 89
  • 8
1
vote
1 answer

XQuery/XPath LIMIT a sum

I am new to XQuery. I need to limit by 1 in XQuery but I'm having trouble. I am trying to find out the winner of a tournament by finding each players scores and summing up the scores to get the total scores. I then sort in descending order and try…
AlphaWolf
  • 183
  • 4
  • 16
1
vote
1 answer

remove empty attributes xquery3.0

here is a sample of my xml. let $test := stuff more stuff stuff stuff goes wild i would like to remove empty attributes…
duncdrum
  • 723
  • 5
  • 13
1
vote
1 answer

XQuery variable in return expression not resolving its value

I am trying to run XQuery code, but variable in return expression is not being resolved When I run the following XQuery code for $x in (,) return $x I get the output Which is fine, but when I run the following…
ammar26
  • 1,584
  • 4
  • 21
  • 41
1
vote
1 answer

Xquery: sum 1 second to given timestamp

Given this trades.xml:
SagittariusA
  • 5,289
  • 15
  • 73
  • 127
1
vote
1 answer

Which namespace to use for the function fn:parse-xml() in xquery?

When I am using fn:parse-xml in existDB getting error as: Function fn:parse-xml() is not defined in module namespace: http://www.w3.org/2005/xpath-functions Please help.
1
vote
1 answer

Evaluating if an attribute value is parseable to a xs:int

Background: I am trying to perform a query (using XQuery 3.0) on an attribute value (attrname) that might be either an xs:string or an xs:int, lets call it $a. If $a is able to be parsed to an xs:int then I want to compare it against an xs:int…
batista
  • 181
  • 2
  • 10
1
vote
0 answers

XQUERY GOUP BY CLAUSE

I am running XQuery using group by clause with large collection ,But I am getting out of main memory , it is taking huge memory to execute,our requirement should use the group by clause,Is their any alternate to group by.Please do the needful
vcsred
  • 29
  • 2
  • 5
1
vote
2 answers

How to get Parent node based on the value of a child node using XQuery

pen notebook pencile box pen notebook
utij2004
  • 453
  • 1
  • 5
  • 14
1
vote
1 answer

Calling XQuery using javascript

I want to call a XQuery function with JavaScript to retrieve data from a XML file. I'm able to call this simple function which doesn't read anything from any file: