How to search json document using xquery and output results
Issues related to W3C XQuery.
-
- Posts: 21
- Joined: Sat Jan 07, 2017 12:54 am
How to search json document using xquery and output results
Hi
If I use this xquery against json document-
let $x:=cts:search(fn:doc()/colData, cts:json-property-value-query("taskData", "id"))
I don't get any output.
Is it a transformation issue? Which transformation scenario do I select/configure to work with json document and see the output??
The same query produces json output correctly in marklogic query console.
If I use this xquery against json document-
let $x:=cts:search(fn:doc()/colData, cts:json-property-value-query("taskData", "id"))
I don't get any output.
Is it a transformation issue? Which transformation scenario do I select/configure to work with json document and see the output??
The same query produces json output correctly in marklogic query console.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: How to search json document using xquery and output results
Post by alex_jitianu »
Hi,
To execute this inside Oxygen there are two possibilities:
1. Use the XPath/XQuery Builder. On the top of the view select the MarkLogic connection as the engine that will execute the queries. paste the query and execute it.
2. If you put the query inside an XQuery editor then you need to create a transformation scenario for it and, again, select the MarkLogic connection as the engine.
If it still doesn't work then perhaps the qconsole executes the query on a different database than Oxygen? I tried something similar and in my case the query returned the expected result. How I tested:
1. I've loaded inside the data base the JSON:
2. In the XQuery/XPath builder I've executed:
Best regards,
Alex
To execute this inside Oxygen there are two possibilities:
1. Use the XPath/XQuery Builder. On the top of the view select the MarkLogic connection as the engine that will execute the queries. paste the query and execute it.
2. If you put the query inside an XQuery editor then you need to create a transformation scenario for it and, again, select the MarkLogic connection as the engine.
If it still doesn't work then perhaps the qconsole executes the query on a different database than Oxygen? I tried something similar and in my case the query returned the expected result. How I tested:
1. I've loaded inside the data base the JSON:
Code: Select all
{"personnel": {"person": [
{
"id": "Big.Boss",
"name": {
"family": "Boss",
"given": "Big"
},
"email": "chief@oxygenxml.com",
"link": {"subordinates": "one.worker two.worker three.worker four.worker five.worker"}
}
]}}
Code: Select all
let $x:=cts:search(fn:doc()/personnel, cts:json-property-value-query("id", "Big.Boss"))
return $x
Alex
-
- Posts: 21
- Joined: Sat Jan 07, 2017 12:54 am
Re: How to search json document using xquery and output results
Alex
Please provide some details about configuring a transformation for json. What "Type"? I don't see Json transformation with XQuery. There is XML transformation with XQuery but that does not work.
Please provide some details about configuring a transformation for json. What "Type"? I don't see Json transformation with XQuery. There is XML transformation with XQuery but that does not work.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: How to search json document using xquery and output results
Post by alex_jitianu »
Hi,
Oxygen doesn't have a built-in engine for processing Json with XQuery. If the JSON is stored inside MarkLogic then you can create an XQuery, run it against the server and, in the context of the server, that query can process JSON. On the Oxygen side, you will create an XQuery transformation and in the scenario you will select the MarkLogic connection as the Engine.
Best regards,
Alex
Oxygen doesn't have a built-in engine for processing Json with XQuery. If the JSON is stored inside MarkLogic then you can create an XQuery, run it against the server and, in the context of the server, that query can process JSON. On the Oxygen side, you will create an XQuery transformation and in the scenario you will select the MarkLogic connection as the Engine.
Best regards,
Alex
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service