Repository: vxquery Updated Branches: refs/heads/master af1ce5a82 -> 0419d3981
JSONiq get started documentation Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/0419d398 Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/0419d398 Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/0419d398 Branch: refs/heads/master Commit: 0419d398114a663ebacc0bc7b1658c7480a59a6d Parents: af1ce5a Author: riyafa <[email protected]> Authored: Sat Aug 6 10:22:58 2016 +0530 Committer: riyafa <[email protected]> Committed: Fri Aug 12 13:24:32 2016 +0530 ---------------------------------------------------------------------- src/site/apt/user_get_started_with_jsoniq.apt | 97 ++++++++++++++++++++++ src/site/site.xml | 3 + 2 files changed, 100 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/vxquery/blob/0419d398/src/site/apt/user_get_started_with_jsoniq.apt ---------------------------------------------------------------------- diff --git a/src/site/apt/user_get_started_with_jsoniq.apt b/src/site/apt/user_get_started_with_jsoniq.apt new file mode 100644 index 0000000..05fc056 --- /dev/null +++ b/src/site/apt/user_get_started_with_jsoniq.apt @@ -0,0 +1,97 @@ +~~ Licensed to the Apache Software Foundation (ASF) under one or more +~~ contributor license agreements. See the NOTICE file distributed with +~~ this work for additional information regarding copyright ownership. +~~ The ASF licenses this file to You under the Apache License, Version 2.0 +~~ (the "License"); you may not use this file except in compliance with +~~ the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, software +~~ distributed under the License is distributed on an "AS IS" BASIS, +~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +~~ See the License for the specific language governing permissions and +~~ limitations under the License. + +JSONiq extension to XQuery + + The {{{http://jsoniq.org/docs/JSONiqExtensionToXQuery/html-single/index.html}JSONiq}} extension to XQuery allows processing XML and JSON natively and with a single language. + + +* Example + + This example uses the XML file (books.xml) from {{{http://www.w3schools.com/xsl/xquery_intro.asp}W3Schools XQuery Tutorial}} + + [[i]] Query: + +---------------------------------------- +[ + for $book in doc("books.xml")/bookstore/book + return + { + "category":data($book/@category), + "title":data($book/title), + "author":data($book/author) + "year":xs:integer($book/year), + "price":xs:float($book/price) + } +] +---------------------------------------- + + [[i]] Result: + +---------------------------------------- +[ + { + "category":"COOKING", + "title":"Everyday Italian", + "author":"Giada De Laurentiis", + "year":2005, + "price":30 + }, + { + "category":"CHILDREN", + "title":"Harry Potter", + "author":"J K. Rowling", + "year":2005, + "price":29.99 + }, + { + "category":"WEB", + "title":"XQuery Kick Start", + "author":[ + "James McGovern", + "Per Bothner", + "Kurt Cagle", + "James Linn", + "Vaidyanathan Nagarajan" + ], + "year":2003, + "price":49.99 + }, + { + "category":"WEB", + "title":"Learning XML", + "author":"Erik T. Ray", + "year":2003, + "price":39.95 + } +] +---------------------------------------- + + [[i]] The following query uses the above result (given in a file books.json): + +---------------------------------------- +let $books := jn:json-doc("books.json") +for $x in $books() +where $x("price")>30 +order by $x("title") +return $x("title") +---------------------------------------- + + [[i]] Result + +---------------------------------------- +Learning XML +XQuery Kick Start +---------------------------------------- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/0419d398/src/site/site.xml ---------------------------------------------------------------------- diff --git a/src/site/site.xml b/src/site/site.xml index bf69e70..4e6f189 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -64,6 +64,9 @@ limitations under the License. name="Executing a Query" href="user_query.html" /> <item + name="Get Started with JSONiq" + href="user_get_started_with_jsoniq.html" /> + <item name="Using HDFS with VXQuery" href="user_query_hdfs.html" /> <item
