XQuery Update Facility - xquery

I have got a quick question regarding XQuery update, Dose XQJ support implementing XQuery update facility to insert an element into an XML document?

This depends on the XQuery Processor and XQJ implementation you are working with. As an example, BaseX and Charles Foster's implementation of XQJ is one combination that in fact supports the XQuery Update Facility.

Zorba also supports XQJ and XQuery update. You can find out more at http://www.zorba-xquery.com/html/entry/2012/07/27/XQJ_From_Zorba

Related

Can we use xquery in eclipse?

I want to sort element of an xml file and then some query has to perform over that.For that I want to use xquery. I have gone through various sites but didn't find the accurate solution regarding "how can I write xquery in eclipse.Even I don't know Is it possible to use XQuery in Eclipse? If yes plz help.

Xquery version 0.9-ml to xquery version 1.0-ml updation

We have used these two files from marklogic community/common i.e cookies.xqy and dateparser.xqy
https://github.com/marklogic-community/commons/tree/master/http
https://github.com/marklogic-community/commons/tree/master/dates
now we are looking to switch to the latest version of marklogic i.e 10.0-2.1
and xquery verion 0.9-ml is deprecated in it . so we have to manually do the changes in these files or do we get it from anywhere.
The statefull-cookies.xqy file is in 1.0-ml syntax already, so you only need to rewrite cookies.xqy which would be minor changes, like replacing define with declare and some extra semi-colons.
The date library might a bit more work, although you could consider using this package instead. It is not an exact match, but pretty powerful, and thoroughly tested in the field:
https://github.com/grtjn/ml-datetime
Feel free to open tickets against it if there is functionality in commons/date lacking in ml-datetime.
HTH!

Difference among 3 processXQuery XPATH Extension Functions in Oracle Fusion 12 C

While creating mappings for Oracle 12C BPM, I am trying to use Xquery File to convert xs:dateTime to Custom XSD Time Format "DateTimeType" descibed here below
<xsd:simpleType name="DateTimeType">
<xsd:restriction base="xsd:dateTime">
<xsd:pattern value=".+T.+(Z|[+-].+)"/>
</xsd:restriction>
However, In order to use XQuery I am offered with 3 Choices by JDeveloper IDE
Here is official Oracle Doc Link
https://docs.oracle.com/cloud/latest/soacs_gs/SOASE/soa-xpath-extension-funcs.htm#SOASE2155
In JDEVELOPER BPM Mappings , There are 3 XPATH Extensions
B.3.29 processXQuery
B.3.30 processXQuery10
B.3.31 processXQuery2004
I have done a bit of research , But There seems not to be enough Oracle Documentation on it.
Can anyone help me in understanding difference among these 3 Extensions ?
Why Should I prefer one over the other ?
processXQuery2004() uses an XQuery processor based on a 2004 draft of W3C XQuery. It is kept around for backwards compatibility issues and you shouldn't use it for anything new.
processXQuery10() uses an XQuery processor based on the 1.0 W3C recommendation for XQuery. This is the one you should use. https://www.w3.org/TR/xquery/
I am not sure about processXQuery(). It might default to one of the previous two or use some older processor. In any case, processXQuery10() is what you should use.

Calling an XQuery function from XForms

I'd like to call an XQuery function that I have written from XForms. I know how to execute a request to an XQuery document:
<xf:submission resource="/exist/rest/apps/Main/modules/import.xql"/>
But what if I'd like to call a specific function in the XQuery document? It looks like this can be done with JavaScript with import module namespace but is there not a way to do this in XForms?
I suppose I can use exist-db's controller.xql to handle requests. Is this the simplest way to do it?
You can't! XForms is not XQuery and there is nothing in the XForms specification that let's you import an XQuery module.
As others have previously suggested you need to use HTTP to bridge the two, and if you want direct access over HTTP to an XQuery function, then RESTXQ is your best bet.

delete function in xquery

Is there a built-in delete function in XQuery that I can use to delete the actual file in the database in a certain directory say a/b/c/d.xml
How to implement one if there is no such function?
Deleting a document is implementation dependent. In MarkLogic Server, you would do this:
xdmp:document-delete("a/b/c/d.xml")
I realize that this question was posted nearly a year and a half ago, but I thought this would be a helpful contribution.
If you just want to delete a node, you can use this:
xdmp:node-delete(/parentNode/childNode)
The childNode would be deleted.
See this link
In Zorba and BaseX you would do file:remove("a/b/c/d.xml") (there are also other processors supporting this module, please add)

Resources