Repository: vxquery Updated Branches: refs/heads/master 0361e4f20 -> d553a8c30
Implementation of Array Libraries and Testing Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/d553a8c3 Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/d553a8c3 Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/d553a8c3 Branch: refs/heads/master Commit: d553a8c30a37babde8fc8ef10ee2b8429cfaddd5 Parents: 0361e4f Author: Christina Pavlopoulou <[email protected]> Authored: Mon Jul 18 18:59:59 2016 -0700 Committer: Christina Pavlopoulou <[email protected]> Committed: Tue Jul 26 11:08:45 2016 -0700 ---------------------------------------------------------------------- .../vxquery/functions/builtin-functions.xml | 14 + ...nDescendantArraysScalarEvaluatorFactory.java | 139 +++++ .../LibjnFlattenScalarEvaluatorFactory.java | 107 ++++ .../Json/Libraries/descendant_arrays.txt | 3 + .../Json/Libraries/descendant_arrays2.txt | 4 + .../Json/Libraries/flatten.txt | 9 + .../XQuery/Json/Libraries/descendant_arrays.xq | 24 + .../XQuery/Json/Libraries/descendant_arrays2.xq | 24 + .../Queries/XQuery/Json/Libraries/flatten.xq | 29 ++ .../src/test/resources/VXQueryCatalog.xml | 501 +++++++++---------- .../test/resources/cat/LibrariesInJSONiq.xml | 38 ++ 11 files changed, 638 insertions(+), 254 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml index 27f0768..8f777a5 100644 --- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml +++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml @@ -1191,4 +1191,18 @@ <return type="js:null"/> <runtime type="scalar" class="org.apache.vxquery.runtime.functions.json.JnNullScalarEvaluatorFactory"/> </function> + + <!-- libjn:descendant-arrays($sequence as item()*) as array()* --> + <function name="libjn:descendant-arrays"> + <param name="sequence" type="item()*"/> + <return type="json-item()*"/> + <runtime type="scalar" class="org.apache.vxquery.runtime.functions.json.LibjnDescendantArraysScalarEvaluatorFactory"/> + </function> + + <!-- libjn:flatten($sequence as item()*) as item()* --> + <function name="libjn:flatten"> + <param name="sequence" type="item()*"/> + <return type="item()*"/> + <runtime type="scalar" class="org.apache.vxquery.runtime.functions.json.LibjnFlattenScalarEvaluatorFactory"/> + </function> </functions> http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantArraysScalarEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantArraysScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantArraysScalarEvaluatorFactory.java new file mode 100644 index 0000000..7896555 --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantArraysScalarEvaluatorFactory.java @@ -0,0 +1,139 @@ +/* + * 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. + */ +package org.apache.vxquery.runtime.functions.json; + +import java.io.IOException; + +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; +import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; +import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; +import org.apache.hyracks.api.context.IHyracksTaskContext; +import org.apache.hyracks.data.std.api.IPointable; +import org.apache.hyracks.data.std.primitive.UTF8StringPointable; +import org.apache.hyracks.data.std.util.ArrayBackedValueStorage; +import org.apache.vxquery.datamodel.accessors.SequencePointable; +import org.apache.vxquery.datamodel.accessors.TaggedValuePointable; +import org.apache.vxquery.datamodel.accessors.jsonitem.ArrayPointable; +import org.apache.vxquery.datamodel.accessors.jsonitem.ObjectPointable; +import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder; +import org.apache.vxquery.datamodel.values.ValueTag; +import org.apache.vxquery.datamodel.values.XDMConstants; +import org.apache.vxquery.exceptions.ErrorCode; +import org.apache.vxquery.exceptions.SystemException; +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator; +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory; + +public class LibjnDescendantArraysScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory { + + private static final long serialVersionUID = 1L; + + public LibjnDescendantArraysScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) { + super(args); + } + + @Override + protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) + throws AlgebricksException { + final SequencePointable sp = (SequencePointable) SequencePointable.FACTORY.createPointable(); + final ArrayPointable ap = (ArrayPointable) ArrayPointable.FACTORY.createPointable(); + final ObjectPointable op = (ObjectPointable) ObjectPointable.FACTORY.createPointable(); + final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); + final SequenceBuilder sb = new SequenceBuilder(); + final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); + + return new AbstractTaggedValueArgumentScalarEvaluator(args) { + + @Override + protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { + abvs.reset(); + sb.reset(abvs); + TaggedValuePointable tvp = args[0]; + if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { + TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); + tvp.getValue(sp); + int size = sp.getEntryCount(); + for (int i = 0; i < size; i++) { + sp.getEntry(i, tempTvp); + if (tempTvp.getTag() == ValueTag.ARRAY_TAG) { + nested(tempTvp, ap); + } + if (tempTvp.getTag() == ValueTag.OBJECT_TAG) { + insideObject(tempTvp); + } + } + ppool.giveBack(tempTvp); + } else if (tvp.getTag() == ValueTag.ARRAY_TAG) { + nested(tvp, ap); + } else if (tvp.getTag() == ValueTag.OBJECT_TAG) { + insideObject(tvp); + } else { + XDMConstants.setEmptySequence(tvp); + } + try { + sb.finish(); + result.set(abvs); + } catch (IOException e) { + throw new SystemException(ErrorCode.SYSE0001, e); + } + } + + public void nested(TaggedValuePointable tvp, ArrayPointable ap) throws SystemException { + TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); + ArrayPointable tempAp = ppool.takeOne(ArrayPointable.class); + appendSequence(tvp, ap); + int size = ap.getEntryCount(); + for (int i = 0; i < size; i++) { + + ap.getEntry(i, tempTvp); + if (tempTvp.getTag() == ValueTag.ARRAY_TAG) { + nested(tempTvp, tempAp); + } + } + ppool.giveBack(tempTvp); + ppool.giveBack(tempAp); + } + + public void appendSequence(TaggedValuePointable tvp, ArrayPointable ap) throws SystemException { + tvp.getValue(ap); + try { + sb.addItem(tvp); + } catch (IOException e) { + throw new SystemException(ErrorCode.SYSE0001, e); + } + } + + public void insideObject(TaggedValuePointable tvp) throws SystemException { + tvp.getValue(op); + TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); + try { + op.getKeys(tvp); + tvp.getValue(stringp); + op.getValue(stringp, tempTvp); + } catch (IOException e1) { + throw new SystemException(ErrorCode.SYSE0001, e1); + } + if (tempTvp.getTag() == ValueTag.OBJECT_TAG) { + insideObject(tempTvp); + } else { + nested(tempTvp, ap); + } + ppool.giveBack(tempTvp); + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnFlattenScalarEvaluatorFactory.java ---------------------------------------------------------------------- diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnFlattenScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnFlattenScalarEvaluatorFactory.java new file mode 100644 index 0000000..2e3e901 --- /dev/null +++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnFlattenScalarEvaluatorFactory.java @@ -0,0 +1,107 @@ +/* + * 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. + */ +package org.apache.vxquery.runtime.functions.json; + +import java.io.IOException; + +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; +import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; +import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; +import org.apache.hyracks.api.context.IHyracksTaskContext; +import org.apache.hyracks.data.std.api.IPointable; +import org.apache.hyracks.data.std.util.ArrayBackedValueStorage; +import org.apache.vxquery.datamodel.accessors.SequencePointable; +import org.apache.vxquery.datamodel.accessors.TaggedValuePointable; +import org.apache.vxquery.datamodel.accessors.jsonitem.ArrayPointable; +import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder; +import org.apache.vxquery.datamodel.values.ValueTag; +import org.apache.vxquery.exceptions.ErrorCode; +import org.apache.vxquery.exceptions.SystemException; +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator; +import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory; + +public class LibjnFlattenScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory { + + private static final long serialVersionUID = 1L; + + public LibjnFlattenScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) { + super(args); + } + + @Override + protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) + throws AlgebricksException { + final SequencePointable sp = (SequencePointable) SequencePointable.FACTORY.createPointable(); + final SequenceBuilder sb = new SequenceBuilder(); + final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); + + return new AbstractTaggedValueArgumentScalarEvaluator(args) { + + @Override + protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { + abvs.reset(); + sb.reset(abvs); + TaggedValuePointable tvp = args[0]; + if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { + TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); + tvp.getValue(sp); + int size = sp.getEntryCount(); + for (int i = 0; i < size; i++) { + sp.getEntry(i, tempTvp); + flatten(tempTvp); + } + ppool.giveBack(tempTvp); + } else { + flatten(tvp); + } + try { + sb.finish(); + result.set(abvs); + } catch (IOException e) { + throw new SystemException(ErrorCode.SYSE0001, e); + } + } + + public void loopInsideArray(TaggedValuePointable tvp) throws SystemException { + TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); + ArrayPointable ap = ppool.takeOne(ArrayPointable.class); + tvp.getValue(ap); + int size = ap.getEntryCount(); + for (int i = 0; i < size; i++) { + ap.getEntry(i, tempTvp); + flatten(tempTvp); + } + ppool.giveBack(tempTvp); + ppool.giveBack(ap); + } + + public void flatten(TaggedValuePointable tvp) throws SystemException { + if (tvp.getTag() == ValueTag.ARRAY_TAG) { + loopInsideArray(tvp); + } else { + try { + sb.addItem(tvp); + } catch (IOException e) { + throw new SystemException(ErrorCode.SYSE0001, e); + } + } + } + + }; + } + +} http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays.txt new file mode 100644 index 0000000..4ce97f8 --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays.txt @@ -0,0 +1,3 @@ +[1,2] +[[{"foo":"bar","bar":"foo"}]] +[{"foo":"bar","bar":"foo"}] http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays2.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays2.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays2.txt new file mode 100644 index 0000000..69ce1ea --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/descendant_arrays2.txt @@ -0,0 +1,4 @@ +[1,2] +[[{"foo":"bar","bar":"foo"}],[1,2]] +[{"foo":"bar","bar":"foo"}] +[1,2] http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/flatten.txt ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/flatten.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/flatten.txt new file mode 100644 index 0000000..1674b85 --- /dev/null +++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Libraries/flatten.txt @@ -0,0 +1,9 @@ +{"foo":{"bar":[1,2]}} +1 +2 +{"foo":"bar","bar":"foo"} +3 +4 +true +1 +null http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays.xq new file mode 100644 index 0000000..3f48494 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays.xq @@ -0,0 +1,24 @@ +(: 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 libjn:descendant_arrays :) +( + libjn:descendant-arrays(({ "foo" : { "bar" : [ 1, 2 ] } }, + [ [ { "foo" : "bar", "bar" : "foo" } ] ],true(), + 1, + jn:null())) +) http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays2.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays2.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays2.xq new file mode 100644 index 0000000..17aedfc --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/descendant_arrays2.xq @@ -0,0 +1,24 @@ +(: 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 libjn:descendant_arrays :) +( + libjn:descendant-arrays(({ "foo" : { "bar" : [ 1, 2 ] } }, + [ [ { "foo" : "bar", "bar" : "foo" } ],[1,2] ],true(), + 1, + jn:null())) +) http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/flatten.xq ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/flatten.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/flatten.xq new file mode 100644 index 0000000..98106c6 --- /dev/null +++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Libraries/flatten.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. :) + +(: JSONiq libjn:flatten :) +( + libjn:flatten( + ( + { "foo" : { "bar" : [ 1, 2 ] } }, + [ 1, 2, [ { "foo" : "bar", "bar" : "foo" } ], 3, 4 ], + true(), + 1, + jn:null() + ) +) +) http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/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 0ac46f4..e8a3a43 100644 --- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml +++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml @@ -50,297 +50,290 @@ <!ENTITY JsonObjectNavigationQueries SYSTEM "cat/JsonObjectNavigationQueries.xml"> <!ENTITY JsonArrayNavigationQueries SYSTEM "cat/JsonArrayNavigationQueries.xml"> <!ENTITY JsonParserQueries SYSTEM "cat/JsonParserQueries.xml"> +<!ENTITY LibrariesInJSONiq SYSTEM "cat/LibrariesInJSONiq.xml"> <!ENTITY TraceQuery SYSTEM "cat/TraceQuery.xml"> ]> -<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - CatalogDesignDate="2014-04-01" - version="0.0.1" - SourceOffsetPath="./" - ResultOffsetPath="ExpectedTestResults/" - XQueryQueryOffsetPath="Queries/XQuery/" - XQueryXQueryOffsetPath="Queries/XQueryX/" - XQueryFileExtension=".xq" - XQueryXFileExtension=".xqx" - xsi:schemaLocation="http://www.w3.org/2005/02/query-test-XQTSCatalog XQTSCatalog.xsd"> - <test-suite-info> - <title>VXQuery Test Suite</title> - <description> - Test Suite for VXQuery. - </description> - </test-suite-info> - <sources> - <source ID="VXQueryCatalog" FileName="VXQueryCatalog.xml" Creator="VXQuery team"> - <description last-mod="2014-04-02">VXQuery Test Suite Catalog</description> - </source> - <source ID="ghcnd" FileName="TestSources/ghcnd" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_half_1" FileName="TestSources/ghcnd/half_1" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_half_2" FileName="TestSources/ghcnd/half_2" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_quarter_1" FileName="TestSources/ghcnd/half_1/quarter_1" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_quarter_2" FileName="TestSources/ghcnd/half_1/quarter_2" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_quarter_3" FileName="TestSources/ghcnd/half_2/quarter_3" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="ghcnd_quarter_4" FileName="TestSources/ghcnd/half_2/quarter_4" Creator="Preston Carman"> - <description last-mod="2014-04-02">Collection of files</description> - </source> - <source ID="jsonCollection" FileName="TestSources/jsonCollection" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_half_1" FileName="TestSources/jsonCollection/half_1" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_half_2" FileName="TestSources/jsonCollection/half_2" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_quarter_1" FileName="TestSources/jsonCollection/half_1/quarter_1" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_quarter_2" FileName="TestSources/jsonCollection/half_1/quarter_2" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_quarter_3" FileName="TestSources/jsonCollection/half_2/quarter_3" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="json_quarter_4" FileName="TestSources/jsonCollection/half_2/quarter_4" Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-12">Collection of files</description> - </source> - <source ID="station_xml_file" FileName="TestSources/ghcnd/half_1/quarter_1/stations/US000000001.xml" - Creator="Shivani Mall"> - <description last-mod="2015-06-26">File</description> - </source> - <source ID="array_json_file" FileName="TestSources/json/array/array.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="int_json_file" FileName="TestSources/json/atomic_int.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="double_json_file" FileName="TestSources/json/atomic_double.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="string_json_file" FileName="TestSources/json/atomic_string.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="nested_arrays_json_file" FileName="TestSources/json/array/nested_array.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="object_json_file" FileName="TestSources/json/object/object.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="nested_object_json_file" FileName="TestSources/json/object/nested_object.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="nested_object_array_json_file" FileName="TestSources/json/object/nested_object_array.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-02">File</description> - </source> - <source ID="nested_array_object_json_file" FileName="TestSources/json/array/nested_array_object.json" - Creator="Christina Pavlopoulou"> - <description last-mod="2016-07-05">File</description> - </source> - </sources> - <test-group name="SingleQuery" featureOwner="Preston Carman"> - <GroupInfo> - <title>Single Query</title> - <description/> - </GroupInfo> - <test-group name="SingleTestAdd" featureOwner="Preston Carman"> - <GroupInfo> - <title>Single Test Add</title> +<test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" CatalogDesignDate="2014-04-01" version="0.0.1" SourceOffsetPath="./" ResultOffsetPath="ExpectedTestResults/" XQueryQueryOffsetPath="Queries/XQuery/" XQueryXQueryOffsetPath="Queries/XQueryX/" XQueryFileExtension=".xq" XQueryXFileExtension=".xqx" xsi:schemaLocation="http://www.w3.org/2005/02/query-test-XQTSCatalog XQTSCatalog.xsd"> + <test-suite-info> + <title>VXQuery Test Suite</title> + <description> + Test Suite for VXQuery. + </description> + </test-suite-info> + <sources> + <source ID="VXQueryCatalog" FileName="VXQueryCatalog.xml" Creator="VXQuery team"> + <description last-mod="2014-04-02">VXQuery Test Suite Catalog</description> + </source> + <source ID="ghcnd" FileName="TestSources/ghcnd" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_half_1" FileName="TestSources/ghcnd/half_1" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_half_2" FileName="TestSources/ghcnd/half_2" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_quarter_1" FileName="TestSources/ghcnd/half_1/quarter_1" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_quarter_2" FileName="TestSources/ghcnd/half_1/quarter_2" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_quarter_3" FileName="TestSources/ghcnd/half_2/quarter_3" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="ghcnd_quarter_4" FileName="TestSources/ghcnd/half_2/quarter_4" Creator="Preston Carman"> + <description last-mod="2014-04-02">Collection of files</description> + </source> + <source ID="jsonCollection" FileName="TestSources/jsonCollection" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_half_1" FileName="TestSources/jsonCollection/half_1" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_half_2" FileName="TestSources/jsonCollection/half_2" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_quarter_1" FileName="TestSources/jsonCollection/half_1/quarter_1" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_quarter_2" FileName="TestSources/jsonCollection/half_1/quarter_2" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_quarter_3" FileName="TestSources/jsonCollection/half_2/quarter_3" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="json_quarter_4" FileName="TestSources/jsonCollection/half_2/quarter_4" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-12">Collection of files</description> + </source> + <source ID="station_xml_file" FileName="TestSources/ghcnd/half_1/quarter_1/stations/US000000001.xml" Creator="Shivani Mall"> + <description last-mod="2015-06-26">File</description> + </source> + <source ID="array_json_file" FileName="TestSources/json/array/array.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="int_json_file" FileName="TestSources/json/atomic_int.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="double_json_file" FileName="TestSources/json/atomic_double.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="string_json_file" FileName="TestSources/json/atomic_string.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="nested_arrays_json_file" FileName="TestSources/json/array/nested_array.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="object_json_file" FileName="TestSources/json/object/object.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="nested_object_json_file" FileName="TestSources/json/object/nested_object.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="nested_object_array_json_file" FileName="TestSources/json/object/nested_object_array.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-02">File</description> + </source> + <source ID="nested_array_object_json_file" FileName="TestSources/json/array/nested_array_object.json" Creator="Christina Pavlopoulou"> + <description last-mod="2016-07-05">File</description> + </source> + </sources> + <test-group name="SingleQuery" featureOwner="Preston Carman"> + <GroupInfo> + <title>Single Query</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="SingleTestAdd" featureOwner="Preston Carman"> + <GroupInfo> + <title>Single Test Add</title> + <description/> + </GroupInfo> &SingleQuery; - </test-group> - <test-group name="SingleTestList" featureOwner="Preston Carman"> - <GroupInfo> - <title>Single Test List</title> - <description/> - </GroupInfo> + </test-group> + <test-group name="SingleTestList" featureOwner="Preston Carman"> + <GroupInfo> + <title>Single Test List</title> + <description/> + </GroupInfo> &SingleAlternateQuery; - </test-group> - </test-group> - <test-group name="AggregatePartitionQueries" featureOwner="Preston Carman"> - <GroupInfo> - <title>Aggregate Partition Queries</title> - <description/> - </GroupInfo> - <test-group name="AggregateParallelExecutionTests" featureOwner="Preston Carman"> - <GroupInfo> - <title>Aggregate Parallel Execution Tests</title> + </test-group> + </test-group> + <test-group name="AggregatePartitionQueries" featureOwner="Preston Carman"> + <GroupInfo> + <title>Aggregate Partition Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="AggregateParallelExecutionTests" featureOwner="Preston Carman"> + <GroupInfo> + <title>Aggregate Parallel Execution Tests</title> + <description/> + </GroupInfo> &AggregatePartition1Queries; &AggregatePartition2Queries; &AggregatePartition4Queries; - </test-group> - </test-group> - <test-group name="FunctionsAndOperatorsOnNumericsQueries" featureOwner="Preston Carman"> - <GroupInfo> - <title>Functions And Operators On Numerics Queries</title> - <description/> - </GroupInfo> - <test-group name="FunctionsAndOperatorsOnNumericsExecutionTests" featureOwner="Preston Carman"> - <GroupInfo> - <title>Functions And Operators On Numerics Execution Tests</title> + </test-group> + </test-group> + <test-group name="FunctionsAndOperatorsOnNumericsQueries" featureOwner="Preston Carman"> + <GroupInfo> + <title>Functions And Operators On Numerics Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="FunctionsAndOperatorsOnNumericsExecutionTests" featureOwner="Preston Carman"> + <GroupInfo> + <title>Functions And Operators On Numerics Execution Tests</title> + <description/> + </GroupInfo> &FunctionsAndOperatorsOnNumericsQueries; - </test-group> - </test-group> - <test-group name="FunctionsAndOperatorsThatGenerateSequencesQueries" featureOwner="Shivani Mall"> - <GroupInfo> - <title>Functions And Operators That Generate Sequences Queries</title> - <description/> - </GroupInfo> - <test-group name="FunctionsAndOperatorsThatGenerateSequencesTests" featureOwner="Shivani Mall"> - <GroupInfo> - <title>Functions And Operators That Generate Sequences Execution Tests</title> + </test-group> + </test-group> + <test-group name="FunctionsAndOperatorsThatGenerateSequencesQueries" featureOwner="Shivani Mall"> + <GroupInfo> + <title>Functions And Operators That Generate Sequences Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="FunctionsAndOperatorsThatGenerateSequencesTests" featureOwner="Shivani Mall"> + <GroupInfo> + <title>Functions And Operators That Generate Sequences Execution Tests</title> + <description/> + </GroupInfo> &FunctionsAndOperatorsThatGenerateSequences; - </test-group> - </test-group> - <test-group name="GhcndPartitionQueries" featureOwner="Preston Carman"> - <GroupInfo> - <title>GHCND Partition Queries</title> - <description/> - </GroupInfo> - <test-group name="ParallelExecutionTests" featureOwner="Preston Carman"> - <GroupInfo> - <title>Parallel Execution Tests</title> + </test-group> + </test-group> + <test-group name="GhcndPartitionQueries" featureOwner="Preston Carman"> + <GroupInfo> + <title>GHCND Partition Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="ParallelExecutionTests" featureOwner="Preston Carman"> + <GroupInfo> + <title>Parallel Execution Tests</title> + <description/> + </GroupInfo> &GhcndPartition1Queries; &GhcndPartition2Queries; &GhcndPartition4Queries; - </test-group> - </test-group> - <test-group name="GhcndCountPartitionQueries" featureOwner="Preston Carman"> - <GroupInfo> - <title>GHCND Count Partition Queries</title> - <description/> - </GroupInfo> - <test-group name="CountParallelExecutionTests" featureOwner="Preston Carman"> - <GroupInfo> - <title>Parallel Execution Tests</title> + </test-group> + </test-group> + <test-group name="GhcndCountPartitionQueries" featureOwner="Preston Carman"> + <GroupInfo> + <title>GHCND Count Partition Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="CountParallelExecutionTests" featureOwner="Preston Carman"> + <GroupInfo> + <title>Parallel Execution Tests</title> + <description/> + </GroupInfo> &GhcndCountPartition1Queries; &GhcndCountPartition2Queries; &GhcndCountPartition4Queries; - </test-group> - </test-group> - <test-group name="GhcndRecordsPartitionQueries" featureOwner="Preston Carman"> - <GroupInfo> - <title>GHCND Records Partition Queries</title> - <description/> - </GroupInfo> - <test-group name="RecordsParallelExecutionTests" featureOwner="Preston Carman"> - <GroupInfo> - <title>Records Parallel Execution Tests</title> + </test-group> + </test-group> + <test-group name="GhcndRecordsPartitionQueries" featureOwner="Preston Carman"> + <GroupInfo> + <title>GHCND Records Partition Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="RecordsParallelExecutionTests" featureOwner="Preston Carman"> + <GroupInfo> + <title>Records Parallel Execution Tests</title> + <description/> + </GroupInfo> &GhcndRecordsPartition1Queries; &GhcndRecordsPartition2Queries; &GhcndRecordsPartition4Queries; - </test-group> - </test-group> - <test-group name="HDFSAggregateQueries" featureOwner="Efi Kaltirimidou"> - <GroupInfo> - <title>Aggregate Partition Queries in HDFS</title> - <description/> - </GroupInfo> - <test-group name="CollectionReadFromHDFSAggregateTests" featureOwner="Efi Kaltirimidou"> - <GroupInfo> - <title>Aggregate HDFS Execution Tests</title> + </test-group> + </test-group> + <test-group name="HDFSAggregateQueries" featureOwner="Efi Kaltirimidou"> + <GroupInfo> + <title>Aggregate Partition Queries in HDFS</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="CollectionReadFromHDFSAggregateTests" featureOwner="Efi Kaltirimidou"> + <GroupInfo> + <title>Aggregate HDFS Execution Tests</title> + <description/> + </GroupInfo> &HDFSAggregateQueries; - </test-group> - </test-group> - <test-group name="IndexingQueries" featureOwner="Steven Jacobs"> - <GroupInfo> - <title>Indexing Queries</title> - <description/> - </GroupInfo> - <test-group name="IndexingTests" featureOwner="Steven Jacobs"> - <GroupInfo> - <title>Indexing Execution Tests</title> + </test-group> + </test-group> + <test-group name="IndexingQueries" featureOwner="Steven Jacobs"> + <GroupInfo> + <title>Indexing Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="IndexingTests" featureOwner="Steven Jacobs"> + <GroupInfo> + <title>Indexing Execution Tests</title> + <description/> + </GroupInfo> &IndexingQueries; - </test-group> - </test-group> - <test-group name="JsoniqQueries" featureOwner="Christina Pavlopoulou"> - <GroupInfo> - <title>Jsoniq Queries</title> - <description/> - </GroupInfo> - <test-group name="JsoniqTesting" featureOwner="Christina Pavlopoulou"> - <GroupInfo> - <title>Json Constructor Tests</title> + </test-group> + </test-group> + <test-group name="JsoniqQueries" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Jsoniq Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="JsoniqTesting" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Json Constructor Tests</title> + <description/> + </GroupInfo> &JsonArrayQueries; &JsonObjectQueries; - </test-group> - </test-group> - <test-group name="FunctionsInJSONiq" featureOwner="Riyafa Abdul Hameed"> - <GroupInfo> - <title>Functions in JSONiq</title> - <description>The functions extended and newly created for JSONiq</description> - </GroupInfo> - <test-group name="FunctionsInJSONiqTesting" featureOwner="Riyafa Abdul Hameed"> - <GroupInfo> - <title>Tests for functions in JSONiq</title> - </GroupInfo> + </test-group> + </test-group> + <test-group name="FunctionsInJSONiq" featureOwner="Riyafa Abdul Hameed"> + <GroupInfo> + <title>Functions in JSONiq</title> + <description>The functions extended and newly created for JSONiq</description> + </GroupInfo> + <test-group name="FunctionsInJSONiqTesting" featureOwner="Riyafa Abdul Hameed"> + <GroupInfo> + <title>Tests for functions in JSONiq</title> + </GroupInfo> &FunctionsInJSONiq; - </test-group> - </test-group> - <test-group name="JsonNavigation" featureOwner="Riyafa Abdul Hameed"> - <GroupInfo> - <title>Json navigation queries</title> - <description>Json navigation tests</description> - </GroupInfo> - <test-group name="JsonNavigationTesting" featureOwner="Riyafa Abdul Hameed"> - <GroupInfo> - <title>Json navigation tests</title> - </GroupInfo> + </test-group> + </test-group> + <test-group name="JsonNavigation" featureOwner="Riyafa Abdul Hameed"> + <GroupInfo> + <title>Json navigation queries</title> + <description>Json navigation tests</description> + </GroupInfo> + <test-group name="JsonNavigationTesting" featureOwner="Riyafa Abdul Hameed"> + <GroupInfo> + <title>Json navigation tests</title> + </GroupInfo> &JsonObjectNavigationQueries; &JsonArrayNavigationQueries; &JsonParserQueries; - </test-group> - </test-group> - <test-group name="TraceQuery" featureOwner="Christina Pavlopoulou"> - <GroupInfo> - <title>Trace Function Queries</title> - <description/> - </GroupInfo> - <test-group name="TraceTesting" featureOwner="Christina Pavlopoulou"> - <GroupInfo> - <title>Trace Function Tests</title> + </test-group> + </test-group> + <test-group name="TraceQuery" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Trace Function Queries</title> <description/> - </GroupInfo> + </GroupInfo> + <test-group name="TraceTesting" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Trace Function Tests</title> + <description/> + </GroupInfo> &TraceQuery; - </test-group> - </test-group> -</test-suite> \ No newline at end of file + </test-group> + </test-group> + <test-group name="LibrariesInJSONiq" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Libraries in JSONiq</title> + <description>Libraries created for JSONiq</description> + </GroupInfo> + <test-group name="LibrariesInJSONiqTesting" featureOwner="Christina Pavlopoulou"> + <GroupInfo> + <title>Tests for libraries in JSONiq</title> + </GroupInfo> + &LibrariesInJSONiq; + </test-group> + </test-group> +</test-suite> http://git-wip-us.apache.org/repos/asf/vxquery/blob/d553a8c3/vxquery-xtest/src/test/resources/cat/LibrariesInJSONiq.xml ---------------------------------------------------------------------- diff --git a/vxquery-xtest/src/test/resources/cat/LibrariesInJSONiq.xml b/vxquery-xtest/src/test/resources/cat/LibrariesInJSONiq.xml new file mode 100644 index 0000000..4c18447 --- /dev/null +++ b/vxquery-xtest/src/test/resources/cat/LibrariesInJSONiq.xml @@ -0,0 +1,38 @@ +<!-- + 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="JsonArrayQueries" featureOwner="VXQuery"> + <GroupInfo> + <title>Json Libraries</title> + <description/> + </GroupInfo> + <test-case name="descendant-arrays" FilePath="Json/Libraries/" Creator="Christina Pavlopoulou"> + <description>Json Libraries.</description> + <query name="descendant_arrays" date="2016-07-18"/> + <output-file compare="Text">descendant_arrays.txt</output-file> + </test-case> + <test-case name="descendant-arrays2" FilePath="Json/Libraries/" Creator="Christina Pavlopoulou"> + <description>Json Libraries.</description> + <query name="descendant_arrays2" date="2016-07-19"/> + <output-file compare="Text">descendant_arrays2.txt</output-file> + </test-case> + <test-case name="flatten" FilePath="Json/Libraries/" Creator="Christina Pavlopoulou"> + <description>Json Libraries.</description> + <query name="flatten" date="2016-07-20"/> + <output-file compare="Text">flatten.txt</output-file> + </test-case> +</test-group>
