xquery | Extract data or evaluate value | Parser library
kandi X-RAY | xquery Summary
kandi X-RAY | xquery Summary
HTML Query [GoDoc] ===. Extract data from HTML document. XML Query [GoDoc] === Extract data from XML document.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xquery
xquery Key Features
xquery Examples and Code Snippets
Community Discussions
Trending Discussions on xquery
QUESTION
Is it possible to call java function using XQuery in MarkLogic. ?
Please refer - https://stackoverflow.com/questions/65953901/calling-java-method-from-xquery
Example -
...ANSWER
Answered 2021-Jun-14 at 12:57There's no way to directly call a Java function from MarkLogic XQuery. If the Java code is accessible through a web service, you can use xdmp:http-get
and similar.
As noted by Martin, depending on what functionality you're trying to access, you might not need to use Java.
QUESTION
While reading MarkLogic Query Performance and Tuning Guide
, I got to know about empty greatest
and empty least
and how it can be used with order by
. However, there is not much detail or examples available for this to understand other than this:
...You can specify either empty greatest or empty least, but empties always need to be at the end for the order by optimizations to work. For example, empty greatest is optimized with ascending; empty least is optimized with descending. If neither is specified, MarkLogic chooses the order that is optimized. The following example goes against the default. It orders the list by $doc/document/modified_date, ascending order, with empty least:
ANSWER
Answered 2021-Jun-12 at 06:45In the XQuery Spec https://www.w3.org/TR/xquery-31/#id-order-by-clause it is explained as
For the purpose of determining their relative position in the ordering sequence, the greater-than relationship between two orderspec values W and V is defined as follows:
When the orderspec specifies empty least, the following rules are applied in order:
If V is an empty sequence and W is not an empty sequence, then W greater-than V is true.
If V is NaN and W is neither NaN nor an empty sequence, then W greater-than V is true.
If a specific collation C is specified, and V and W are both of type xs:string or are convertible to xs:string by subtype substitution and/or type promotion, then:
If fn:compare(V, W, C) is less than zero, then W greater-than V is true; otherwise W greater-than V is false.
If none of the above rules apply, then:
If W gt V is true, then W greater-than V is true; otherwise W greater-than V is false.
When the orderspec specifies empty greatest, the following rules are applied in order:
If W is an empty sequence and V is not an empty sequence, then W greater-than V is true.
If W is NaN and V is neither NaN nor an empty sequence, then W greater-than V is true.
If a specific collation C is specified, and V and W are both of type xs:string or are convertible to xs:string by subtype substitution and/or type promotion, then:
If fn:compare(V, W, C) is less than zero, then W greater-than V is true; otherwise W greater-than V is false.
If none of the above rules apply, then:
If W gt V is true, then W greater-than V is true; otherwise W greater-than V is false.
Basically, if an expression used in an order by clause gives an empty sequence for an item to be ordered, the empty least
declares to sort it before items that have a non-empty sort key while empty greatest
sort it after those items.
A simple example:
The XQuery
QUESTION
I need some help with MarkLogic, XQuery & corb,
I have millions of documents in the database, I'm trying to write the XQuery to saved the matched uris.
urisVersions.xqy
...ANSWER
Answered 2021-Jun-10 at 17:42Configure the job with the PROCESS-TASK
option to use the com.marklogic.developer.corb.ExportBatchToFileTask
class, which will write the results of each process module invocation to an output file. You can configure where to write the file and the filename with EXPORT-FILE-NAME
and EXPORT-FILE-DIR
options. If you don't configure the EXPORT-FILE-DIR and just give it a filename with EXPORT-FILE-NAME it writes relative from where CoRB is launched.
QUESTION
Building on Count number of elements with same tag
I will be running this query with BaseX 9.5.2.
Given the data
...ANSWER
Answered 2021-Jun-08 at 19:56Due to the grouping you already have, count($elems)
will have the right value in the return
clause.
I think you original use of the let $sep
is causing problems, the grouping count($elems)
I suggested works fine for me at https://xqueryfiddle.liberty-development.net/bFDbxm7 where I have moved the $sep
to a declared variable.
QUESTION
Building upon books.xml transform to CSV: repeat title on each row:
For the document below, how can I count
- the number of authors per book
- the number of unique authors per book?
In this case, they would both be the same:
...ANSWER
Answered 2021-Jun-08 at 18:14I am using BaseX v.9.5.2
XQuery
QUESTION
I want to get xml input file via the MarkLogic CoRB Tool to proceed further, but not able to get this file via CoRB tool:
ML config Properties file:
...ANSWER
Answered 2021-Jun-07 at 21:24The CoRB StreamingXPath is not currently able to register and leverage namespaces and namespace-prefixes, so the XPath targeting namespace-qualified elements can't leverage namespace-prefixes.
A more generic match on the document element with a predicate filtering by local-name()
will work though. It's a little ugly and a lot more typing, but works:
QUESTION
I just received a helpful answer to a question about xml->tabular transformation, but I don't understand how to apply it to a document where an element may have several child nodes with the same tag.
As a minimal example, consider the books.xml
file at the W3Schools web site.
ANSWER
Answered 2021-Jun-07 at 03:16If you want a row for each author, then create a row for each author:
XSLT 1.0
QUESTION
I would like to convert NCBI's Biosample Metadata XML file to CSV, or RDF/XML as a second choice. To do that, I believe I have to learn more about the structure of this file. I can run basic XQueries in BaseX*, like just listing all values, but then I've been using shell tools like
sort|uniq -c
to count them. I have heard about XSLT
transformations and GRDDL
in passing, but I don't think a style sheet is provided for this XML document, and I don't know how to create or discover one.
For example, can I get a count of the number of s for each ? Are there any
with more than one primary
? What are the most common db attributes of the primary Ids?
Here's a query that shows my maximum level of XQuery sophistication at this point:
...ANSWER
Answered 2021-Jun-06 at 17:58similar to my answer for https://www.biostars.org/p/280581/ using my tool xsltstream:
QUESTION
I've have a table which contains XML data with several nodes in one of the columns. Something similar to the below.
...ANSWER
Answered 2021-Jun-06 at 03:48Please try the following solution.
It is a minimal reproducible example. You copy it to SSMS as-is, and it works.
It handles the default namespace via WITH XMLNAMESPACES
clause.
SQL
QUESTION
XQuery 3.1 introduced several JSON functions. I was wondering if these functions were designed with advanced JSON editing in mind.
As far as I can tell, these functions only work for simple JSONs, like for instance...
...ANSWER
Answered 2021-May-22 at 20:35You're correct that doing what I call deep update of a map is quite difficult with XQuery 3.1 (and indeed XSLT 3.0) as currently defined. And it's not easy to define language constructs with clean semantics. I attempted to design a construct as an XSLT extension instruction - see https://saxonica.com/documentation10/index.html#!extensions/instructions/deep-update -- but I don't think its anywhere near a perfect solution.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xquery
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page