Repository: vxquery Updated Branches: refs/heads/master 5a9053bb6 -> 6bee358bc
Add missing specification examples in tests Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/6bee358b Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/6bee358b Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/6bee358b Branch: refs/heads/master Commit: 6bee358bca04ae3517d69155c0f8e9cf8239c883 Parents: 5a9053b Author: riyafa <[email protected]> Authored: Sun Aug 21 12:13:36 2016 +0530 Committer: riyafa <[email protected]> Committed: Mon Aug 22 09:12:27 2016 +0530 ---------------------------------------------------------------------- .../Array/Navigation/q01_array_navigation.txt | 2 +- .../Array/Navigation/q02_array_navigation.txt | 2 +- .../Array/Navigation/q08_array_navigation.txt | 1 + .../Json/Array/q03_array.txt | 2 +- .../Json/Array/q05_array.txt | 1 + .../Json/Array/q06_array.txt | 1 + .../Json/Functions/fn_boolean.txt | 1 + .../Json/Object/q06_object.txt | 2 +- .../Json/Object/q19_object.txt | 1 + .../Json/xml_in_json/xml_in_json.txt | 3 ++ .../Array/Navigation/q01_array_navigation.xq | 4 +-- .../Array/Navigation/q02_array_navigation.xq | 8 ++++-- .../Array/Navigation/q08_array_navigation.xq | 23 ++++++++++++++++ .../Queries/XQuery/Json/Array/q03_array.xq | 6 +++- .../Queries/XQuery/Json/Array/q05_array.xq | 28 +++++++++++++++++++ .../Queries/XQuery/Json/Array/q06_array.xq | 20 ++++++++++++++ .../Queries/XQuery/Json/Functions/fn_boolean.xq | 6 ++-- .../Queries/XQuery/Json/Functions/fn_data4.xq | 19 +++++++++++++ .../Queries/XQuery/Json/Functions/fn_data5.xq | 19 +++++++++++++ .../Queries/XQuery/Json/Functions/fn_string1.xq | 2 +- .../Queries/XQuery/Json/Functions/fn_string2.xq | 2 +- .../Queries/XQuery/Json/Functions/fn_string3.xq | 2 +- .../Queries/XQuery/Json/Functions/fn_string4.xq | 19 +++++++++++++ .../Queries/XQuery/Json/Functions/fn_string5.xq | 19 +++++++++++++ .../Queries/XQuery/Json/Object/q06_object.xq | 11 ++++---- .../Queries/XQuery/Json/Object/q19_object.xq | 29 ++++++++++++++++++++ .../XQuery/Json/xml_in_json/xml_in_json.xq | 27 ++++++++++++++++++ .../src/test/resources/VXQueryCatalog.xml | 13 +++++++++ .../test/resources/cat/FunctionsInJSONiq.xml | 20 ++++++++++++++ .../cat/JsonArrayNavigationQueries.xml | 5 ++++ .../src/test/resources/cat/JsonArrayQueries.xml | 10 +++++++ .../test/resources/cat/JsonObjectQueries.xml | 5 ++++ .../src/test/resources/cat/XMLInJSONQueries.xml | 26 ++++++++++++++++++ 33 files changed, 316 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q01_array_navigation.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q01_array_navigation.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q01_array_navigation.txt index d8263ee..d7c9777 100644 --- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q01_array_navigation.txt +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q01_array_navigation.txt @@ -1 +1 @@ -2 \ No newline at end of file +Sunday \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q02_array_navigation.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q02_array_navigation.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q02_array_navigation.txt index d8263ee..266128b 100644 --- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q02_array_navigation.txt +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q02_array_navigation.txt @@ -1 +1 @@ -2 \ No newline at end of file +tuesday \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q08_array_navigation.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q08_array_navigation.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q08_array_navigation.txt new file mode 100644 index 0000000..ed9ec77 --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/Navigation/q08_array_navigation.txt @@ -0,0 +1 @@ +["mercury","venus","earth","mars"] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt index 5a56543..e505909 100644 --- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt @@ -1 +1 @@ -[[1,2],[2,3]] \ No newline at end of file +[[1,2,3],[4,5,6],[7,8,9]] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q05_array.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q05_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q05_array.txt new file mode 100644 index 0000000..4b32c68 --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q05_array.txt @@ -0,0 +1 @@ +["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q06_array.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q06_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q06_array.txt new file mode 100644 index 0000000..8c3b1c5 --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q06_array.txt @@ -0,0 +1 @@ +[10,11,12,13,14,15] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Functions/fn_boolean.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Functions/fn_boolean.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Functions/fn_boolean.txt index edbc456..cd6d33f 100644 --- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Functions/fn_boolean.txt +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Functions/fn_boolean.txt @@ -5,4 +5,5 @@ true true true true +true true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q06_object.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q06_object.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q06_object.txt index 38e1ec3..c55676c 100644 --- a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q06_object.txt +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q06_object.txt @@ -1 +1 @@ -{"a":[1,2,3],"b":2} \ No newline at end of file +{"id":404,"name":"Stanco Grease Pot","price":6.49,"weight":3.8,"uses":["Grease storage","Backpacking pot"]} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q19_object.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q19_object.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q19_object.txt new file mode 100644 index 0000000..84dd8df --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q19_object.txt @@ -0,0 +1 @@ +{"Sunday":1,"Monday":2,"Tuesday":3,"Wednesday":4,"Thursday":5,"Friday":6,"Saturday":7} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/xml_in_json/xml_in_json.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/xml_in_json/xml_in_json.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/xml_in_json/xml_in_json.txt new file mode 100644 index 0000000..ceec4ad --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/xml_in_json/xml_in_json.txt @@ -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> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q01_array_navigation.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q01_array_navigation.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q01_array_navigation.xq index a45c196..15493f7 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q01_array_navigation.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q01_array_navigation.xq @@ -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) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q02_array_navigation.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q02_array_navigation.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q02_array_navigation.xq index 585bf5e..f1e5daf 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q02_array_navigation.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q02_array_navigation.xq @@ -17,6 +17,8 @@ (: Json Array Navigation Query :) (: Just navigate through an array :) - let $x:=[1,[2]] - return $x(2)(1) - \ No newline at end of file +let $x := [ + [ "mercury", "venus", "earth", "mars" ], + [ "monday", "tuesday", "wednesday", "thursday" ] +] +return $x(2)(2) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q08_array_navigation.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q08_array_navigation.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q08_array_navigation.xq new file mode 100644 index 0000000..4d5d1c8 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/Navigation/q08_array_navigation.xq @@ -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) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_array.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_array.xq index f9913be..f82992b 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_array.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_array.xq @@ -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] +] http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q05_array.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q05_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q05_array.xq new file mode 100644 index 0000000..39012c1 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q05_array.xq @@ -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" +] http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q06_array.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q06_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q06_array.xq new file mode 100644 index 0000000..d11fd36 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q06_array.xq @@ -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 ] http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_boolean.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_boolean.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_boolean.xq index b0bf9b2..3f9d91d 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_boolean.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_boolean.xq @@ -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())) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data4.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data4.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data4.xq new file mode 100644 index 0000000..472df7f --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data4.xq @@ -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 } ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data5.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data5.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data5.xq new file mode 100644 index 0000000..3ac85a1 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_data5.xq @@ -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( { } ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string1.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string1.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string1.xq index e13037f..81ee6c4 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string1.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string1.xq @@ -15,7 +15,7 @@ specific language governing permissions and limitations under the License. :) -(: JSONiq fn:data :) +(: JSONiq fn:string :) ( fn:string(null) ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string2.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string2.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string2.xq index 284ad5f..3f426bd 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string2.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string2.xq @@ -15,7 +15,7 @@ specific language governing permissions and limitations under the License. :) -(: JSONiq fn:data :) +(: JSONiq fn:string :) ( fn:string({"foo" : 3}) ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string3.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string3.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string3.xq index a38c60a..c678e3b 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string3.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string3.xq @@ -15,7 +15,7 @@ specific language governing permissions and limitations under the License. :) -(: JSONiq fn:data :) +(: JSONiq fn:string :) ( fn:string([1]) ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string4.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string4.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string4.xq new file mode 100644 index 0000000..5197222 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string4.xq @@ -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 } ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string5.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string5.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string5.xq new file mode 100644 index 0000000..4818775 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Functions/fn_string5.xq @@ -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( { } ) http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q06_object.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q06_object.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q06_object.xq index 699c3c0..ee1e1de 100644 --- a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q06_object.xq +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q06_object.xq @@ -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"] } http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q19_object.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q19_object.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q19_object.xq new file mode 100644 index 0000000..0f718cd --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q19_object.xq @@ -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" ?: () +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/xml_in_json/xml_in_json.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/xml_in_json/xml_in_json.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/xml_in_json/xml_in_json.xq new file mode 100644 index 0000000..17ee4f3 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/xml_in_json/xml_in_json.xq @@ -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> http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml index ddb0772..3fc9a72 100644 --- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml +++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml @@ -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"> @@ -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> http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml b/vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml index 0713ce2..cb7c260 100644 --- a/vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml +++ b/vxquery-xtest/src/test/resources/cat/FunctionsInJSONiq.xml @@ -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"/> @@ -57,6 +67,16 @@ <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"/> <output-file compare="Text">cast.txt</output-file> http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/cat/JsonArrayNavigationQueries.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/JsonArrayNavigationQueries.xml b/vxquery-xtest/src/test/resources/cat/JsonArrayNavigationQueries.xml index 44e1f64..73c3ead 100644 --- a/vxquery-xtest/src/test/resources/cat/JsonArrayNavigationQueries.xml +++ b/vxquery-xtest/src/test/resources/cat/JsonArrayNavigationQueries.xml @@ -55,4 +55,9 @@ <query name="q07_array_navigation" date="2016-08-05"/> <output-file compare="Text">q07_array_navigation.txt</output-file> </test-case> + <test-case name="json-array-navigation-q08" FilePath="Json/Array/Navigation" Creator="Riyafa Abdul Hameed"> + <description>Navigate through an array</description> + <query name="q08_array_navigation" date="2016-08-21"/> + <output-file compare="Text">q08_array_navigation.txt</output-file> + </test-case> </test-group> http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml b/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml index cfa18af..29231d1 100644 --- a/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml +++ b/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml @@ -40,4 +40,14 @@ <query name="q04_array" date="2016-06-09"/> <output-file compare="Text">q04_array.txt</output-file> </test-case> + <test-case name="json-array-q05" FilePath="Json/Array/" Creator="Riyafa Abdul Hameed"> + <description>Array with strings.</description> + <query name="q05_array" date="2016-08-21"/> + <output-file compare="Text">q05_array.txt</output-file> + </test-case> + <test-case name="json-array-q06" FilePath="Json/Array/" Creator="Riyafa Abdul Hameed"> + <description>Array with XQuery expressions.</description> + <query name="q06_array" date="2016-08-21"/> + <output-file compare="Text">q06_array.txt</output-file> + </test-case> </test-group> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml index 52272fb..8416289 100644 --- a/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml +++ b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml @@ -110,4 +110,9 @@ <query name="q18_object" date="2016-07-17"/> <output-file compare="Text">q18_object.txt</output-file> </test-case> + <test-case name="json-object-q19" FilePath="Json/Object/" Creator="Riyafa Abdul Hameed"> + <description>Object.</description> + <query name="q19_object" date="2016-08-21"/> + <output-file compare="Text">q19_object.txt</output-file> + </test-case> </test-group> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/vxquery/blob/6bee358b/vxquery-xtest/src/test/resources/cat/XMLInJSONQueries.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/XMLInJSONQueries.xml b/vxquery-xtest/src/test/resources/cat/XMLInJSONQueries.xml new file mode 100644 index 0000000..70a2cd0 --- /dev/null +++ b/vxquery-xtest/src/test/resources/cat/XMLInJSONQueries.xml @@ -0,0 +1,26 @@ +<!-- + 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. +--> + +<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="XMLInJSONQueries" featureOwner="VXQuery"> + <GroupInfo> + <title>XML in JSON</title> + <description/> + </GroupInfo> + <test-case name="xml_in_json" FilePath="Json/xml_in_json/" Creator="Riyafa Abdul Hameed"> + <description>XML in JSON.</description> + <query name="xml_in_json" date="2016-08-21"/> + <output-file compare="Text">xml_in_json.txt</output-file> + </test-case> +</test-group>
