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
2
votes
1 answer

XQuery HTML array input

I am new to XQuery 3.0 and trying to write a project. I am sending a post request containing song[] input element. However, when I try to use request:get-parameter('song[]', ''), it gives me a result as below: Value 1 Value 2 Value 3 Anyone knows…
yenerunver
  • 416
  • 1
  • 5
  • 26
2
votes
1 answer

Xquery return the names and values of all child nodes

I'm very new to Xquery and am trying to write a function that takes the names of child nodes (one by one) and compares them against the children of another node (which is always the same), and then where the names are the same, updates the latter…
TimJ
  • 21
  • 1
  • 2
2
votes
1 answer

How to store XQuery results as new document in BaseX

I am very new to XML document database technologies, Xquery/Xpath and so on. So this is probably a very newbie question. Scenario: A number of XML documents as the input, want to run some number of transformations can be run on these XML documents…
barab157
  • 111
  • 1
  • 4
2
votes
1 answer

How to select an attribute by a variable in xquery?

I know how to select an attribute like so: $table/@id However how do I do this if the attribute name is stored as a variable. For example: let $x = "id" $table/@[$x]
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231
2
votes
1 answer

Detect last post-grouping tuple

In XQuery 3.0, how is it possible to detect the last post-grouping tuple (defined by XQuery 3.0 spec) produced by the return clause? Is it possible to use something like position() = last()? What would be the context for the position function? For…
Jindřich Mynarz
  • 1,563
  • 1
  • 16
  • 31
2
votes
2 answers

exist-db restxq trigger : Services deleted but still active

I have issues with the RESTXQ implementation in exist-db. I think it might be the RestXQTrigger which is not working correctly. The problem: I deleted (via the Dashboard) a collection including RESTXQ services inside several .xqm files. However, the…
Eric S
  • 452
  • 4
  • 10
2
votes
1 answer

How to catch errors in XQuery 3.0?

I am reading the W3C Recommendation for XQuery 3.0. Here is what I tried to do: try { 3 div 0 } catch err:XPTY0004{ 'typing error' } catch * { $err:code || ' ' || $err:description || ' ' || $err:value || ' ' || …
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100
2
votes
1 answer

Why group by $variable/@attribute doesn't work?

Problem background Given the categories from each family...
falsarella
  • 12,217
  • 9
  • 69
  • 115
2
votes
2 answers

Add an attribute to an element in an existing XML using Xquery

I need to add an attribute to an element of my response XML using XQuery. Take the below XML as input,
JPS
  • 2,730
  • 5
  • 32
  • 54
2
votes
1 answer

XPath expression using idref

I am reading about and testing XQuery and like test tools I use BaseX(www.basex.org) and saxon-HE 9.4.0.6N. For the following simple XML file - no schema attached to the sample.xml:
dag
  • 288
  • 2
  • 10
1
vote
1 answer

Send HTTP Request from local server to remote server

I am using BaseX version 9.5, I am trying to send HTTP request from local to remote server to read database, but not getting the response. let $server := 'http://10.102.xxx.xxx:8984/rest/' let $sendreq := (http:send-request( …
1
vote
1 answer

XSLT 3 Saxon, filtering unwanted array elements using deep-update and filter

XSLT 3 is causing "SENR0001: Cannot serialize a map using this output method" error while transforming JSON natively using Saxon EE library capabilities ( 'saxon:with-pedigree' , 'saxon:pedigree(.)?container, and 'deep-update'). Below XSLT…
vcb
  • 13
  • 3
1
vote
0 answers

Store unwellformed XHTML in Basex DB

I have to store XHTML which is not wellformed e.g.() so there is no closing element for element or self close. I am using the REST service to store data into database, below is the code: let $$DocPath:= 'D:\sample\' for $files…
1
vote
1 answer

how can i remove special emoji's using xquery from text

I have a $text = "Hello üäö$" I wanted to remove just emoji's from the text using xquery. How can i do that? Expected result : "Hello üäö$" i tried to use: replace($text, '\p{IsEmoticons}+', '') but didn't work. it just removed smiley's Result…
1
vote
1 answer

How to insert XML Content in db using SQL Module

I am a beginner in XQuery and I could use some help on how to insert XML elements in my MySQL database. So far, it only inserts pieces of fragments of an xml file but I'd like to fetch the full fragments, including the elements along the…
Salim-dev
  • 13
  • 2
1 2
3
10 11