jsoniq

What are the differences between JSONiq and XQuery 3.1?

喜夏-厌秋 提交于 2020-01-14 08:06:29
问题 Both JSONiq and XQuery 3.1 extend XQuery 3.0 with support for JSON. How do they differ? 回答1: Overall motivation XQuery 3.1 was designed with the goal to support additional data structures (maps, arrays) in memory. These structures are mapped to JSON for input and output. XQuery 3.1 has been a W3C recommendation since March 2017. JSONiq was designed with the goal of querying and updating JSON in settings such as document stores. It was also designed by members of the XML Query working group

How to run JSONiq from JSON with try.zorba.io

萝らか妹 提交于 2019-12-11 11:28:32
问题 I need to write a JSONiq expression that lists only the name of the products that cost at least 3. This is my JSON file which i had typed in the XQuery section: { "supermarket_visit":{ "date":"08032019", "bought":[ "item",{ "type":"confectionary", "item_name":"Kit_Kat", "number": 3, "individual_price": 3.5 }, "item",{ "type":"drinks", "item_name":"Coca_Cola", "number": 2, "individual_price": 3 }, "item",{ "type":"fruits", "item_name":"apples", "number": "some" } ],  "next_visit":[ "item",{

What are the differences between JSONiq and XQuery 3.1?

微笑、不失礼 提交于 2019-12-01 17:42:11
Both JSONiq and XQuery 3.1 extend XQuery 3.0 with support for JSON. How do they differ? Overall motivation XQuery 3.1 was designed with the goal to support additional data structures (maps, arrays) in memory. These structures are mapped to JSON for input and output. XQuery 3.1 has been a W3C recommendation since March 2017. JSONiq was designed with the goal of querying and updating JSON in settings such as document stores. It was also designed by members of the XML Query working group (disclaimer: I am one of them) while investigating various possibilities to support JSON. While it is not an

Eliminate duplicates in array (JSONiq)

余生长醉 提交于 2019-11-29 12:21:37
I'd like to delete duplicates in a JSONiq array. let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5] How can I eliminate the duplicates in $x? let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5] return [ distinct-values($x[]) ] Paul Sweatte Use the replace function multiple times: replace($x, "([1-5])(.*)\1", "$1") Here's a fully functional JavaScript equivalent: [1,2,4,3,3,1,2,5].toString().replace(/([1-5]),(\1)/g, "$1").replace(/(,[1-5])(.*)(\1)/g,"$1$2").replace(/([1-5])(.*)(,\1)/g,"$1$2") Here is a generic JavaScript equivalent via the JSON.parse() method, which removes duplicates automatically: var foo = [1,2,4,3,3

Eliminate duplicates in array (JSONiq)

南楼画角 提交于 2019-11-28 06:02:19
问题 I'd like to delete duplicates in a JSONiq array. let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5] How can I eliminate the duplicates in $x? 回答1: let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5] return [ distinct-values($x[]) ] 回答2: Use the replace function multiple times: replace($x, "([1-5])(.*)\1", "$1") Here's a fully functional JavaScript equivalent: [1,2,4,3,3,1,2,5].toString().replace(/([1-5]),(\1)/g, "$1").replace(/(,[1-5])(.*)(\1)/g,"$1$2").replace(/([1-5])(.*)(,\1)/g,"$1$2") Here is a generic JavaScript