Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
Sunday
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
tuesday
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["mercury","venus","earth","mars"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[[1,2],[2,3]]
[[1,2,3],[4,5,6],[7,8,9]]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[10,11,12,13,14,15]
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ true
true
true
true
true
true
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"a":[1,2,3],"b":2}
{"id":404,"name":"Stanco Grease Pot","price":6.49,"weight":3.8,"uses":["Grease storage","Backpacking pot"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Sunday":1,"Monday":2,"Tuesday":3,"Wednesday":4,"Thursday":5,"Friday":6,"Saturday":7}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"element":<mercury>Hg</mercury>,"atomic value":"1896-01-24","several dates":["1066-10-14","1935-01-11","1989-11-09"]}
["1066-10-14",<mercury>Hg</mercury>,"ice cream"]
<x>10</x>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

(: Json Array Navigation Query :)
(: Just navigate through an array :)
let $x:=[2,5]
return $x(1)
let $wd := ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
return $wd(1)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

(: Json Array Navigation Query :)
(: Just navigate through an array :)
let $x:=[1,[2]]
return $x(2)(1)

let $x := [
[ "mercury", "venus", "earth", "mars" ],
[ "monday", "tuesday", "wednesday", "thursday" ]
]
return $x(2)(2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the white space before the new line at the end of the file?

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(: 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. :)

(: Json Array Navigation Query :)
let $x := [
[ "mercury", "venus", "earth", "mars" ],
[ "monday", "tuesday", "wednesday", "thursday" ]
]
return $x(1)
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@

(: Json Array Query :)
(: Just parse an array with nested arrays :)
[[1,2],[2,3]]
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(: 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. :)

(: Json Array Query :)
(: Parse an array with strings:)
[
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(: 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. :)

(: Json Array Query :)
(: Parse an array with XQuery expressions:)
[ 10 to 15 ]
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
under the License. :)

(: JSONiq fn:boolean :)
(
fn:boolean(null), fn:boolean({}), fn:boolean({"foo": 3, "bar":4}), fn:boolean({"foo": 3}), fn:boolean([]),
fn:boolean([1]), fn:boolean([1, 2]), fn:boolean(( [1], null ))
)
fn:boolean(jn:null()), fn:boolean({}), fn:boolean({ "foo": false() }), fn:boolean({"foo": 3, "bar":4}), fn:boolean({"foo": 3}), fn:boolean([]),
fn:boolean([1]), fn:boolean([1, 2]), fn:boolean(( [1], jn:null()))
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(: 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 fn:data :)
fn:data( {"foo" : 3, "bar" : 4 } )
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(: 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 fn:data :)
fn:data( { } )
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
specific language governing permissions and limitations
under the License. :)

(: JSONiq fn:data :)
(: JSONiq fn:string :)
(
fn:string(null)
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
specific language governing permissions and limitations
under the License. :)

(: JSONiq fn:data :)
(: JSONiq fn:string :)
(
fn:string({"foo" : 3})
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
specific language governing permissions and limitations
under the License. :)

(: JSONiq fn:data :)
(: JSONiq fn:string :)
(
fn:string([1])
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(: 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 fn:string :)
fn:string( {"foo" : 3, "bar" : 4 } )
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(: 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 fn:string :)
fn:string( { } )
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
(: Json Object Query :)
(: Pasrse object with arrays :)
{
"a": [
1,
2,
3
],
"b": 2
"id" : 404,
"name" : "Stanco Grease Pot",
"price" : 6.49,
"weight" : 3.8,
"uses" : ["Grease storage","Backpacking pot"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(: 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. :)

(: Json Object Query :)
(: Object Constructor with XQuery expressions :)
{
"Sunday" : 1,
"Monday" : 1 + 1,
"Tuesday" : 3 * 1,
"Wednesday" : 8 div 2,
"Thursday" : 5,
"Friday" : count(for $i in 1 to 6 return $i),
"Saturday" : 10 - 3,
"NotADay" ?: ()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(: 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. :)

(: XML in JSON :)
{
"element" : <mercury>Hg</mercury>,
"atomic value" : xs:date("1896-01-24")
"several dates" : [ xs:date("1066-10-14"), xs:date("1935-01-11"), xs:date("1989-11-09") ]
},
[ xs:date("1066-10-14"), <mercury>Hg</mercury>, "ice cream" ],
let $object := { "x" : 10, "y" : 12 }
let $x := $object("x")
return <x>{ $x }</x>
13 changes: 13 additions & 0 deletions vxquery-xtest/src/test/resources/VXQueryCatalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<!ENTITY JsonArrayNavigationQueries SYSTEM "cat/JsonArrayNavigationQueries.xml">
<!ENTITY JsonParserQueries SYSTEM "cat/JsonParserQueries.xml">
<!ENTITY LibrariesInJSONiq SYSTEM "cat/LibrariesInJSONiq.xml">
<!ENTITY XMLInJSONQueries SYSTEM "cat/XMLInJSONQueries.xml">

<!ENTITY TraceQuery SYSTEM "cat/TraceQuery.xml">

Expand Down Expand Up @@ -351,4 +352,16 @@
&SerializationQueries;
</test-group>
</test-group>
<test-group name="XMLInJSONQueries" featureOwner="Riyafa Abdul Hameed">
<GroupInfo>
<title>XML in JSON</title>
<description>XML in JSON</description>
</GroupInfo>
<test-group name="XMLInJSONQueries" featureOwner="Riyafa Abdul Hameed">
<GroupInfo>
<title>Tests for XML in JSON</title>
</GroupInfo>
&XMLInJSONQueries;
</test-group>
</test-group>
</test-suite>
20 changes: 20 additions & 0 deletions vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
<query name="fn_data3" date="2016-06-17"/>
<expected-error>JNTY0004</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_data" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for fn:data for JSON objects, arrays and null</description>
<query name="fn_data4" date="2016-08-21"/>
<expected-error>JNTY0004</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_data" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for fn:data for JSON objects, arrays and null</description>
<query name="fn_data5" date="2016-08-21"/>
<expected-error>JNTY0004</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_string" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for fn:string for JSON null</description>
<query name="fn_string1" date="2016-06-17"/>
Expand All @@ -56,6 +66,16 @@
<query name="fn_string3" date="2016-06-17"/>
<expected-error>JNTY0024</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_data" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for fn:string for JSON arrays</description>
<query name="fn_string4" date="2016-08-21"/>
<expected-error>JNTY0024</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_data" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for fn:string for JSON arrays</description>
<query name="fn_string5" date="2016-08-21"/>
<expected-error>JNTY0024</expected-error>
</test-case>
<test-case name="functions-in-jsoniq-fn_data" FilePath="Json/Functions/" Creator="Riyafa Abdul Hameed">
<description>Query for cast for JSON null</description>
<query name="cast" date="2016-06-23"/>
Expand Down
Loading