You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2016/06/10 03:32:57 UTC

[01/19] vxquery git commit: Still working on JsonParser

Repository: vxquery
Updated Branches:
  refs/heads/master dac53abcf -> 80efee30c


Still working on JsonParser


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/2410db88
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/2410db88
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/2410db88

Branch: refs/heads/master
Commit: 2410db882eae4d281f375bab0d3b87a6f2813709
Parents: ed79cb0
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Wed May 25 14:20:20 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Wed May 25 14:20:20 2016 -0700

----------------------------------------------------------------------
 .../org/apache/vxquery/xmlquery/ast/ASTTag.java | 92 +++++++++++++++++++-
 .../xmlquery/ast/ArrayConstructorNode.java      | 27 ++++++
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 42 +++++++++
 3 files changed, 160 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/2410db88/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ASTTag.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ASTTag.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ASTTag.java
index 65acb21..cd3f223 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ASTTag.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ASTTag.java
@@ -17,6 +17,96 @@
 package org.apache.vxquery.xmlquery.ast;
 
 public enum ASTTag {
-    VERSION_DECL, PROLOG, LIBRARY_MODULE, MODULE_DECLARATION, MAIN_MODULE, QUERY_BODY, BOUNDARY_SPACE_DECLARATION, DEFAULT_ELEMENT_NAMESPACE_DECLARATION, DEFAULT_FUNCTION_NAMESPACE_DECLARATION, OPTION_DECLARATION, FT_OPTION_DECLARATION, ORDERING_MODE_DECLARATION, EMPTY_ORDER_DECLARATION, COPY_NAMESPACES_DECLARATION, DEFAULT_COLLATION_DECLARATION, BASE_URI_DECLARATION, SCHEMA_IMPORT, MODULE_IMPORT, VARIABLE_DECLARATION, TYPE_DECLARATION, SEQUENCE_TYPE, ITEM_TYPE, ATOMIC_TYPE, ANY_NODE_TEST, ITEM_TEST, DOCUMENT_TEST, QNAME, ELEMENT_TEST, SCHEMA_ELEMENT_TEST, ATTRIBUTE_TEST, SCHEMA_ATTRIBUTE_TEST, TEXT_TEST, COMMENT_TEST, PI_TEST, TYPE_NAME, CONSTRUCTION_DECLARATION, FUNCTION_DECLARATION, FUNCTION_PARAMETER, ENCLOSED_EXPRESSION, EXPRESSION, FLWOR_EXPRESSION, FOR_CLAUSE, FOR_VARIABLE_DECLARATION, LET_VARIABLE_DECLARATION, LET_CLAUSE, WHERE_CLAUSE, ORDERBY_CLAUSE, ORDER_SPECIFICATION, QUANTIFIED_EXPRESSION, QUANTIFIED_VARIABLE_DECLARATION, TYPESWITCH_EXPRESSION, CASE_CLAUSE, IF_EXPRESSIO
 N, INFIX_EXPRESSION, TYPE_EXPRESSION, UNARY_EXPRESSION, VALIDATE_EXPRESSION, EXTENSION_EXPRESSION, PRAGMA_NODE, PATH_EXPRESSION, AXIS_STEP, NAME_TEST, FILTER_EXPRESSION, LITERAL, VARIABLE_REFERENCE, PARENTHESIZED_EXPRESSION, CONTEXT_ITEM, ORDERED_EXPRESSION, UNORDERED_EXPRESSION, FUNCTION_EXPRESSION, DIRECT_ELEMENT_CONSTRUCTOR, DIRECT_ATTRIBUTE_CONSTRUCTOR, DQUOTED_ATTRIBUTE_CONTENT, SQUOTED_ATTRIBUTE_CONTENT, TEXTUAL_NODE_CONTENT, CDATA_SECTION, DIRECT_COMMENT_CONSTRUCTOR, DIRECT_PI_CONSTRUCTOR, COMPUTED_DOCUMENT_CONSTRUCTOR, COMPUTED_ATTRIBUTE_CONSTRUCTOR, COMPUTED_ELEMENT_CONSTRUCTOR, COMPUTED_TEXT_CONSTRUCTOR, COMPUTED_COMMENT_CONSTRUCTOR, EMPTY_SEQUENCE_TYPE, RELATIVE_PATH_EXPRESSION, COMPUTED_PI_CONSTRUCTOR, NCNAME, CONTENT_CHARS, NAMESPACE_DECLARATION, SINGLE_TYPE
+    VERSION_DECL,
+    PROLOG,
+    LIBRARY_MODULE,
+    MODULE_DECLARATION,
+    MAIN_MODULE,
+    QUERY_BODY,
+    BOUNDARY_SPACE_DECLARATION,
+    DEFAULT_ELEMENT_NAMESPACE_DECLARATION,
+    DEFAULT_FUNCTION_NAMESPACE_DECLARATION,
+    OPTION_DECLARATION,
+    FT_OPTION_DECLARATION,
+    ORDERING_MODE_DECLARATION,
+    EMPTY_ORDER_DECLARATION,
+    COPY_NAMESPACES_DECLARATION,
+    DEFAULT_COLLATION_DECLARATION,
+    BASE_URI_DECLARATION,
+    SCHEMA_IMPORT,
+    MODULE_IMPORT,
+    VARIABLE_DECLARATION,
+    TYPE_DECLARATION,
+    SEQUENCE_TYPE,
+    ITEM_TYPE,
+    ATOMIC_TYPE,
+    ANY_NODE_TEST,
+    ITEM_TEST,
+    DOCUMENT_TEST,
+    QNAME,
+    ELEMENT_TEST,
+    SCHEMA_ELEMENT_TEST,
+    ATTRIBUTE_TEST,
+    SCHEMA_ATTRIBUTE_TEST,
+    TEXT_TEST,
+    COMMENT_TEST,
+    PI_TEST,
+    TYPE_NAME,
+    CONSTRUCTION_DECLARATION,
+    FUNCTION_DECLARATION,
+    FUNCTION_PARAMETER,
+    ENCLOSED_EXPRESSION,
+    EXPRESSION,
+    FLWOR_EXPRESSION,
+    FOR_CLAUSE,
+    FOR_VARIABLE_DECLARATION,
+    LET_VARIABLE_DECLARATION,
+    LET_CLAUSE,
+    WHERE_CLAUSE,
+    ORDERBY_CLAUSE,
+    ORDER_SPECIFICATION,
+    QUANTIFIED_EXPRESSION,
+    QUANTIFIED_VARIABLE_DECLARATION,
+    TYPESWITCH_EXPRESSION,
+    CASE_CLAUSE,
+    IF_EXPRESSION,
+    INFIX_EXPRESSION,
+    TYPE_EXPRESSION,
+    UNARY_EXPRESSION,
+    VALIDATE_EXPRESSION,
+    EXTENSION_EXPRESSION,
+    PRAGMA_NODE,
+    PATH_EXPRESSION,
+    AXIS_STEP,
+    NAME_TEST,
+    FILTER_EXPRESSION,
+    LITERAL,
+    VARIABLE_REFERENCE,
+    PARENTHESIZED_EXPRESSION,
+    CONTEXT_ITEM,
+    ORDERED_EXPRESSION,
+    UNORDERED_EXPRESSION,
+    FUNCTION_EXPRESSION,
+    ARRAY_CONSTRUCTOR,
+    DIRECT_ELEMENT_CONSTRUCTOR,
+    DIRECT_ATTRIBUTE_CONSTRUCTOR,
+    DQUOTED_ATTRIBUTE_CONTENT,
+    SQUOTED_ATTRIBUTE_CONTENT,
+    TEXTUAL_NODE_CONTENT,
+    CDATA_SECTION,
+    DIRECT_COMMENT_CONSTRUCTOR,
+    DIRECT_PI_CONSTRUCTOR,
+    COMPUTED_DOCUMENT_CONSTRUCTOR,
+    COMPUTED_ATTRIBUTE_CONSTRUCTOR,
+    COMPUTED_ELEMENT_CONSTRUCTOR,
+    COMPUTED_TEXT_CONSTRUCTOR,
+    COMPUTED_COMMENT_CONSTRUCTOR,
+    EMPTY_SEQUENCE_TYPE,
+    RELATIVE_PATH_EXPRESSION,
+    COMPUTED_PI_CONSTRUCTOR,
+    NCNAME,
+    CONTENT_CHARS,
+    NAMESPACE_DECLARATION,
+    SINGLE_TYPE
 
 }

http://git-wip-us.apache.org/repos/asf/vxquery/blob/2410db88/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
new file mode 100644
index 0000000..235f2c9
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
@@ -0,0 +1,27 @@
+package org.apache.vxquery.xmlquery.ast;
+
+import java.util.List;
+
+import org.apache.vxquery.util.SourceLocation;
+
+public class ArrayConstructorNode extends ASTNode {
+    private List<ASTNode> items;
+
+    public ArrayConstructorNode(SourceLocation loc) {
+        super(loc);
+    }
+
+    @Override
+    public ASTTag getTag() {
+        return ASTTag.ARRAY_CONSTRUCTOR;
+    }
+
+    public List<ASTNode> getItems() {
+        return items;
+    }
+
+    public void setItems(List<ASTNode> items) {
+        this.items = items;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/2410db88/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 7c0491a..91c9904 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -1796,6 +1796,7 @@ ASTNode PrimaryExpr():
         | LOOKAHEAD(2) expr = OrderedExpr()
         | LOOKAHEAD(2) expr = UnorderedExpr()
         | expr = Constructor()
+        | expr = JsonConstructor()
     ) {
         return expr;
     }
@@ -1937,6 +1938,47 @@ ASTNode FunctionCall()  :
     }
 }
 
+ASTNode JsonConstructor()  :
+{
+    ASTNode result;
+}
+{
+    result = ArrayConstructor()
+    {
+		return result;
+	}
+}
+
+ASTNode ArrayConstructor()  :
+{
+	Token start, end;
+	List<ASTNode> items;
+}
+{
+	start="[" items=ArrayItemList() end="]" {
+		ArrayConstructorNode array = new ArrayConstructorNode(createSourceLocation(start));
+		array.setItems(items);
+		return array;
+	}
+}
+
+List<ASTNode> ArrayItemList()  :
+{
+	List<ASTNode> items = new ArrayList<ASTNode>();
+	ASTNode arraynode;
+}
+{[
+	arraynode = Literal() {
+        items.add(arraynode);
+    } (
+        "," arraynode = Literal() {
+            items.add(arraynode);
+        }
+    )* ]{
+        return items;
+    }
+}	
+
 ASTNode Constructor()  :
 {
     ASTNode result;


[11/19] vxquery git commit: Working on array runtime constructor

Posted by pr...@apache.org.
Working on array runtime constructor


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/1a4f192c
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/1a4f192c
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/1a4f192c

Branch: refs/heads/master
Commit: 1a4f192c4a2e649c80892ab00572c9e6622c49a7
Parents: 4744245
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Wed Jun 8 12:16:22 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Wed Jun 8 12:16:22 2016 -0700

----------------------------------------------------------------------
 .../functions/node/ArrayNodeConstructorScalarEvaluator.java    | 3 ---
 .../main/java/org/apache/vxquery/serializer/XMLSerializer.java | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/1a4f192c/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
index cadf2b9..924e2c0 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
@@ -21,9 +21,6 @@ import java.io.IOException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.api.IMutableValueStorage;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.builders.jsonitem.ArrayBuilder;

http://git-wip-us.apache.org/repos/asf/vxquery/blob/1a4f192c/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
index b980bd6..9e1b663 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
@@ -448,7 +448,6 @@ public class XMLSerializer implements IPrinter {
 
     private void printArrayNode(PrintStream ps, TaggedValuePointable tvp) {
         ArrayPointable ap = pp.takeOne(ArrayPointable.class);
-        SequencePointable seqp = pp.takeOne(SequencePointable.class);
 
         try {
             tvp.getValue(ap);
@@ -456,20 +455,21 @@ public class XMLSerializer implements IPrinter {
                 tvp.getValue(ap);
                 int len = ap.getEntryCount();
                 ps.append('[');
-
+                ps.append(' ');
                 for (int i = 0; i < len; i++) {
                     ap.getEntry(i, tvp);
                     print(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength(), ps);
                     if (i != len - 1) {
                         ps.append(',');
+                        ps.append(' ');
                     }
                 }
+                ps.append(' ');
                 ps.append(']');
             }
 
         } finally {
             pp.giveBack(ap);
-            pp.giveBack(seqp);
             pp.giveBack(tvp);
         }
     }


[10/19] vxquery git commit: Working on array runtime constructor

Posted by pr...@apache.org.
Working on array runtime constructor


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/47442458
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/47442458
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/47442458

Branch: refs/heads/master
Commit: 474424585135a0a45fc4c3bfee54a7a3bfa49d12
Parents: 426da4b
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Wed Jun 8 12:05:32 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Wed Jun 8 12:05:32 2016 -0700

----------------------------------------------------------------------
 .../accessors/PointablePoolFactory.java         |    2 +
 .../vxquery/functions/builtin-operators.xml     | 2165 +++++++++---------
 .../ArrayNodeConstructorScalarEvaluator.java    |   68 +
 ...ayNodeConstructorScalarEvaluatorFactory.java |   37 +
 .../vxquery/serializer/XMLSerializer.java       |   33 +
 .../xmlquery/translator/XMLQueryTranslator.java |   16 +
 6 files changed, 1301 insertions(+), 1020 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/PointablePoolFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/PointablePoolFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/PointablePoolFactory.java
index 9ec9bab..9f440d4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/PointablePoolFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/PointablePoolFactory.java
@@ -24,6 +24,7 @@ import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSTimePointable;
+import org.apache.vxquery.datamodel.accessors.jsonitem.ArrayPointable;
 import org.apache.vxquery.datamodel.accessors.nodes.AttributeNodePointable;
 import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
 import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
@@ -73,6 +74,7 @@ public class PointablePoolFactory {
         pp.register(NodeTreePointable.class, NodeTreePointable.FACTORY);
         pp.register(DocumentNodePointable.class, DocumentNodePointable.FACTORY);
         pp.register(ElementNodePointable.class, ElementNodePointable.FACTORY);
+        pp.register(ArrayPointable.class, ArrayPointable.FACTORY);
         pp.register(AttributeNodePointable.class, AttributeNodePointable.FACTORY);
         pp.register(TextOrCommentNodePointable.class, TextOrCommentNodePointable.FACTORY);
         pp.register(PINodePointable.class, PINodePointable.FACTORY);


[19/19] vxquery git commit: JSONiq array parser, constructor, and printer with test cases.

Posted by pr...@apache.org.
JSONiq array parser, constructor, and printer with test cases.


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/80efee30
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/80efee30
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/80efee30

Branch: refs/heads/master
Commit: 80efee30c7bf002420a1036ff7f3fee891e32f44
Parents: dac53ab bf47517
Author: Preston Carman <pr...@apache.org>
Authored: Thu Jun 9 20:31:43 2016 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Jun 9 20:31:43 2016 -0700

----------------------------------------------------------------------
 .../accessors/PointablePoolFactory.java         |  2 +
 .../vxquery/functions/builtin-operators.xml     |  7 ++
 .../node/ArrayConstructorScalarEvaluator.java   | 76 ++++++++++++++++
 .../ArrayConstructorScalarEvaluatorFactory.java | 37 ++++++++
 .../vxquery/serializer/XMLSerializer.java       | 27 ++++++
 .../org/apache/vxquery/xmlquery/ast/ASTTag.java | 92 +++++++++++++++++++-
 .../vxquery/xmlquery/ast/ArrayConstructor.java  | 40 +++++++++
 .../xmlquery/translator/XMLQueryTranslator.java | 15 ++++
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 39 +++++++--
 .../Json/Array/q01_array.txt                    |  1 +
 .../Json/Array/q02_array.txt                    |  1 +
 .../Json/Array/q03_array.txt                    |  1 +
 .../Json/Array/q04_array.txt                    |  1 +
 .../Json/Object/q01_object.txt                  |  1 +
 .../Queries/XQuery/Json/Array/q01_array.xq      | 20 +++++
 .../Queries/XQuery/Json/Array/q02_array.xq      | 20 +++++
 .../Queries/XQuery/Json/Array/q03_array.xq      | 20 +++++
 .../Queries/XQuery/Json/Array/q04_array.xq      | 20 +++++
 .../Queries/XQuery/Json/Object/q01_object.xq    | 20 +++++
 .../src/test/resources/VXQueryCatalog.xml       | 21 ++++-
 .../src/test/resources/cat/JsonArrayQueries.xml | 43 +++++++++
 .../test/resources/cat/JsonObjectQueries.xml    | 28 ++++++
 22 files changed, 522 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[13/19] vxquery git commit: Working on some corrections

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/b93e4584/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
index cb1bf7d..0d4f0c6 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
+++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
@@ -1,1148 +1,1154 @@
 <?xml version="1.0"?>
-<!-- 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. -->
+<!--
+  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.
+-->
 <operators>
-	<!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
-		as xs:date -->
-	<operator name="op:add-dayTimeDuration-to-date">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:date" />
-	</operator>
-
-	<!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
-		xs:dayTimeDuration) as xs:dateTime -->
-	<operator name="op:add-dayTimeDuration-to-dateTime">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:dateTime" />
-	</operator>
-
-	<!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
-		as xs:time -->
-	<operator name="op:add-dayTimeDuration-to-time">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:time" />
-	</operator>
-
-	<!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) 
-		as xs:dayTimeDuration -->
-	<operator name="op:add-dayTimeDurations">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:dayTimeDuration" />
-	</operator>
-
-	<!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration) 
-		as xs:date -->
-	<operator name="op:add-yearMonthDuration-to-date">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:date" />
-	</operator>
-
-	<!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
-		xs:yearMonthDuration) as xs:dateTime -->
-	<operator name="op:add-yearMonthDuration-to-dateTime">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:dateTime" />
-	</operator>
-
-	<!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as 
-		xs:yearMonthDuration) as xs:yearMonthDuration -->
-	<operator name="op:add-yearMonthDurations">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:yearMonthDuration" />
-	</operator>
-
-	<!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary) 
-		as xs:boolean -->
-	<operator name="op:base64Binary-equal">
-		<param name="value1" type="xs:base64Binary" />
-		<param name="value2" type="xs:base64Binary" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean -->
-	<operator name="op:boolean-equal">
-		<param name="value1" type="xs:boolean" />
-		<param name="value2" type="xs:boolean" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean) 
-		as xs:boolean -->
-	<operator name="op:boolean-greater-than">
-		<param name="value1" type="xs:boolean" />
-		<param name="value2" type="xs:boolean" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean) as 
-		xs:boolean -->
-	<operator name="op:boolean-less-than">
-		<param name="value1" type="xs:boolean" />
-		<param name="value2" type="xs:boolean" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:concatenate($arg as item()*) as item()* -->
-	<operator name="op:concatenate" varargs="true">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
-	<operator name="op:date-equal">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:date" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
-	<operator name="op:date-greater-than">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:date" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
-	<operator name="op:date-less-than">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:date" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean -->
-	<operator name="op:dateTime-equal">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dateTime" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-		as xs:boolean -->
-	<operator name="op:dateTime-greater-than">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dateTime" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-		as xs:boolean -->
-	<operator name="op:dateTime-less-than">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dateTime" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 
-		as xs:dayTimeDuration) as xs:boolean -->
-	<operator name="op:dayTimeDuration-greater-than">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as 
-		xs:dayTimeDuration) as xs:boolean -->
-	<operator name="op:dayTimeDuration-less-than">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double) 
-		as xs:dayTimeDuration -->
-	<operator name="op:divide-dayTimeDuration">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:double" />
-		<return type="xs:dayTimeDuration" />
-	</operator>
-
-	<!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, 
-		$arg2 as xs:dayTimeDuration) as xs:decimal -->
-	<operator name="op:divide-dayTimeDuration-by-dayTimeDuration">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:decimal" />
-	</operator>
-
-	<!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as 
-		xs:double) as xs:yearMonthDuration -->
-	<operator name="op:divide-yearMonthDuration">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:double" />
-		<return type="xs:yearMonthDuration" />
-	</operator>
-
-	<!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, 
-		$arg2 as xs:yearMonthDuration) as xs:decimal -->
-	<operator name="op:divide-yearMonthDuration-by-yearMonthDuration">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:decimal" />
-	</operator>
-
-	<!-- op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean -->
-	<operator name="op:duration-equal">
-		<param name="arg1" type="xs:duration" />
-		<param name="arg2" type="xs:duration" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:except($parameter1 as node()*, $parameter2 as node()*) as node()* -->
-	<operator name="op:except">
-		<param name="parameter1" type="node()*" />
-		<param name="parameter2" type="node()*" />
-		<return type="node()*" />
-		<!-- implementation assumes input in document order -->
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean -->
-	<operator name="op:gDay-equal">
-		<param name="arg1" type="xs:gDay" />
-		<param name="arg2" type="xs:gDay" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean -->
-	<operator name="op:gMonth-equal">
-		<param name="arg1" type="xs:gMonth" />
-		<param name="arg2" type="xs:gMonth" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as 
-		xs:boolean -->
-	<operator name="op:gMonthDay-equal">
-		<param name="arg1" type="xs:gMonthDay" />
-		<param name="arg2" type="xs:gMonthDay" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean -->
-	<operator name="op:gYear-equal">
-		<param name="arg1" type="xs:gYear" />
-		<param name="arg2" type="xs:gYear" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) 
-		as xs:boolean -->
-	<operator name="op:gYearMonth-equal">
-		<param name="arg1" type="xs:gYearMonth" />
-		<param name="arg2" type="xs:gYearMonth" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) 
-		as xs:boolean -->
-	<operator name="op:hexBinary-equal">
-		<param name="arg1" type="xs:hexBinary" />
-		<param name="arg2" type="xs:hexBinary" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* -->
-	<operator name="op:intersect">
-		<param name="parameter1" type="node()*" />
-		<param name="parameter2" type="node()*" />
-		<return type="node()*" />
-		<!-- implementation assumes input in document order -->
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
-	<operator name="op:is-same-node">
-		<param name="parameter1" type="node()" />
-		<param name="parameter2" type="node()" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as 
-		xs:double) as xs:dayTimeDuration -->
-	<operator name="op:multiply-dayTimeDuration">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:double" />
-		<return type="xs:dayTimeDuration" />
-	</operator>
-
-	<!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 
-		as xs:double) as xs:yearMonthDuration -->
-	<operator name="op:multiply-yearMonthDuration">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:double" />
-		<return type="xs:yearMonthDuration" />
-	</operator>
-
-	<!-- op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
-	<operator name="op:node-after">
-		<param name="parameter1" type="node()" />
-		<param name="parameter2" type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
-	<operator name="op:node-before">
-		<param name="parameter1" type="node()" />
-		<param name="parameter2" type="node()" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory" />
-	</operator>
-
-	<!-- op:NOTATION-equal($arg1 as xs:NOTATION, $arg2 as xs:NOTATION) as xs:boolean -->
-	<operator name="op:NOTATION-equal">
-		<param name="arg1" type="xs:NOTATION" />
-		<param name="arg2" type="xs:NOTATION" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric -->
-	<operator name="op:numeric-add">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-	</operator>
-
-	<!-- op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric -->
-	<operator name="op:numeric-divide">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-	</operator>
-
-	<!-- op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean -->
-	<operator name="op:numeric-equal">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
-	<operator name="op:numeric-greater-than">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric) as xs:integer -->
-	<operator name="op:numeric-integer-divide">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xs:integer" />
-	</operator>
-
-	<!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
-	<operator name="op:numeric-less-than">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric -->
-	<operator name="op:numeric-mod">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-	</operator>
-
-	<!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric) as numeric -->
-	<operator name="op:numeric-multiply">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-	</operator>
-
-	<!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric) as numeric -->
-	<operator name="op:numeric-subtract">
-		<param name="arg1" type="xsext:numeric" />
-		<param name="arg2" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-	</operator>
-
-	<!-- op:numeric-unary-minus( $arg as numeric) as numeric -->
-	<operator name="op:numeric-unary-minus">
-		<param name="arg1" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- op:numeric-unary-plus( $arg as numeric) as numeric -->
-	<operator name="op:numeric-unary-plus">
-		<param name="arg1" type="xsext:numeric" />
-		<return type="xsext:numeric" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean -->
-	<operator name="op:QName-equal">
-		<param name="arg1" type="xs:QName" />
-		<param name="arg2" type="xs:QName" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration? -->
-	<operator name="op:subtract-dates">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:date" />
-		<return type="xs:dayTimeDuration?" />
-	</operator>
-
-	<!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-		as xs:dayTimeDuration? -->
-	<operator name="op:subtract-dateTimes">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dateTime" />
-		<return type="xs:dayTimeDuration?" />
-	</operator>
-
-	<!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
-		as xs:date -->
-	<operator name="op:subtract-dayTimeDuration-from-date">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:date" />
-	</operator>
-
-	<!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 
-		as xs:dayTimeDuration) as xs:dateTime -->
-	<operator name="op:subtract-dayTimeDuration-from-dateTime">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:dateTime" />
-	</operator>
-
-	<!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
-		as xs:time -->
-	<operator name="op:subtract-dayTimeDuration-from-time">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:time" />
-	</operator>
-
-	<!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as 
-		xs:dayTimeDuration) as xs:dayTimeDuration -->
-	<operator name="op:subtract-dayTimeDurations">
-		<param name="arg1" type="xs:dayTimeDuration" />
-		<param name="arg2" type="xs:dayTimeDuration" />
-		<return type="xs:dayTimeDuration" />
-	</operator>
-
-	<!-- op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration -->
-	<operator name="op:subtract-times">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:time" />
-		<return type="xs:dayTimeDuration" />
-	</operator>
-
-	<!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as 
-		xs:yearMonthDuration) as xs:date -->
-	<operator name="op:subtract-yearMonthDuration-from-date">
-		<param name="arg1" type="xs:date" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:date" />
-	</operator>
-
-	<!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, 
-		$arg2 as xs:yearMonthDuration) as xs:dateTime -->
-	<operator name="op:subtract-yearMonthDuration-from-dateTime">
-		<param name="arg1" type="xs:dateTime" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:dateTime" />
-	</operator>
-
-	<!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 
-		as xs:yearMonthDuration) as xs:yearMonthDuration -->
-	<operator name="op:subtract-yearMonthDurations">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:yearMonthDuration" />
-	</operator>
-
-	<!-- op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
-	<operator name="op:time-equal">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:time" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
-	<operator name="op:time-greater-than">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:time" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
-	<operator name="op:time-less-than">
-		<param name="arg1" type="xs:time" />
-		<param name="arg2" type="xs:time" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer* -->
-	<operator name="op:to">
-		<param name="firstval" type="xs:integer" />
-		<param name="lastval" type="xs:integer" />
-		<return type="xs:integer*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- op:union($parameter1 as node()*, $parameter2 as node()*) as node()* -->
-	<operator name="op:union">
-		<param name="parameter1" type="node()*" />
-		<param name="parameter2" type="node()*" />
-		<return type="node()*" />
-		<!-- as we do the doc-order-sort and the duplicate elimination -->
-		<!-- after the concatenation, we can reuse the concat iterator -->
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 
-		as xs:yearMonthDuration) as xs:boolean -->
-	<operator name="op:yearMonthDuration-greater-than">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 
-		as xs:yearMonthDuration) as xs:boolean -->
-	<operator name="op:yearMonthDuration-less-than">
-		<param name="arg1" type="xs:yearMonthDuration" />
-		<param name="arg2" type="xs:yearMonthDuration" />
-		<return type="xs:boolean" />
-	</operator>
-
-	<!-- fn:avg-local($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
-	<operator name="opext:avg-local">
-		<param name="arg" type="xs:anyAtomicType*" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="aggregate"
-			class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory" />
-	</operator>
-
-	<!-- fn:avg-global($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
-	<operator name="opext:avg-global">
-		<param name="arg" type="xs:anyAtomicType*" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="aggregate"
-			class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:ordered($arg as item()*) as item()* -->
-	<operator name="opext:ordered">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:unordered($arg as item()*) as item()* -->
-	<operator name="opext:unordered">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-eq">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-ne">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-lt">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-le">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-gt">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:boolean? -->
-	<operator name="opext:value-ge">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-eq">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-ne">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-lt">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-le">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-gt">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-	<operator name="opext:general-ge">
-		<param name="arg1" type="item()*" />
-		<param name="arg2" type="item()*" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
-		xs:anyAtomicType? -->
-	<operator name="opext:add">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:anyAtomicType? -->
-	<operator name="opext:subtract">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:anyAtomicType? -->
-	<operator name="opext:multiply">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:anyAtomicType? -->
-	<operator name="opext:divide">
-		<param name="arg1" type="xs:anyAtomicType?" />
-		<param name="arg2" type="xs:anyAtomicType?" />
-		<return type="xs:anyAtomicType?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-		as xs:anyAtomicType? -->
-	<operator name="opext:idiv">
-		<param name="arg1" type="xsext:numeric?" />
-		<param name="arg2" type="xsext:numeric?" />
-		<return type="xs:integer?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
-		xs:anyAtomicType? -->
-	<operator name="opext:mod">
-		<param name="arg1" type="xsext:numeric?" />
-		<param name="arg2" type="xsext:numeric?" />
-		<return type="xs:integer?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
-	<operator name="opext:and">
-		<param name="arg1" type="xs:boolean?" />
-		<param name="arg2" type="xs:boolean?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
-	<operator name="opext:or">
-		<param name="arg1" type="xs:boolean?" />
-		<param name="arg2" type="xs:boolean?" />
-		<return type="xs:boolean?" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
-	<operator name="opext:sort-nodes-asc">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
-	<operator name="opext:sort-nodes-asc-or-atomics">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:sort-distinct-nodes-asc($arg as node()*) as node()* -->
-	<operator name="opext:sort-distinct-nodes-asc">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:sort-distinct-nodes-asc-or-atomics($arg as item()*) as item()* -->
-	<operator name="opext:sort-distinct-nodes-asc-or-atomics">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:distinct-nodes-or-atomics($arg as item()*) as item()* -->
-	<operator name="opext:distinct-nodes-or-atomics">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
-	<operator name="opext:sort-nodes-desc">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
-	<operator name="opext:sort-nodes-desc-or-atomics">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:sort-distinct-nodes-desc($arg as node()*) as node()* -->
-	<operator name="opext:sort-distinct-nodes-desc">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:sort-distinct-nodes-desc-or-atomics($arg as item()*) as item()* -->
-	<operator name="opext:sort-distinct-nodes-desc-or-atomics">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:id-from-node($arg as item()) as xs:integer -->
-	<operator name="opext:id-from-node">
-		<param name="arg" type="item()" />
-		<return type="xs:integer" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:local-id-from-node($arg as item()) as xs:int -->
-	<operator name="opext:local-id-from-node">
-		<param name="arg" type="item()" />
-		<return type="xs:int" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:tree-id-from-node($arg as item()) as xs:int -->
-	<operator name="opext:tree-id-from-node">
-		<param name="arg" type="item()" />
-		<return type="xs:int" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:deflate-sequences($arg as item()*) as item()* -->
-	<operator name="opext:deflate-sequences">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as 
-		node() -->
-	<operator name="opext:pi-constructor">
-		<param name="target" type="xs:string" />
-		<param name="content" type="xs:string" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:comment-constructor($content as xs:string) as node() -->
-	<operator name="opext:comment-constructor">
-		<param name="content" type="xs:string" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:element-constructor($name as xs:QName, $content as item()*) as 
-		node() -->
-	<operator name="opext:element-constructor">
-		<param name="name" type="xs:QName" />
-		<param name="content" type="item()*" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:array-constructor($expression as node()) as node() -->
-	<operator name="opext:array-constructor">
-		<param name="expession" type="node()" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.ArrayNodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) 
-		as node() -->
-	<operator name="opext:attribute-constructor">
-		<param name="name" type="xs:QName" />
-		<param name="content" type="xs:anyAtomicType*" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:text-constructor($content as xs:anyAtomicType*) as node() -->
-	<operator name="opext:text-constructor">
-		<param name="content" type="xs:anyAtomicType*" />
-		<return type="node()" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:document-constructor($content as node()) as node() -->
-	<operator name="opext:document-constructor">
-		<param name="content" type="node()" />
-		<return type="node()" />
-	</operator>
-
-	<!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else 
-		as item()*) as item()* -->
-	<operator name="opext:if-then-else">
-		<param name="condition" type="xs:boolean" />
-		<param name="then" type="item()*" />
-		<param name="else" type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:ancestor($arg as node()*) as node()* -->
-	<operator name="opext:ancestor">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:ancestor-or-self($arg as node()*) as node()* -->
-	<operator name="opext:ancestor-or-self">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:attribute($arg as node()*) as node()* -->
-	<operator name="opext:attribute">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:child($arg as node()*) as node()* -->
-	<operator name="opext:child">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory" />
-		<runtime type="unnesting"
-			class="org.apache.vxquery.runtime.functions.step.ChildPathStepUnnestingEvaluatorFactory" />
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:descendant($arg as node()*) as node()* -->
-	<operator name="opext:descendant">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.step.DescendantPathStepScalarEvaluatorFactory" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy" />
-	</operator>
-
-	<!-- opext:descendant-or-self($arg as node()*) as node()* -->
-	<operator name="opext:descendant-or-self">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepScalarEvaluatorFactory" />
-		<runtime type="unnesting"
-			class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepUnnestingEvaluatorFactory" />
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy" />
-	</operator>
-
-	<!-- opext:following($arg as node()*) as node()* -->
-	<operator name="opext:following">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:following-sibling($arg as node()*) as node()* -->
-	<operator name="opext:following-sibling">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:parent($arg as node()*) as node()* -->
-	<operator name="opext:parent">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:preceding($arg as node()*) as node()* -->
-	<operator name="opext:preceding">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:preceding-sibling($arg as node()*) as node()* -->
-	<operator name="opext:preceding-sibling">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-	</operator>
-
-	<!-- opext:self($arg as node()*) as node()* -->
-	<operator name="opext:self">
-		<param name="arg" type="node()*" />
-		<return type="node()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.step.SelfPathStepScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:sequence($arg as item()*) as item()* -->
-	<operator name="opext:sequence">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-		<runtime type="aggregate"
-			class="org.apache.vxquery.runtime.functions.sequence.SequenceAggregateEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:iterate($arg as item()*) as item() -->
-	<operator name="opext:iterate">
-		<param name="arg" type="item()*" />
-		<return type="item()" />
-		<runtime type="unnesting"
-			class="org.apache.vxquery.runtime.functions.sequence.IterateUnnestingEvaluatorFactory" />
-		<property type="DocumentOrder"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-		<property type="UniqueNodes"
-			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-			<argument value="0" />
-		</property>
-	</operator>
-
-	<!-- opext:validate-lax($arg as item()*) as item()* -->
-	<operator name="opext:validate-lax">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:validate-strict($arg as item()*) as item()* -->
-	<operator name="opext:validate-strict">
-		<param name="arg" type="item()*" />
-		<return type="item()*" />
-	</operator>
-
-	<!-- opext:promote($arg as item()*, $type as xsext:type) as item()* -->
-	<operator name="opext:promote">
-		<param name="arg" type="item()*" />
-		<param name="type" type="xs:int" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.type.PromoteScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:treat($arg as item()*, $type as xsext:type) as item()* -->
-	<operator name="opext:treat">
-		<param name="arg" type="item()*" />
-		<param name="type" type="xs:int" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.type.TreatScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:cast($arg as item()*, $type as xsext:type) as item()* -->
-	<operator name="opext:cast">
-		<param name="arg" type="item()*" />
-		<param name="type" type="xs:int" />
-		<return type="item()*" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.cast.CastScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:castable($arg as item()*, $type as xsext:type) as xs:boolean -->
-	<operator name="opext:castable">
-		<param name="arg" type="item()*" />
-		<param name="type" type="xs:int" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.castable.CastableScalarEvaluatorFactory" />
-	</operator>
-
-	<!-- opext:instance-of($arg as item()*, $type as xsext:type) as xs:boolean -->
-	<operator name="opext:instance-of">
-		<param name="arg" type="item()*" />
-		<param name="type" type="xs:int" />
-		<return type="xs:boolean" />
-		<runtime type="scalar"
-			class="org.apache.vxquery.runtime.functions.type.InstanceOfScalarEvaluatorFactory" />
-	</operator>
+    <!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
+        as xs:date -->
+    <operator name="op:add-dayTimeDuration-to-date">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:date" />
+    </operator>
+
+    <!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
+        xs:dayTimeDuration) as xs:dateTime -->
+    <operator name="op:add-dayTimeDuration-to-dateTime">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:dateTime" />
+    </operator>
+
+    <!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
+        as xs:time -->
+    <operator name="op:add-dayTimeDuration-to-time">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:time" />
+    </operator>
+
+    <!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) 
+        as xs:dayTimeDuration -->
+    <operator name="op:add-dayTimeDurations">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:dayTimeDuration" />
+    </operator>
+
+    <!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration) 
+        as xs:date -->
+    <operator name="op:add-yearMonthDuration-to-date">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:date" />
+    </operator>
+
+    <!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
+        xs:yearMonthDuration) as xs:dateTime -->
+    <operator name="op:add-yearMonthDuration-to-dateTime">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:dateTime" />
+    </operator>
+
+    <!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as 
+        xs:yearMonthDuration) as xs:yearMonthDuration -->
+    <operator name="op:add-yearMonthDurations">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:yearMonthDuration" />
+    </operator>
+
+    <!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary) 
+        as xs:boolean -->
+    <operator name="op:base64Binary-equal">
+        <param name="value1" type="xs:base64Binary" />
+        <param name="value2" type="xs:base64Binary" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean -->
+    <operator name="op:boolean-equal">
+        <param name="value1" type="xs:boolean" />
+        <param name="value2" type="xs:boolean" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean) 
+        as xs:boolean -->
+    <operator name="op:boolean-greater-than">
+        <param name="value1" type="xs:boolean" />
+        <param name="value2" type="xs:boolean" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean) as 
+        xs:boolean -->
+    <operator name="op:boolean-less-than">
+        <param name="value1" type="xs:boolean" />
+        <param name="value2" type="xs:boolean" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:concatenate($arg as item()*) as item()* -->
+    <operator name="op:concatenate" varargs="true">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <operator name="op:date-equal">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:date" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <operator name="op:date-greater-than">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:date" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <operator name="op:date-less-than">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:date" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean -->
+    <operator name="op:dateTime-equal">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dateTime" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+        as xs:boolean -->
+    <operator name="op:dateTime-greater-than">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dateTime" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+        as xs:boolean -->
+    <operator name="op:dateTime-less-than">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dateTime" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 
+        as xs:dayTimeDuration) as xs:boolean -->
+    <operator name="op:dayTimeDuration-greater-than">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as 
+        xs:dayTimeDuration) as xs:boolean -->
+    <operator name="op:dayTimeDuration-less-than">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double) 
+        as xs:dayTimeDuration -->
+    <operator name="op:divide-dayTimeDuration">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:double" />
+        <return type="xs:dayTimeDuration" />
+    </operator>
+
+    <!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, 
+        $arg2 as xs:dayTimeDuration) as xs:decimal -->
+    <operator name="op:divide-dayTimeDuration-by-dayTimeDuration">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:decimal" />
+    </operator>
+
+    <!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as 
+        xs:double) as xs:yearMonthDuration -->
+    <operator name="op:divide-yearMonthDuration">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:double" />
+        <return type="xs:yearMonthDuration" />
+    </operator>
+
+    <!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, 
+        $arg2 as xs:yearMonthDuration) as xs:decimal -->
+    <operator name="op:divide-yearMonthDuration-by-yearMonthDuration">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:decimal" />
+    </operator>
+
+    <!-- op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean -->
+    <operator name="op:duration-equal">
+        <param name="arg1" type="xs:duration" />
+        <param name="arg2" type="xs:duration" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:except($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+    <operator name="op:except">
+        <param name="parameter1" type="node()*" />
+        <param name="parameter2" type="node()*" />
+        <return type="node()*" />
+        <!-- implementation assumes input in document order -->
+        <property type="DocumentOrder"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean -->
+    <operator name="op:gDay-equal">
+        <param name="arg1" type="xs:gDay" />
+        <param name="arg2" type="xs:gDay" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean -->
+    <operator name="op:gMonth-equal">
+        <param name="arg1" type="xs:gMonth" />
+        <param name="arg2" type="xs:gMonth" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as 
+        xs:boolean -->
+    <operator name="op:gMonthDay-equal">
+        <param name="arg1" type="xs:gMonthDay" />
+        <param name="arg2" type="xs:gMonthDay" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean -->
+    <operator name="op:gYear-equal">
+        <param name="arg1" type="xs:gYear" />
+        <param name="arg2" type="xs:gYear" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) 
+        as xs:boolean -->
+    <operator name="op:gYearMonth-equal">
+        <param name="arg1" type="xs:gYearMonth" />
+        <param name="arg2" type="xs:gYearMonth" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) 
+        as xs:boolean -->
+    <operator name="op:hexBinary-equal">
+        <param name="arg1" type="xs:hexBinary" />
+        <param name="arg2" type="xs:hexBinary" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+    <operator name="op:intersect">
+        <param name="parameter1" type="node()*" />
+        <param name="parameter2" type="node()*" />
+        <return type="node()*" />
+        <!-- implementation assumes input in document order -->
+        <property type="DocumentOrder"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+    <operator name="op:is-same-node">
+        <param name="parameter1" type="node()" />
+        <param name="parameter2" type="node()" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as 
+        xs:double) as xs:dayTimeDuration -->
+    <operator name="op:multiply-dayTimeDuration">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:double" />
+        <return type="xs:dayTimeDuration" />
+    </operator>
+
+    <!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 
+        as xs:double) as xs:yearMonthDuration -->
+    <operator name="op:multiply-yearMonthDuration">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:double" />
+        <return type="xs:yearMonthDuration" />
+    </operator>
+
+    <!-- op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+    <operator name="op:node-after">
+        <param name="parameter1" type="node()" />
+        <param name="parameter2" type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+    <operator name="op:node-before">
+        <param name="parameter1" type="node()" />
+        <param name="parameter2" type="node()" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory" />
+    </operator>
+
+    <!-- op:NOTATION-equal($arg1 as xs:NOTATION, $arg2 as xs:NOTATION) as xs:boolean -->
+    <operator name="op:NOTATION-equal">
+        <param name="arg1" type="xs:NOTATION" />
+        <param name="arg2" type="xs:NOTATION" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <operator name="op:numeric-add">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+    </operator>
+
+    <!-- op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <operator name="op:numeric-divide">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+    </operator>
+
+    <!-- op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <operator name="op:numeric-equal">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <operator name="op:numeric-greater-than">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric) as xs:integer -->
+    <operator name="op:numeric-integer-divide">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xs:integer" />
+    </operator>
+
+    <!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <operator name="op:numeric-less-than">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <operator name="op:numeric-mod">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+    </operator>
+
+    <!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric) as numeric -->
+    <operator name="op:numeric-multiply">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+    </operator>
+
+    <!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric) as numeric -->
+    <operator name="op:numeric-subtract">
+        <param name="arg1" type="xsext:numeric" />
+        <param name="arg2" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+    </operator>
+
+    <!-- op:numeric-unary-minus( $arg as numeric) as numeric -->
+    <operator name="op:numeric-unary-minus">
+        <param name="arg1" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- op:numeric-unary-plus( $arg as numeric) as numeric -->
+    <operator name="op:numeric-unary-plus">
+        <param name="arg1" type="xsext:numeric" />
+        <return type="xsext:numeric" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean -->
+    <operator name="op:QName-equal">
+        <param name="arg1" type="xs:QName" />
+        <param name="arg2" type="xs:QName" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration? -->
+    <operator name="op:subtract-dates">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:date" />
+        <return type="xs:dayTimeDuration?" />
+    </operator>
+
+    <!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+        as xs:dayTimeDuration? -->
+    <operator name="op:subtract-dateTimes">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dateTime" />
+        <return type="xs:dayTimeDuration?" />
+    </operator>
+
+    <!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
+        as xs:date -->
+    <operator name="op:subtract-dayTimeDuration-from-date">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:date" />
+    </operator>
+
+    <!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 
+        as xs:dayTimeDuration) as xs:dateTime -->
+    <operator name="op:subtract-dayTimeDuration-from-dateTime">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:dateTime" />
+    </operator>
+
+    <!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
+        as xs:time -->
+    <operator name="op:subtract-dayTimeDuration-from-time">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:time" />
+    </operator>
+
+    <!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as 
+        xs:dayTimeDuration) as xs:dayTimeDuration -->
+    <operator name="op:subtract-dayTimeDurations">
+        <param name="arg1" type="xs:dayTimeDuration" />
+        <param name="arg2" type="xs:dayTimeDuration" />
+        <return type="xs:dayTimeDuration" />
+    </operator>
+
+    <!-- op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration -->
+    <operator name="op:subtract-times">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:time" />
+        <return type="xs:dayTimeDuration" />
+    </operator>
+
+    <!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as 
+        xs:yearMonthDuration) as xs:date -->
+    <operator name="op:subtract-yearMonthDuration-from-date">
+        <param name="arg1" type="xs:date" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:date" />
+    </operator>
+
+    <!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, 
+        $arg2 as xs:yearMonthDuration) as xs:dateTime -->
+    <operator name="op:subtract-yearMonthDuration-from-dateTime">
+        <param name="arg1" type="xs:dateTime" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:dateTime" />
+    </operator>
+
+    <!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 
+        as xs:yearMonthDuration) as xs:yearMonthDuration -->
+    <operator name="op:subtract-yearMonthDurations">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:yearMonthDuration" />
+    </operator>
+
+    <!-- op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <operator name="op:time-equal">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:time" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <operator name="op:time-greater-than">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:time" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <operator name="op:time-less-than">
+        <param name="arg1" type="xs:time" />
+        <param name="arg2" type="xs:time" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer* -->
+    <operator name="op:to">
+        <param name="firstval" type="xs:integer" />
+        <param name="lastval" type="xs:integer" />
+        <return type="xs:integer*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- op:union($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+    <operator name="op:union">
+        <param name="parameter1" type="node()*" />
+        <param name="parameter2" type="node()*" />
+        <return type="node()*" />
+        <!-- as we do the doc-order-sort and the duplicate elimination -->
+        <!-- after the concatenation, we can reuse the concat iterator -->
+        <property type="DocumentOrder"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 
+        as xs:yearMonthDuration) as xs:boolean -->
+    <operator name="op:yearMonthDuration-greater-than">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 
+        as xs:yearMonthDuration) as xs:boolean -->
+    <operator name="op:yearMonthDuration-less-than">
+        <param name="arg1" type="xs:yearMonthDuration" />
+        <param name="arg2" type="xs:yearMonthDuration" />
+        <return type="xs:boolean" />
+    </operator>
+
+    <!-- fn:avg-local($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
+    <operator name="opext:avg-local">
+        <param name="arg" type="xs:anyAtomicType*" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="aggregate"
+            class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory" />
+    </operator>
+
+    <!-- fn:avg-global($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
+    <operator name="opext:avg-global">
+        <param name="arg" type="xs:anyAtomicType*" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="aggregate"
+            class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:ordered($arg as item()*) as item()* -->
+    <operator name="opext:ordered">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+    </operator>
+
+    <!-- opext:unordered($arg as item()*) as item()* -->
+    <operator name="opext:unordered">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+    </operator>
+
+    <!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-eq">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-ne">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-lt">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-le">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-gt">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:boolean? -->
+    <operator name="opext:value-ge">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-eq">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-ne">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-lt">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-le">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-gt">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+    <operator name="opext:general-ge">
+        <param name="arg1" type="item()*" />
+        <param name="arg2" type="item()*" />
+        <return type="xs:boolean" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
+        xs:anyAtomicType? -->
+    <operator name="opext:add">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:anyAtomicType? -->
+    <operator name="opext:subtract">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:anyAtomicType? -->
+    <operator name="opext:multiply">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:anyAtomicType? -->
+    <operator name="opext:divide">
+        <param name="arg1" type="xs:anyAtomicType?" />
+        <param name="arg2" type="xs:anyAtomicType?" />
+        <return type="xs:anyAtomicType?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+        as xs:anyAtomicType? -->
+    <operator name="opext:idiv">
+        <param name="arg1" type="xsext:numeric?" />
+        <param name="arg2" type="xsext:numeric?" />
+        <return type="xs:integer?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
+        xs:anyAtomicType? -->
+    <operator name="opext:mod">
+        <param name="arg1" type="xsext:numeric?" />
+        <param name="arg2" type="xsext:numeric?" />
+        <return type="xs:integer?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
+    <operator name="opext:and">
+        <param name="arg1" type="xs:boolean?" />
+        <param name="arg2" type="xs:boolean?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
+    <operator name="opext:or">
+        <param name="arg1" type="xs:boolean?" />
+        <param name="arg2" type="xs:boolean?" />
+        <return type="xs:boolean?" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
+    <operator name="opext:sort-nodes-asc">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
+    <operator name="opext:sort-nodes-asc-or-atomics">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:sort-distinct-nodes-asc($arg as node()*) as node()* -->
+    <operator name="opext:sort-distinct-nodes-asc">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:sort-distinct-nodes-asc-or-atomics($arg as item()*) as item()* -->
+    <operator name="opext:sort-distinct-nodes-asc-or-atomics">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:distinct-nodes-or-atomics($arg as item()*) as item()* -->
+    <operator name="opext:distinct-nodes-or-atomics">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
+    <operator name="opext:sort-nodes-desc">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
+    <operator name="opext:sort-nodes-desc-or-atomics">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:sort-distinct-nodes-desc($arg as node()*) as node()* -->
+    <operator name="opext:sort-distinct-nodes-desc">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+    </operator>
+
+    <!-- opext:sort-distinct-nodes-desc-or-atomics($arg as item()*) as item()* -->
+    <operator name="opext:sort-distinct-nodes-desc-or-atomics">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+    </operator>
+
+    <!-- opext:id-from-node($arg as item()) as xs:integer -->
+    <operator name="opext:id-from-node">
+        <param name="arg" type="item()" />
+        <return type="xs:integer" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:local-id-from-node($arg as item()) as xs:int -->
+    <operator name="opext:local-id-from-node">
+        <param name="arg" type="item()" />
+        <return type="xs:int" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:tree-id-from-node($arg as item()) as xs:int -->
+    <operator name="opext:tree-id-from-node">
+        <param name="arg" type="item()" />
+        <return type="xs:int" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:deflate-sequences($arg as item()*) as item()* -->
+    <operator name="opext:deflate-sequences">
+        <param name="arg" type="item()*" />
+        <return type="item()*" />
+        <property type="DocumentOrder"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+        <property type="UniqueNodes"
+            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0" />
+        </property>
+    </operator>
+
+    <!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as 
+        node() -->
+    <operator name="opext:pi-constructor">
+        <param name="target" type="xs:string" />
+        <param name="content" type="xs:string" />
+        <return type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:comment-constructor($content as xs:string) as node() -->
+    <operator name="opext:comment-constructor">
+        <param name="content" type="xs:string" />
+        <return type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:element-constructor($name as xs:QName, $content as item()*) as 
+        node() -->
+    <operator name="opext:element-constructor">
+        <param name="name" type="xs:QName" />
+        <param name="content" type="item()*" />
+        <return type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:array-constructor($expression as node()) as node() -->
+    <operator name="opext:array-constructor">
+        <param name="expession" type="node()" />
+        <return type="item()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.ArrayNodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) 
+        as node() -->
+    <operator name="opext:attribute-constructor">
+        <param name="name" type="xs:QName" />
+        <param name="content" type="xs:anyAtomicType*" />
+        <return type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:text-constructor($content as xs:anyAtomicType*) as node() -->
+    <operator name="opext:text-constructor">
+        <param name="content" type="xs:anyAtomicType*" />
+        <return type="node()" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:document-constructor($content as node()) as node() -->
+    <operator name="opext:document-constructor">
+        <param name="content" type="node()" />
+        <return type="node()" />
+    </operator>
+
+    <!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else 
+        as item()*) as item()* -->
+    <operator name="opext:if-then-else">
+        <param name="condition" type="xs:boolean" />
+        <param name="then" type="item()*" />
+        <param name="else" type="item()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory" />
+        <return type="item()*" />
+    </operator>
+
+    <!-- opext:ancestor($arg as node()*) as node()* -->
+    <operator name="opext:ancestor">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+    </operator>
+
+    <!-- opext:ancestor-or-self($arg as node()*) as node()* -->
+    <operator name="opext:ancestor-or-self">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+    </operator>
+
+    <!-- opext:attribute($arg as node()*) as node()* -->
+    <operator name="opext:attribute">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory" />
+    </operator>
+
+    <!-- opext:child($arg as node()*) as node()* -->
+    <operator name="opext:child">
+        <param name="arg" type="node()*" />
+        <return type="node()*" />
+        <runtime type="scalar"
+            class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory" />
+        <runtime type="unnesting"
+      

<TRUNCATED>

[09/19] vxquery git commit: Working on array runtime constructor

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
index c367725..cb1bf7d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
+++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
@@ -1,1023 +1,1148 @@
 <?xml version="1.0"?>
-<!--
-  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.
--->
+<!-- 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. -->
 <operators>
-    <!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration)  as xs:date -->
-    <operator name="op:add-dayTimeDuration-to-date">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:date"/>
-    </operator>
-
-    <!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration)  as xs:dateTime -->
-    <operator name="op:add-dayTimeDuration-to-dateTime">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:dateTime"/>
-    </operator>
-
-    <!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration)  as xs:time -->
-    <operator name="op:add-dayTimeDuration-to-time">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:time"/>
-    </operator>
-
-    <!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:dayTimeDuration -->
-    <operator name="op:add-dayTimeDurations">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:dayTimeDuration"/>
-    </operator>
-
-    <!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration)  as xs:date -->
-    <operator name="op:add-yearMonthDuration-to-date">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:date"/>
-    </operator>
-
-    <!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration)  as xs:dateTime -->
-    <operator name="op:add-yearMonthDuration-to-dateTime">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:dateTime"/>
-    </operator>
-
-    <!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:yearMonthDuration -->
-    <operator name="op:add-yearMonthDurations">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:yearMonthDuration"/>
-    </operator>
-
-    <!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary)  as xs:boolean -->
-    <operator name="op:base64Binary-equal">
-        <param name="value1" type="xs:base64Binary"/>
-        <param name="value2" type="xs:base64Binary"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:boolean-equal($value1  as xs:boolean, $value2 as xs:boolean)  as xs:boolean -->
-    <operator name="op:boolean-equal">
-        <param name="value1" type="xs:boolean"/>
-        <param name="value2" type="xs:boolean"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean)  as xs:boolean -->
-    <operator name="op:boolean-greater-than">
-        <param name="value1" type="xs:boolean"/>
-        <param name="value2" type="xs:boolean"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean)  as xs:boolean -->
-    <operator name="op:boolean-less-than">
-        <param name="value1" type="xs:boolean"/>
-        <param name="value2" type="xs:boolean"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:concatenate($arg as item()*)  as item()* -->
-    <operator name="op:concatenate" varargs="true">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- op:date-equal($arg1  as xs:date, $arg2 as xs:date)  as xs:boolean -->
-    <operator name="op:date-equal">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:date"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date)  as xs:boolean -->
-    <operator name="op:date-greater-than">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:date"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:date-less-than($arg1  as xs:date, $arg2 as xs:date)  as xs:boolean -->
-    <operator name="op:date-less-than">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:date"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:dateTime-equal($arg1  as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
-    <operator name="op:dateTime-equal">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dateTime"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
-    <operator name="op:dateTime-greater-than">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dateTime"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
-    <operator name="op:dateTime-less-than">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dateTime"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:boolean -->
-    <operator name="op:dayTimeDuration-greater-than">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:boolean -->
-    <operator name="op:dayTimeDuration-less-than">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double)  as xs:dayTimeDuration -->
-    <operator name="op:divide-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:double"/>
-        <return type="xs:dayTimeDuration"/>
-    </operator>
-
-    <!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:decimal -->
-    <operator name="op:divide-dayTimeDuration-by-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:decimal"/>
-    </operator>
-
-    <!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:double)  as xs:yearMonthDuration -->
-    <operator name="op:divide-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:double"/>
-        <return type="xs:yearMonthDuration"/>
-    </operator>
-
-    <!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:decimal -->
-    <operator name="op:divide-yearMonthDuration-by-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:decimal"/>
-    </operator>
-
-    <!-- op:duration-equal($arg1  as xs:duration, $arg2 as xs:duration)  as xs:boolean -->
-    <operator name="op:duration-equal">
-        <param name="arg1" type="xs:duration"/>
-        <param name="arg2" type="xs:duration"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:except($parameter1  as node()*, $parameter2 as node()*)  as node()* -->
-    <operator name="op:except">
-        <param name="parameter1" type="node()*"/>
-        <param name="parameter2" type="node()*"/>
-        <return type="node()*"/>
-        <!-- implementation assumes input in document order -->
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- op:gDay-equal($arg1  as xs:gDay, $arg2 as xs:gDay)  as xs:boolean -->
-    <operator name="op:gDay-equal">
-        <param name="arg1" type="xs:gDay"/>
-        <param name="arg2" type="xs:gDay"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:gMonth-equal($arg1  as xs:gMonth, $arg2 as xs:gMonth)  as xs:boolean -->
-    <operator name="op:gMonth-equal">
-        <param name="arg1" type="xs:gMonth"/>
-        <param name="arg2" type="xs:gMonth"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:gMonthDay-equal($arg1  as xs:gMonthDay, $arg2 as xs:gMonthDay)  as xs:boolean -->
-    <operator name="op:gMonthDay-equal">
-        <param name="arg1" type="xs:gMonthDay"/>
-        <param name="arg2" type="xs:gMonthDay"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:gYear-equal($arg1  as xs:gYear, $arg2 as xs:gYear)  as xs:boolean -->
-    <operator name="op:gYear-equal">
-        <param name="arg1" type="xs:gYear"/>
-        <param name="arg2" type="xs:gYear"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth)  as xs:boolean -->
-    <operator name="op:gYearMonth-equal">
-        <param name="arg1" type="xs:gYearMonth"/>
-        <param name="arg2" type="xs:gYearMonth"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) as xs:boolean -->
-    <operator name="op:hexBinary-equal">
-        <param name="arg1" type="xs:hexBinary"/>
-        <param name="arg2" type="xs:hexBinary"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* -->
-    <operator name="op:intersect">
-        <param name="parameter1" type="node()*"/>
-        <param name="parameter2" type="node()*"/>
-        <return type="node()*"/>
-        <!-- implementation assumes input in document order -->
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
-    <operator name="op:is-same-node">
-        <param name="parameter1" type="node()"/>
-        <param name="parameter2" type="node()"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double)  as xs:dayTimeDuration -->
-    <operator name="op:multiply-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:double"/>
-        <return type="xs:dayTimeDuration"/>
-    </operator>
-
-    <!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:double)  as xs:yearMonthDuration -->
-    <operator name="op:multiply-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:double"/>
-        <return type="xs:yearMonthDuration"/>
-    </operator>
-
-    <!-- op:node-after($parameter1  as node(), $parameter2 as node())  as xs:boolean -->
-    <operator name="op:node-after">
-        <param name="parameter1" type="node()"/>
-        <param name="parameter2" type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:node-before($parameter1  as node(), $parameter2 as node())  as xs:boolean -->
-    <operator name="op:node-before">
-        <param name="parameter1" type="node()"/>
-        <param name="parameter2" type="node()"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory"/>
-    </operator>
-
-    <!-- op:NOTATION-equal($arg1  as xs:NOTATION, $arg2 as xs:NOTATION)  as xs:boolean -->
-    <operator name="op:NOTATION-equal">
-        <param name="arg1" type="xs:NOTATION"/>
-        <param name="arg2" type="xs:NOTATION"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:numeric-add($arg1  as numeric, $arg2 as numeric)  as numeric -->
-    <operator name="op:numeric-add">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-    </operator>
-
-    <!-- op:numeric-divide($arg1  as numeric, $arg2 as numeric)  as numeric -->
-    <operator name="op:numeric-divide">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-    </operator>
-
-    <!-- op:numeric-equal($arg1  as numeric, $arg2 as numeric)  as xs:boolean -->
-    <operator name="op:numeric-equal">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric)  as xs:boolean -->
-    <operator name="op:numeric-greater-than">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric)  as xs:integer -->
-    <operator name="op:numeric-integer-divide">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xs:integer"/>
-    </operator>
-
-    <!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric)  as xs:boolean -->
-    <operator name="op:numeric-less-than">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:numeric-mod($arg1  as numeric, $arg2 as numeric)  as numeric -->
-    <operator name="op:numeric-mod">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-    </operator>
-
-    <!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric)  as numeric -->
-    <operator name="op:numeric-multiply">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-    </operator>
-
-    <!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric)  as numeric -->
-    <operator name="op:numeric-subtract">
-        <param name="arg1" type="xsext:numeric"/>
-        <param name="arg2" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-    </operator>
-
-    <!-- op:numeric-unary-minus( $arg as numeric) as  numeric -->
-    <operator name="op:numeric-unary-minus">
-        <param name="arg1" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- op:numeric-unary-plus( $arg as numeric) as  numeric -->
-    <operator name="op:numeric-unary-plus">
-        <param name="arg1" type="xsext:numeric"/>
-        <return type="xsext:numeric"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- op:QName-equal($arg1  as xs:QName, $arg2 as xs:QName)  as xs:boolean -->
-    <operator name="op:QName-equal">
-        <param name="arg1" type="xs:QName"/>
-        <param name="arg2" type="xs:QName"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:subtract-dates($arg1  as xs:date, $arg2 as xs:date)  as xs:dayTimeDuration? -->
-    <operator name="op:subtract-dates">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:date"/>
-        <return type="xs:dayTimeDuration?"/>
-    </operator>
-
-    <!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:dayTimeDuration? -->
-    <operator name="op:subtract-dateTimes">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dateTime"/>
-        <return type="xs:dayTimeDuration?"/>
-    </operator>
-
-    <!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration)  as xs:date -->
-    <operator name="op:subtract-dayTimeDuration-from-date">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:date"/>
-    </operator>
-
-    <!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration)  as xs:dateTime -->
-    <operator name="op:subtract-dayTimeDuration-from-dateTime">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:dateTime"/>
-    </operator>
-
-    <!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration)  as xs:time -->
-    <operator name="op:subtract-dayTimeDuration-from-time">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:time"/>
-    </operator>
-
-    <!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:dayTimeDuration -->
-    <operator name="op:subtract-dayTimeDurations">
-        <param name="arg1" type="xs:dayTimeDuration"/>
-        <param name="arg2" type="xs:dayTimeDuration"/>
-        <return type="xs:dayTimeDuration"/>
-    </operator>
-
-    <!-- op:subtract-times($arg1  as xs:time, $arg2 as xs:time)  as xs:dayTimeDuration -->
-    <operator name="op:subtract-times">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:time"/>
-        <return type="xs:dayTimeDuration"/>
-    </operator>
-
-    <!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration)  as xs:date -->
-    <operator name="op:subtract-yearMonthDuration-from-date">
-        <param name="arg1" type="xs:date"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:date"/>
-    </operator>
-
-    <!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration)  as xs:dateTime -->
-    <operator name="op:subtract-yearMonthDuration-from-dateTime">
-        <param name="arg1" type="xs:dateTime"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:dateTime"/>
-    </operator>
-
-    <!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:yearMonthDuration -->
-    <operator name="op:subtract-yearMonthDurations">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:yearMonthDuration"/>
-    </operator>
-
-    <!-- op:time-equal($arg1  as xs:time, $arg2 as xs:time)  as xs:boolean -->
-    <operator name="op:time-equal">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:time"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time)  as xs:boolean -->
-    <operator name="op:time-greater-than">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:time"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:time-less-than($arg1  as xs:time, $arg2 as xs:time)  as xs:boolean -->
-    <operator name="op:time-less-than">
-        <param name="arg1" type="xs:time"/>
-        <param name="arg2" type="xs:time"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:to($firstval as  xs:integer, $lastval as xs:integer)  as xs:integer* -->
-    <operator name="op:to">
-        <param name="firstval" type="xs:integer"/>
-        <param name="lastval" type="xs:integer"/>
-        <return type="xs:integer*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- op:union($parameter1  as node()*, $parameter2 as node()*)  as node()* -->
-    <operator name="op:union">
-        <param name="parameter1" type="node()*"/>
-        <param name="parameter2" type="node()*"/>
-        <return type="node()*"/>
-        <!-- as we do the doc-order-sort and the duplicate elimination -->
-        <!-- after the concatenation, we can reuse the concat iterator -->
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:boolean -->
-    <operator name="op:yearMonthDuration-greater-than">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:boolean -->
-    <operator name="op:yearMonthDuration-less-than">
-        <param name="arg1" type="xs:yearMonthDuration"/>
-        <param name="arg2" type="xs:yearMonthDuration"/>
-        <return type="xs:boolean"/>
-    </operator>
-
-    <!-- fn:avg-local($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
-    <operator name="opext:avg-local">
-        <param name="arg" type="xs:anyAtomicType*"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory"/>
-    </operator>
-
-    <!-- fn:avg-global($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
-    <operator name="opext:avg-global">
-        <param name="arg" type="xs:anyAtomicType*"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:ordered($arg as item()*) as item()* -->
-    <operator name="opext:ordered">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:unordered($arg as item()*) as item()* -->
-    <operator name="opext:unordered">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-eq">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-ne">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-lt">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-le">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-gt">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
-    <operator name="opext:value-ge">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-eq">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-ne">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-lt">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-le">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-gt">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
-    <operator name="opext:general-ge">
-        <param name="arg1" type="item()*"/>
-        <param name="arg2" type="item()*"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:add">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:subtract">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:multiply">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:divide">
-        <param name="arg1" type="xs:anyAtomicType?"/>
-        <param name="arg2" type="xs:anyAtomicType?"/>
-        <return type="xs:anyAtomicType?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:idiv">
-        <param name="arg1" type="xsext:numeric?"/>
-        <param name="arg2" type="xsext:numeric?"/>
-        <return type="xs:integer?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
-    <operator name="opext:mod">
-        <param name="arg1" type="xsext:numeric?"/>
-        <param name="arg2" type="xsext:numeric?"/>
-        <return type="xs:integer?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
-    <operator name="opext:and">
-        <param name="arg1" type="xs:boolean?"/>
-        <param name="arg2" type="xs:boolean?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
-    <operator name="opext:or">
-        <param name="arg1" type="xs:boolean?"/>
-        <param name="arg2" type="xs:boolean?"/>
-        <return type="xs:boolean?"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
-    <operator name="opext:sort-nodes-asc">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
-    <operator name="opext:sort-nodes-asc-or-atomics">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:sort-distinct-nodes-asc($arg as node()*) as node()* -->
-    <operator name="opext:sort-distinct-nodes-asc">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-    
-    <!-- opext:sort-distinct-nodes-asc-or-atomics($arg as item()*) as item()* -->
-    <operator name="opext:sort-distinct-nodes-asc-or-atomics">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:distinct-nodes-or-atomics($arg as item()*) as item()* -->
-    <operator name="opext:distinct-nodes-or-atomics">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
-    <operator name="opext:sort-nodes-desc">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
-    <operator name="opext:sort-nodes-desc-or-atomics">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:sort-distinct-nodes-desc($arg as node()*) as node()* -->
-    <operator name="opext:sort-distinct-nodes-desc">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:sort-distinct-nodes-desc-or-atomics($arg as item()*) as item()* -->
-    <operator name="opext:sort-distinct-nodes-desc-or-atomics">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:id-from-node($arg as item()) as xs:integer -->
-    <operator name="opext:id-from-node">
-        <param name="arg" type="item()"/>
-        <return type="xs:integer"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:local-id-from-node($arg as item()) as xs:int -->
-    <operator name="opext:local-id-from-node">
-        <param name="arg" type="item()"/>
-        <return type="xs:int"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:tree-id-from-node($arg as item()) as xs:int -->
-    <operator name="opext:tree-id-from-node">
-        <param name="arg" type="item()"/>
-        <return type="xs:int"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:deflate-sequences($arg as item()*) as item()* -->
-    <operator name="opext:deflate-sequences">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as node() -->
-    <operator name="opext:pi-constructor">
-        <param name="target" type="xs:string"/>
-        <param name="content" type="xs:string"/>
-        <return type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:comment-constructor($content as xs:string) as node() -->
-    <operator name="opext:comment-constructor">
-        <param name="content" type="xs:string"/>
-        <return type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:element-constructor($name as xs:QName, $content as item()*) as node() -->
-    <operator name="opext:element-constructor">
-        <param name="name" type="xs:QName"/>
-        <param name="content" type="item()*"/>
-        <return type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) as node() -->
-    <operator name="opext:attribute-constructor">
-        <param name="name" type="xs:QName"/>
-        <param name="content" type="xs:anyAtomicType*"/>
-        <return type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:text-constructor($content as xs:anyAtomicType*) as node() -->
-    <operator name="opext:text-constructor">
-        <param name="content" type="xs:anyAtomicType*"/>
-        <return type="node()"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:document-constructor($content as node()) as node() -->
-    <operator name="opext:document-constructor">
-        <param name="content" type="node()"/>
-        <return type="node()"/>
-    </operator>
-
-    <!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else as item()*) as item()* -->
-    <operator name="opext:if-then-else">
-        <param name="condition" type="xs:boolean"/>
-        <param name="then" type="item()*"/>
-        <param name="else" type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:ancestor($arg as node()*) as node()* -->
-    <operator name="opext:ancestor">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:ancestor-or-self($arg as node()*) as node()* -->
-    <operator name="opext:ancestor-or-self">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:attribute($arg as node()*) as node()* -->
-    <operator name="opext:attribute">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:child($arg as node()*) as node()* -->
-    <operator name="opext:child">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory"/>
-        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.step.ChildPathStepUnnestingEvaluatorFactory"/>
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:descendant($arg as node()*) as node()* -->
-    <operator name="opext:descendant">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.DescendantPathStepScalarEvaluatorFactory"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy"/>
-    </operator>
-
-    <!-- opext:descendant-or-self($arg as node()*) as node()* -->
-    <operator name="opext:descendant-or-self">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepScalarEvaluatorFactory"/>
-        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepUnnestingEvaluatorFactory"/>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy"/>
-    </operator>
-
-    <!-- opext:following($arg as node()*) as node()* -->
-    <operator name="opext:following">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:following-sibling($arg as node()*) as node()* -->
-    <operator name="opext:following-sibling">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:parent($arg as node()*) as node()* -->
-    <operator name="opext:parent">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:preceding($arg as node()*) as node()* -->
-    <operator name="opext:preceding">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:preceding-sibling($arg as node()*) as node()* -->
-    <operator name="opext:preceding-sibling">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-    </operator>
-
-    <!-- opext:self($arg as node()*) as node()* -->
-    <operator name="opext:self">
-        <param name="arg" type="node()*"/>
-        <return type="node()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.SelfPathStepScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:sequence($arg as item()*) as item()* -->
-    <operator name="opext:sequence">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.sequence.SequenceAggregateEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:iterate($arg as item()*) as item() -->
-    <operator name="opext:iterate">
-        <param name="arg" type="item()*"/>
-        <return type="item()"/>
-        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.sequence.IterateUnnestingEvaluatorFactory"/>
-        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0"/>
-        </property>
-    </operator>
-
-    <!-- opext:validate-lax($arg as item()*) as item()* -->
-    <operator name="opext:validate-lax">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:validate-strict($arg as item()*) as item()* -->
-    <operator name="opext:validate-strict">
-        <param name="arg" type="item()*"/>
-        <return type="item()*"/>
-    </operator>
-
-    <!-- opext:promote($arg as item()*, $type as xsext:type) as item()* -->
-    <operator name="opext:promote">
-        <param name="arg" type="item()*"/>
-        <param name="type" type="xs:int"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.PromoteScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:treat($arg as item()*, $type as xsext:type) as item()* -->
-    <operator name="opext:treat">
-        <param name="arg" type="item()*"/>
-        <param name="type" type="xs:int"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.TreatScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:cast($arg as item()*, $type as xsext:type) as item()* -->
-    <operator name="opext:cast">
-        <param name="arg" type="item()*"/>
-        <param name="type" type="xs:int"/>
-        <return type="item()*"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.cast.CastScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:castable($arg as item()*, $type as xsext:type) as xs:boolean -->
-    <operator name="opext:castable">
-        <param name="arg" type="item()*"/>
-        <param name="type" type="xs:int"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.castable.CastableScalarEvaluatorFactory"/>
-    </operator>
-
-    <!-- opext:instance-of($arg as item()*, $type as xsext:type) as xs:boolean -->
-    <operator name="opext:instance-of">
-        <param name="arg" type="item()*"/>
-        <param name="type" type="xs:int"/>
-        <return type="xs:boolean"/>
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.InstanceOfScalarEvaluatorFactory"/>
-    </operator>
+	<!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
+		as xs:date -->
+	<operator name="op:add-dayTimeDuration-to-date">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:date" />
+	</operator>
+
+	<!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
+		xs:dayTimeDuration) as xs:dateTime -->
+	<operator name="op:add-dayTimeDuration-to-dateTime">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:dateTime" />
+	</operator>
+
+	<!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
+		as xs:time -->
+	<operator name="op:add-dayTimeDuration-to-time">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:time" />
+	</operator>
+
+	<!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) 
+		as xs:dayTimeDuration -->
+	<operator name="op:add-dayTimeDurations">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:dayTimeDuration" />
+	</operator>
+
+	<!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration) 
+		as xs:date -->
+	<operator name="op:add-yearMonthDuration-to-date">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:date" />
+	</operator>
+
+	<!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
+		xs:yearMonthDuration) as xs:dateTime -->
+	<operator name="op:add-yearMonthDuration-to-dateTime">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:dateTime" />
+	</operator>
+
+	<!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as 
+		xs:yearMonthDuration) as xs:yearMonthDuration -->
+	<operator name="op:add-yearMonthDurations">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:yearMonthDuration" />
+	</operator>
+
+	<!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary) 
+		as xs:boolean -->
+	<operator name="op:base64Binary-equal">
+		<param name="value1" type="xs:base64Binary" />
+		<param name="value2" type="xs:base64Binary" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean -->
+	<operator name="op:boolean-equal">
+		<param name="value1" type="xs:boolean" />
+		<param name="value2" type="xs:boolean" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean) 
+		as xs:boolean -->
+	<operator name="op:boolean-greater-than">
+		<param name="value1" type="xs:boolean" />
+		<param name="value2" type="xs:boolean" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean) as 
+		xs:boolean -->
+	<operator name="op:boolean-less-than">
+		<param name="value1" type="xs:boolean" />
+		<param name="value2" type="xs:boolean" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:concatenate($arg as item()*) as item()* -->
+	<operator name="op:concatenate" varargs="true">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+	<operator name="op:date-equal">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:date" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+	<operator name="op:date-greater-than">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:date" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+	<operator name="op:date-less-than">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:date" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean -->
+	<operator name="op:dateTime-equal">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dateTime" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+		as xs:boolean -->
+	<operator name="op:dateTime-greater-than">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dateTime" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+		as xs:boolean -->
+	<operator name="op:dateTime-less-than">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dateTime" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 
+		as xs:dayTimeDuration) as xs:boolean -->
+	<operator name="op:dayTimeDuration-greater-than">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as 
+		xs:dayTimeDuration) as xs:boolean -->
+	<operator name="op:dayTimeDuration-less-than">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double) 
+		as xs:dayTimeDuration -->
+	<operator name="op:divide-dayTimeDuration">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:double" />
+		<return type="xs:dayTimeDuration" />
+	</operator>
+
+	<!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, 
+		$arg2 as xs:dayTimeDuration) as xs:decimal -->
+	<operator name="op:divide-dayTimeDuration-by-dayTimeDuration">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:decimal" />
+	</operator>
+
+	<!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as 
+		xs:double) as xs:yearMonthDuration -->
+	<operator name="op:divide-yearMonthDuration">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:double" />
+		<return type="xs:yearMonthDuration" />
+	</operator>
+
+	<!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, 
+		$arg2 as xs:yearMonthDuration) as xs:decimal -->
+	<operator name="op:divide-yearMonthDuration-by-yearMonthDuration">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:decimal" />
+	</operator>
+
+	<!-- op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean -->
+	<operator name="op:duration-equal">
+		<param name="arg1" type="xs:duration" />
+		<param name="arg2" type="xs:duration" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:except($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+	<operator name="op:except">
+		<param name="parameter1" type="node()*" />
+		<param name="parameter2" type="node()*" />
+		<return type="node()*" />
+		<!-- implementation assumes input in document order -->
+		<property type="DocumentOrder"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean -->
+	<operator name="op:gDay-equal">
+		<param name="arg1" type="xs:gDay" />
+		<param name="arg2" type="xs:gDay" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean -->
+	<operator name="op:gMonth-equal">
+		<param name="arg1" type="xs:gMonth" />
+		<param name="arg2" type="xs:gMonth" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as 
+		xs:boolean -->
+	<operator name="op:gMonthDay-equal">
+		<param name="arg1" type="xs:gMonthDay" />
+		<param name="arg2" type="xs:gMonthDay" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean -->
+	<operator name="op:gYear-equal">
+		<param name="arg1" type="xs:gYear" />
+		<param name="arg2" type="xs:gYear" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) 
+		as xs:boolean -->
+	<operator name="op:gYearMonth-equal">
+		<param name="arg1" type="xs:gYearMonth" />
+		<param name="arg2" type="xs:gYearMonth" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) 
+		as xs:boolean -->
+	<operator name="op:hexBinary-equal">
+		<param name="arg1" type="xs:hexBinary" />
+		<param name="arg2" type="xs:hexBinary" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+	<operator name="op:intersect">
+		<param name="parameter1" type="node()*" />
+		<param name="parameter2" type="node()*" />
+		<return type="node()*" />
+		<!-- implementation assumes input in document order -->
+		<property type="DocumentOrder"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+	<operator name="op:is-same-node">
+		<param name="parameter1" type="node()" />
+		<param name="parameter2" type="node()" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as 
+		xs:double) as xs:dayTimeDuration -->
+	<operator name="op:multiply-dayTimeDuration">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:double" />
+		<return type="xs:dayTimeDuration" />
+	</operator>
+
+	<!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 
+		as xs:double) as xs:yearMonthDuration -->
+	<operator name="op:multiply-yearMonthDuration">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:double" />
+		<return type="xs:yearMonthDuration" />
+	</operator>
+
+	<!-- op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+	<operator name="op:node-after">
+		<param name="parameter1" type="node()" />
+		<param name="parameter2" type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+	<operator name="op:node-before">
+		<param name="parameter1" type="node()" />
+		<param name="parameter2" type="node()" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory" />
+	</operator>
+
+	<!-- op:NOTATION-equal($arg1 as xs:NOTATION, $arg2 as xs:NOTATION) as xs:boolean -->
+	<operator name="op:NOTATION-equal">
+		<param name="arg1" type="xs:NOTATION" />
+		<param name="arg2" type="xs:NOTATION" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric -->
+	<operator name="op:numeric-add">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+	</operator>
+
+	<!-- op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric -->
+	<operator name="op:numeric-divide">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+	</operator>
+
+	<!-- op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+	<operator name="op:numeric-equal">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+	<operator name="op:numeric-greater-than">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric) as xs:integer -->
+	<operator name="op:numeric-integer-divide">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xs:integer" />
+	</operator>
+
+	<!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+	<operator name="op:numeric-less-than">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric -->
+	<operator name="op:numeric-mod">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+	</operator>
+
+	<!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric) as numeric -->
+	<operator name="op:numeric-multiply">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+	</operator>
+
+	<!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric) as numeric -->
+	<operator name="op:numeric-subtract">
+		<param name="arg1" type="xsext:numeric" />
+		<param name="arg2" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+	</operator>
+
+	<!-- op:numeric-unary-minus( $arg as numeric) as numeric -->
+	<operator name="op:numeric-unary-minus">
+		<param name="arg1" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- op:numeric-unary-plus( $arg as numeric) as numeric -->
+	<operator name="op:numeric-unary-plus">
+		<param name="arg1" type="xsext:numeric" />
+		<return type="xsext:numeric" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean -->
+	<operator name="op:QName-equal">
+		<param name="arg1" type="xs:QName" />
+		<param name="arg2" type="xs:QName" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration? -->
+	<operator name="op:subtract-dates">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:date" />
+		<return type="xs:dayTimeDuration?" />
+	</operator>
+
+	<!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
+		as xs:dayTimeDuration? -->
+	<operator name="op:subtract-dateTimes">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dateTime" />
+		<return type="xs:dayTimeDuration?" />
+	</operator>
+
+	<!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
+		as xs:date -->
+	<operator name="op:subtract-dayTimeDuration-from-date">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:date" />
+	</operator>
+
+	<!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 
+		as xs:dayTimeDuration) as xs:dateTime -->
+	<operator name="op:subtract-dayTimeDuration-from-dateTime">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:dateTime" />
+	</operator>
+
+	<!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
+		as xs:time -->
+	<operator name="op:subtract-dayTimeDuration-from-time">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:time" />
+	</operator>
+
+	<!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as 
+		xs:dayTimeDuration) as xs:dayTimeDuration -->
+	<operator name="op:subtract-dayTimeDurations">
+		<param name="arg1" type="xs:dayTimeDuration" />
+		<param name="arg2" type="xs:dayTimeDuration" />
+		<return type="xs:dayTimeDuration" />
+	</operator>
+
+	<!-- op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration -->
+	<operator name="op:subtract-times">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:time" />
+		<return type="xs:dayTimeDuration" />
+	</operator>
+
+	<!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as 
+		xs:yearMonthDuration) as xs:date -->
+	<operator name="op:subtract-yearMonthDuration-from-date">
+		<param name="arg1" type="xs:date" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:date" />
+	</operator>
+
+	<!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, 
+		$arg2 as xs:yearMonthDuration) as xs:dateTime -->
+	<operator name="op:subtract-yearMonthDuration-from-dateTime">
+		<param name="arg1" type="xs:dateTime" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:dateTime" />
+	</operator>
+
+	<!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 
+		as xs:yearMonthDuration) as xs:yearMonthDuration -->
+	<operator name="op:subtract-yearMonthDurations">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:yearMonthDuration" />
+	</operator>
+
+	<!-- op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+	<operator name="op:time-equal">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:time" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+	<operator name="op:time-greater-than">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:time" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+	<operator name="op:time-less-than">
+		<param name="arg1" type="xs:time" />
+		<param name="arg2" type="xs:time" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer* -->
+	<operator name="op:to">
+		<param name="firstval" type="xs:integer" />
+		<param name="lastval" type="xs:integer" />
+		<return type="xs:integer*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- op:union($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+	<operator name="op:union">
+		<param name="parameter1" type="node()*" />
+		<param name="parameter2" type="node()*" />
+		<return type="node()*" />
+		<!-- as we do the doc-order-sort and the duplicate elimination -->
+		<!-- after the concatenation, we can reuse the concat iterator -->
+		<property type="DocumentOrder"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 
+		as xs:yearMonthDuration) as xs:boolean -->
+	<operator name="op:yearMonthDuration-greater-than">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 
+		as xs:yearMonthDuration) as xs:boolean -->
+	<operator name="op:yearMonthDuration-less-than">
+		<param name="arg1" type="xs:yearMonthDuration" />
+		<param name="arg2" type="xs:yearMonthDuration" />
+		<return type="xs:boolean" />
+	</operator>
+
+	<!-- fn:avg-local($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
+	<operator name="opext:avg-local">
+		<param name="arg" type="xs:anyAtomicType*" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="aggregate"
+			class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory" />
+	</operator>
+
+	<!-- fn:avg-global($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
+	<operator name="opext:avg-global">
+		<param name="arg" type="xs:anyAtomicType*" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="aggregate"
+			class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:ordered($arg as item()*) as item()* -->
+	<operator name="opext:ordered">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+	</operator>
+
+	<!-- opext:unordered($arg as item()*) as item()* -->
+	<operator name="opext:unordered">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+	</operator>
+
+	<!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-eq">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-ne">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-lt">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-le">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-gt">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:boolean? -->
+	<operator name="opext:value-ge">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-eq">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-ne">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-lt">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-le">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-gt">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
+	<operator name="opext:general-ge">
+		<param name="arg1" type="item()*" />
+		<param name="arg2" type="item()*" />
+		<return type="xs:boolean" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
+		xs:anyAtomicType? -->
+	<operator name="opext:add">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:anyAtomicType? -->
+	<operator name="opext:subtract">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:anyAtomicType? -->
+	<operator name="opext:multiply">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:anyAtomicType? -->
+	<operator name="opext:divide">
+		<param name="arg1" type="xs:anyAtomicType?" />
+		<param name="arg2" type="xs:anyAtomicType?" />
+		<return type="xs:anyAtomicType?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
+		as xs:anyAtomicType? -->
+	<operator name="opext:idiv">
+		<param name="arg1" type="xsext:numeric?" />
+		<param name="arg2" type="xsext:numeric?" />
+		<return type="xs:integer?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
+		xs:anyAtomicType? -->
+	<operator name="opext:mod">
+		<param name="arg1" type="xsext:numeric?" />
+		<param name="arg2" type="xsext:numeric?" />
+		<return type="xs:integer?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
+	<operator name="opext:and">
+		<param name="arg1" type="xs:boolean?" />
+		<param name="arg2" type="xs:boolean?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
+	<operator name="opext:or">
+		<param name="arg1" type="xs:boolean?" />
+		<param name="arg2" type="xs:boolean?" />
+		<return type="xs:boolean?" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
+	<operator name="opext:sort-nodes-asc">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
+	<operator name="opext:sort-nodes-asc-or-atomics">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:sort-distinct-nodes-asc($arg as node()*) as node()* -->
+	<operator name="opext:sort-distinct-nodes-asc">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:sort-distinct-nodes-asc-or-atomics($arg as item()*) as item()* -->
+	<operator name="opext:sort-distinct-nodes-asc-or-atomics">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:distinct-nodes-or-atomics($arg as item()*) as item()* -->
+	<operator name="opext:distinct-nodes-or-atomics">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
+	<operator name="opext:sort-nodes-desc">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
+	<operator name="opext:sort-nodes-desc-or-atomics">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:sort-distinct-nodes-desc($arg as node()*) as node()* -->
+	<operator name="opext:sort-distinct-nodes-desc">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+	</operator>
+
+	<!-- opext:sort-distinct-nodes-desc-or-atomics($arg as item()*) as item()* -->
+	<operator name="opext:sort-distinct-nodes-desc-or-atomics">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+	</operator>
+
+	<!-- opext:id-from-node($arg as item()) as xs:integer -->
+	<operator name="opext:id-from-node">
+		<param name="arg" type="item()" />
+		<return type="xs:integer" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:local-id-from-node($arg as item()) as xs:int -->
+	<operator name="opext:local-id-from-node">
+		<param name="arg" type="item()" />
+		<return type="xs:int" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:tree-id-from-node($arg as item()) as xs:int -->
+	<operator name="opext:tree-id-from-node">
+		<param name="arg" type="item()" />
+		<return type="xs:int" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:deflate-sequences($arg as item()*) as item()* -->
+	<operator name="opext:deflate-sequences">
+		<param name="arg" type="item()*" />
+		<return type="item()*" />
+		<property type="DocumentOrder"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as 
+		node() -->
+	<operator name="opext:pi-constructor">
+		<param name="target" type="xs:string" />
+		<param name="content" type="xs:string" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:comment-constructor($content as xs:string) as node() -->
+	<operator name="opext:comment-constructor">
+		<param name="content" type="xs:string" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:element-constructor($name as xs:QName, $content as item()*) as 
+		node() -->
+	<operator name="opext:element-constructor">
+		<param name="name" type="xs:QName" />
+		<param name="content" type="item()*" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:array-constructor($expression as node()) as node() -->
+	<operator name="opext:array-constructor">
+		<param name="expession" type="node()" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.ArrayNodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) 
+		as node() -->
+	<operator name="opext:attribute-constructor">
+		<param name="name" type="xs:QName" />
+		<param name="content" type="xs:anyAtomicType*" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:text-constructor($content as xs:anyAtomicType*) as node() -->
+	<operator name="opext:text-constructor">
+		<param name="content" type="xs:anyAtomicType*" />
+		<return type="node()" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:document-constructor($content as node()) as node() -->
+	<operator name="opext:document-constructor">
+		<param name="content" type="node()" />
+		<return type="node()" />
+	</operator>
+
+	<!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else 
+		as item()*) as item()* -->
+	<operator name="opext:if-then-else">
+		<param name="condition" type="xs:boolean" />
+		<param name="then" type="item()*" />
+		<param name="else" type="item()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory" />
+		<return type="item()*" />
+	</operator>
+
+	<!-- opext:ancestor($arg as node()*) as node()* -->
+	<operator name="opext:ancestor">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+	</operator>
+
+	<!-- opext:ancestor-or-self($arg as node()*) as node()* -->
+	<operator name="opext:ancestor-or-self">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+	</operator>
+
+	<!-- opext:attribute($arg as node()*) as node()* -->
+	<operator name="opext:attribute">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory" />
+	</operator>
+
+	<!-- opext:child($arg as node()*) as node()* -->
+	<operator name="opext:child">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory" />
+		<runtime type="unnesting"
+			class="org.apache.vxquery.runtime.functions.step.ChildPathStepUnnestingEvaluatorFactory" />
+		<property type="DocumentOrder"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+			<argument value="0" />
+		</property>
+	</operator>
+
+	<!-- opext:descendant($arg as node()*) as node()* -->
+	<operator name="opext:descendant">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.step.DescendantPathStepScalarEvaluatorFactory" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy" />
+	</operator>
+
+	<!-- opext:descendant-or-self($arg as node()*) as node()* -->
+	<operator name="opext:descendant-or-self">
+		<param name="arg" type="node()*" />
+		<return type="node()*" />
+		<runtime type="scalar"
+			class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepScalarEvaluatorFactory" />
+		<runtime type="unnesting"
+			class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepUnnestingEvaluatorFactory" />
+		<property type="UniqueNodes"
+			class="org.apache.vxquery.compiler.rewri

<TRUNCATED>

[07/19] vxquery git commit: changing format

Posted by pr...@apache.org.
changing format


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/426da4be
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/426da4be
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/426da4be

Branch: refs/heads/master
Commit: 426da4beebe1c6edc4762e6beef66382e5f3577b
Parents: c292e45
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Fri Jun 3 17:32:01 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Fri Jun 3 17:32:01 2016 -0700

----------------------------------------------------------------------
 vxquery-core/src/main/javacc/xquery-grammar.jj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/426da4be/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 7ea478c..de1272b 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -2460,7 +2460,7 @@ ASTNode ArrayConstructor()  :
     Token start;
 }
 {
-    (start="[") expr = Expr() "]" {
+    (start = "[") expr = Expr() "]" {
         ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
         an.setExpression(expr);
         return an;


[08/19] vxquery git commit: Working on array runtime constructor

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
new file mode 100644
index 0000000..cadf2b9
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
@@ -0,0 +1,68 @@
+/*
+ * 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.node;
+
+import java.io.IOException;
+
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IMutableValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.builders.jsonitem.ArrayBuilder;
+import org.apache.vxquery.datamodel.builders.nodes.DictionaryBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.exceptions.SystemException;
+
+public class ArrayNodeConstructorScalarEvaluator extends AbstractNodeConstructorScalarEvaluator {
+    private final ArrayBuilder ab;
+
+    private final SequencePointable sp;
+
+    public ArrayNodeConstructorScalarEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) {
+        super(ctx, args);
+        ab = new ArrayBuilder();
+        sp = (SequencePointable) SequencePointable.FACTORY.createPointable();
+    }
+
+    @Override
+    protected void constructNode(DictionaryBuilder db, TaggedValuePointable[] args, IMutableValueStorage mvs)
+            throws IOException, SystemException {
+        ab.reset(mvs);
+        TaggedValuePointable arg = args[0];
+        TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class);
+        if (arg.getTag() == ValueTag.SEQUENCE_TAG) {
+            arg.getValue(sp);
+            for (int i = 0; i < sp.getEntryCount(); ++i) {
+                sp.getEntry(i, tempTvp);
+                ab.addItem(tempTvp);
+            }
+            ppool.giveBack(tempTvp);
+        }
+
+        ab.finish();
+    }
+
+    @Override
+    protected boolean createsDictionary() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
new file mode 100644
index 0000000..e32034c
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.node;
+
+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.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
+
+public class ArrayNodeConstructorScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
+    private static final long serialVersionUID = 1L;
+
+    public ArrayNodeConstructorScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
+        super(args);
+    }
+
+    @Override
+    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
+            throws AlgebricksException {
+        return new ArrayNodeConstructorScalarEvaluator(ctx, args);
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
index 5c55731..b980bd6 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
@@ -32,6 +32,7 @@ import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSTimePointable;
+import org.apache.vxquery.datamodel.accessors.jsonitem.ArrayPointable;
 import org.apache.vxquery.datamodel.accessors.nodes.AttributeNodePointable;
 import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
 import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
@@ -220,6 +221,10 @@ public class XMLSerializer implements IPrinter {
                 printElementNode(ps, tvp);
                 break;
 
+            case ValueTag.ARRAY_TAG:
+                printArrayNode(ps, tvp);
+                break;
+
             case ValueTag.ATTRIBUTE_NODE_TAG:
                 printAttributeNode(ps, tvp);
                 break;
@@ -441,6 +446,34 @@ public class XMLSerializer implements IPrinter {
         }
     }
 
+    private void printArrayNode(PrintStream ps, TaggedValuePointable tvp) {
+        ArrayPointable ap = pp.takeOne(ArrayPointable.class);
+        SequencePointable seqp = pp.takeOne(SequencePointable.class);
+
+        try {
+            tvp.getValue(ap);
+            if (tvp.getTag() == ValueTag.ARRAY_TAG) {
+                tvp.getValue(ap);
+                int len = ap.getEntryCount();
+                ps.append('[');
+
+                for (int i = 0; i < len; i++) {
+                    ap.getEntry(i, tvp);
+                    print(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength(), ps);
+                    if (i != len - 1) {
+                        ps.append(',');
+                    }
+                }
+                ps.append(']');
+            }
+
+        } finally {
+            pp.giveBack(ap);
+            pp.giveBack(seqp);
+            pp.giveBack(tvp);
+        }
+    }
+
     private void printBase64Binary(PrintStream ps, TaggedValuePointable tvp) {
         XSBinaryPointable bp = pp.takeOne(XSBinaryPointable.class);
         try {

http://git-wip-us.apache.org/repos/asf/vxquery/blob/47442458/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
index 19ba276..d684e34 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
@@ -98,6 +98,7 @@ import org.apache.vxquery.types.TextType;
 import org.apache.vxquery.types.TypeUtils;
 import org.apache.vxquery.xmlquery.ast.ASTNode;
 import org.apache.vxquery.xmlquery.ast.ASTTag;
+import org.apache.vxquery.xmlquery.ast.ArrayConstructorNode;
 import org.apache.vxquery.xmlquery.ast.AtomicTypeNode;
 import org.apache.vxquery.xmlquery.ast.AttributeTestNode;
 import org.apache.vxquery.xmlquery.ast.AxisStepNode;
@@ -818,6 +819,11 @@ public class XMLQueryTranslator {
                 return translateComputedElementConstructorNode(tCtx, cNode);
             }
 
+            case ARRAY_CONSTRUCTOR: {
+                ArrayConstructorNode aNode = (ArrayConstructorNode) value;
+                return translateArrayConstructorNode(tCtx, aNode);
+            }
+
             case COMPUTED_ATTRIBUTE_CONSTRUCTOR: {
                 ComputedAttributeConstructorNode cNode = (ComputedAttributeConstructorNode) value;
                 return translateComputedAttributeConstructorNode(tCtx, cNode);
@@ -971,6 +977,16 @@ public class XMLQueryTranslator {
         return lVar;
     }
 
+    private LogicalVariable translateArrayConstructorNode(TranslationContext tCtx, ArrayConstructorNode aNode)
+            throws SystemException {
+        ILogicalExpression name = vre(translateExpression(aNode.getExpression(), tCtx));
+        ASTNode expression = aNode.getExpression();
+        ILogicalExpression aExpr = expression == null ? sfce(BuiltinOperators.CONCATENATE)
+                : vre(translateExpression(expression, tCtx));
+        LogicalVariable lVar = createAssignment(sfce(BuiltinOperators.ARRAY_CONSTRUCTOR, name, aExpr), tCtx);
+        return lVar;
+    }
+
     private LogicalVariable translateComputedDocumentConstructorNode(TranslationContext tCtx,
             ComputedDocumentConstructorNode cNode) throws SystemException {
         LogicalVariable lVar = createAssignment(


[04/19] vxquery git commit: Adding ArrayConstructorNode

Posted by pr...@apache.org.
Adding ArrayConstructorNode


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/609930ef
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/609930ef
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/609930ef

Branch: refs/heads/master
Commit: 609930efbde8acec20f4baf8f5bb4cd929285d3e
Parents: beff6de
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Thu Jun 2 16:47:33 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Thu Jun 2 16:47:33 2016 -0700

----------------------------------------------------------------------
 .../xmlquery/ast/ArrayConstructorNode.java      | 40 +++++++++++++++++
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 45 +++++++++++---------
 2 files changed, 64 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/609930ef/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
new file mode 100644
index 0000000..cf034a3
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
@@ -0,0 +1,40 @@
+/*
+* 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.xmlquery.ast;
+
+import org.apache.vxquery.util.SourceLocation;
+
+public class ArrayConstructorNode extends ASTNode {
+    private ASTNode expression;
+
+    public ArrayConstructorNode(SourceLocation loc) {
+        super(loc);
+    }
+
+    @Override
+    public ASTTag getTag() {
+        return ASTTag.ARRAY_CONSTRUCTOR;
+    }
+
+    public ASTNode getExpression() {
+        return expression;
+    }
+
+    public void setExpression(ASTNode expression) {
+        this.expression = expression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/609930ef/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 4db964a..a1d9de9 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -1937,27 +1937,6 @@ ASTNode FunctionCall()  :
     }
 }
 
-ASTNode JsonConstructor()  :
-{
-    ASTNode result;
-}
-{
-    result = ArrayConstructor()
-    {
-		return result;
-	}
-}
-
-ASTNode ArrayConstructor()  :
-{
-	ASTNode expr;
-}
-{
-	"[" expr=Expr() "]" {
-		return expr;
-	}
-}
-
 ASTNode Constructor()  :
 {
     ASTNode result;
@@ -2464,6 +2443,30 @@ ASTNode CompPIConstructor()  :
     }
 }
 
+ASTNode JsonConstructor()  :
+{
+    ASTNode result;
+}
+{
+    result = ArrayConstructor()
+    {
+	    return result;
+	}
+}
+
+ASTNode ArrayConstructor()  :
+{
+    ASTNode expr;
+    Token start;
+}
+{
+    (start="[") expr=Expr() "]" {
+        ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
+        an.setExpression(expr);
+	    return an;
+    }
+}
+
 SingleTypeNode SingleType()  :
 {
     AtomicTypeNode type;


[15/19] vxquery git commit: Changing Array Constructor and Adding Test Cases

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluator.java
new file mode 100644
index 0000000..7386ce9
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluator.java
@@ -0,0 +1,76 @@
+/*
+ * 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.node;
+
+import java.io.IOException;
+
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+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.builders.jsonitem.ArrayBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
+
+public class ArrayConstructorScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
+    protected final IHyracksTaskContext ctx;
+
+    private final ArrayBackedValueStorage mvs;
+
+    private final ArrayBuilder ab;
+
+    private final SequencePointable sp;
+
+    public ArrayConstructorScalarEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) {
+        super(args);
+        this.ctx = ctx;
+        ab = new ArrayBuilder();
+        sp = (SequencePointable) SequencePointable.FACTORY.createPointable();
+        mvs = new ArrayBackedValueStorage();
+    }
+
+    @Override
+    protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+        mvs.reset();
+        try {
+            ab.reset(mvs);
+            TaggedValuePointable arg = args[0];
+            if (arg.getTag() == ValueTag.SEQUENCE_TAG) {
+                TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class);
+                try {
+                    arg.getValue(sp);
+                    for (int i = 0; i < sp.getEntryCount(); ++i) {
+                        sp.getEntry(i, tempTvp);
+                        ab.addItem(tempTvp);
+                    }
+                } finally {
+                    ppool.giveBack(tempTvp);
+                }
+            } else {
+                ab.addItem(arg);
+            }
+            ab.finish();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        result.set(mvs);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluatorFactory.java
new file mode 100644
index 0000000..c70a8e2
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayConstructorScalarEvaluatorFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.node;
+
+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.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
+
+public class ArrayConstructorScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
+    private static final long serialVersionUID = 1L;
+
+    public ArrayConstructorScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
+        super(args);
+    }
+
+    @Override
+    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
+            throws AlgebricksException {
+        return new ArrayConstructorScalarEvaluator(ctx, args);
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
deleted file mode 100644
index 05f4498..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.node;
-
-import java.io.IOException;
-
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IMutableValueStorage;
-import org.apache.vxquery.datamodel.accessors.SequencePointable;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.builders.jsonitem.ArrayBuilder;
-import org.apache.vxquery.datamodel.builders.nodes.DictionaryBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.exceptions.SystemException;
-
-public class ArrayNodeConstructorScalarEvaluator extends AbstractNodeConstructorScalarEvaluator {
-    private final ArrayBuilder ab;
-
-    private final SequencePointable sp;
-
-    public ArrayNodeConstructorScalarEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) {
-        super(ctx, args);
-        ab = new ArrayBuilder();
-        sp = (SequencePointable) SequencePointable.FACTORY.createPointable();
-    }
-
-    @Override
-    protected void constructNode(DictionaryBuilder db, TaggedValuePointable[] args, IMutableValueStorage mvs)
-            throws IOException, SystemException {
-        ab.reset(mvs);
-        TaggedValuePointable arg = args[0];
-        if (arg.getTag() == ValueTag.SEQUENCE_TAG) {
-            TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class);
-            try {
-                arg.getValue(sp);
-                for (int i = 0; i < sp.getEntryCount(); ++i) {
-                    sp.getEntry(i, tempTvp);
-                    ab.addItem(tempTvp);
-                }
-            } finally {
-                ppool.giveBack(tempTvp);
-            }
-        } else {
-            ab.addItem(arg);
-        }
-        ab.finish();
-    }
-
-    @Override
-    protected boolean createsDictionary() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
deleted file mode 100644
index e32034c..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluatorFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.node;
-
-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.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-
-public class ArrayNodeConstructorScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
-    private static final long serialVersionUID = 1L;
-
-    public ArrayNodeConstructorScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
-        super(args);
-    }
-
-    @Override
-    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
-        return new ArrayNodeConstructorScalarEvaluator(ctx, args);
-    }
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
index 9e1b663..8b83995 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
@@ -222,7 +222,7 @@ public class XMLSerializer implements IPrinter {
                 break;
 
             case ValueTag.ARRAY_TAG:
-                printArrayNode(ps, tvp);
+                printArray(ps, tvp);
                 break;
 
             case ValueTag.ATTRIBUTE_NODE_TAG:
@@ -446,28 +446,22 @@ public class XMLSerializer implements IPrinter {
         }
     }
 
-    private void printArrayNode(PrintStream ps, TaggedValuePointable tvp) {
+    private void printArray(PrintStream ps, TaggedValuePointable tvp) {
         ArrayPointable ap = pp.takeOne(ArrayPointable.class);
-
         try {
             tvp.getValue(ap);
-            if (tvp.getTag() == ValueTag.ARRAY_TAG) {
-                tvp.getValue(ap);
-                int len = ap.getEntryCount();
-                ps.append('[');
-                ps.append(' ');
-                for (int i = 0; i < len; i++) {
-                    ap.getEntry(i, tvp);
-                    print(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength(), ps);
-                    if (i != len - 1) {
-                        ps.append(',');
-                        ps.append(' ');
-                    }
+            int len = ap.getEntryCount();
+            ps.append('[');
+            ps.append(' ');
+            for (int i = 0; i < len; i++) {
+                ap.getEntry(i, tvp);
+                print(tvp.getByteArray(), tvp.getStartOffset(), tvp.getLength(), ps);
+                if (i != len - 1) {
+                    ps.append(',');
                 }
                 ps.append(' ');
-                ps.append(']');
             }
-
+            ps.append(']');
         } finally {
             pp.giveBack(ap);
             pp.giveBack(tvp);

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructor.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructor.java
new file mode 100644
index 0000000..65ec6b6
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructor.java
@@ -0,0 +1,40 @@
+/*
+* 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.xmlquery.ast;
+
+import org.apache.vxquery.util.SourceLocation;
+
+public class ArrayConstructor extends ASTNode {
+    private ASTNode expression;
+
+    public ArrayConstructor(SourceLocation loc) {
+        super(loc);
+    }
+
+    @Override
+    public ASTTag getTag() {
+        return ASTTag.ARRAY_CONSTRUCTOR;
+    }
+
+    public ASTNode getExpression() {
+        return expression;
+    }
+
+    public void setExpression(ASTNode expression) {
+        this.expression = expression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
deleted file mode 100644
index cf034a3..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* 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.xmlquery.ast;
-
-import org.apache.vxquery.util.SourceLocation;
-
-public class ArrayConstructorNode extends ASTNode {
-    private ASTNode expression;
-
-    public ArrayConstructorNode(SourceLocation loc) {
-        super(loc);
-    }
-
-    @Override
-    public ASTTag getTag() {
-        return ASTTag.ARRAY_CONSTRUCTOR;
-    }
-
-    public ASTNode getExpression() {
-        return expression;
-    }
-
-    public void setExpression(ASTNode expression) {
-        this.expression = expression;
-    }
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
index d684e34..047ffc8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
@@ -98,7 +98,7 @@ import org.apache.vxquery.types.TextType;
 import org.apache.vxquery.types.TypeUtils;
 import org.apache.vxquery.xmlquery.ast.ASTNode;
 import org.apache.vxquery.xmlquery.ast.ASTTag;
-import org.apache.vxquery.xmlquery.ast.ArrayConstructorNode;
+import org.apache.vxquery.xmlquery.ast.ArrayConstructor;
 import org.apache.vxquery.xmlquery.ast.AtomicTypeNode;
 import org.apache.vxquery.xmlquery.ast.AttributeTestNode;
 import org.apache.vxquery.xmlquery.ast.AxisStepNode;
@@ -820,8 +820,8 @@ public class XMLQueryTranslator {
             }
 
             case ARRAY_CONSTRUCTOR: {
-                ArrayConstructorNode aNode = (ArrayConstructorNode) value;
-                return translateArrayConstructorNode(tCtx, aNode);
+                ArrayConstructor aNode = (ArrayConstructor) value;
+                return translateArrayConstructor(tCtx, aNode);
             }
 
             case COMPUTED_ATTRIBUTE_CONSTRUCTOR: {
@@ -977,13 +977,12 @@ public class XMLQueryTranslator {
         return lVar;
     }
 
-    private LogicalVariable translateArrayConstructorNode(TranslationContext tCtx, ArrayConstructorNode aNode)
+    private LogicalVariable translateArrayConstructor(TranslationContext tCtx, ArrayConstructor aNode)
             throws SystemException {
-        ILogicalExpression name = vre(translateExpression(aNode.getExpression(), tCtx));
         ASTNode expression = aNode.getExpression();
         ILogicalExpression aExpr = expression == null ? sfce(BuiltinOperators.CONCATENATE)
                 : vre(translateExpression(expression, tCtx));
-        LogicalVariable lVar = createAssignment(sfce(BuiltinOperators.ARRAY_CONSTRUCTOR, name, aExpr), tCtx);
+        LogicalVariable lVar = createAssignment(sfce(BuiltinOperators.ARRAY_CONSTRUCTOR, aExpr), tCtx);
         return lVar;
     }
 

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index de1272b..6dc9865 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -2456,12 +2456,12 @@ ASTNode JsonConstructor()  :
 
 ASTNode ArrayConstructor()  :
 {
-    ASTNode expr;
+    ASTNode expr=null;
     Token start;
 }
 {
-    (start = "[") expr = Expr() "]" {
-        ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
+    (start = "[") [expr = Expr()] "]" {
+        ArrayConstructor an = new ArrayConstructor(createSourceLocation(start));
         an.setExpression(expr);
         return an;
     }

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q01_array.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q01_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q01_array.txt
new file mode 100644
index 0000000..404b10d
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q01_array.txt
@@ -0,0 +1 @@
+[ 1 ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q02_array.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q02_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q02_array.txt
new file mode 100644
index 0000000..6038e9b
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q02_array.txt
@@ -0,0 +1 @@
+[ 1, string, 3.1 ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/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
new file mode 100644
index 0000000..6330c79
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q03_array.txt
@@ -0,0 +1 @@
+[ [ 1, 2 ], [ 2, 3 ] ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q04_array.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q04_array.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q04_array.txt
new file mode 100644
index 0000000..8878e54
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Array/q04_array.txt
@@ -0,0 +1 @@
+[ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q01_object.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q01_object.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q01_object.txt
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Json/Object/q01_object.txt
@@ -0,0 +1 @@
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q01_array.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q01_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q01_array.xq
new file mode 100644
index 0000000..ecb653d
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q01_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 :)
+(: Just parse an array with a single item :)
+    [1]

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q02_array.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q02_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q02_array.xq
new file mode 100644
index 0000000..4954f21
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q02_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 :)
+(: Just parse an array with a sequence of items :)
+    [1,"string",3.1]

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/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
new file mode 100644
index 0000000..f9913be
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q03_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 :)
+(: Just parse an array with nested arrays :)
+    [[1,2],[2,3]]

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q04_array.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q04_array.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q04_array.xq
new file mode 100644
index 0000000..de1447e
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Array/q04_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 :)
+(: Just parse an empty array :)
+    []

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q01_object.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q01_object.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q01_object.xq
new file mode 100644
index 0000000..52c9044
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q01_object.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 Object Query :)
+(: Just an object example :)
+    1

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/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 f75ce49..076341e 100644
--- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
+++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
@@ -42,6 +42,9 @@
 
 <!ENTITY HDFSAggregateQueries SYSTEM "cat/HDFSAggregateQueries.xml">
 
+<!ENTITY JsonArrayQueries SYSTEM "cat/JsonArrayQueries.xml">
+<!ENTITY JsonObjectQueries SYSTEM "cat/JsonObjectQueries.xml">
+
 ]>
 <test-suite xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -208,4 +211,18 @@
         &HDFSAggregateQueries;
       </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>
+            <description/>
+         </GroupInfo>
+         &JsonArrayQueries;
+         &JsonObjectQueries;
+      </test-group>
+   </test-group>
 </test-suite>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/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
new file mode 100644
index 0000000..cfa18af
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/JsonArrayQueries.xml
@@ -0,0 +1,43 @@
+<!--
+  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 Array</title>
+      <description/>
+   </GroupInfo>
+   <test-case name="json-array-q01" FilePath="Json/Array/" Creator="Christina Pavlopoulou">
+      <description>Array with a single item.</description>
+      <query name="q01_array" date="2016-06-09"/>
+      <output-file compare="Text">q01_array.txt</output-file>
+   </test-case>
+   <test-case name="json-array-q02" FilePath="Json/Array/" Creator="Christina Pavlopoulou">
+      <description>Array with a sequence of items.</description>
+      <query name="q02_array" date="2016-06-09"/>
+      <output-file compare="Text">q02_array.txt</output-file>
+   </test-case>
+   <test-case name="json-array-q03" FilePath="Json/Array/" Creator="Christina Pavlopoulou">
+      <description>Array with a sequence of items.</description>
+      <query name="q03_array" date="2016-06-09"/>
+      <output-file compare="Text">q03_array.txt</output-file>
+   </test-case>
+    <test-case name="json-array-q04" FilePath="Json/Array/" Creator="Christina Pavlopoulou">
+      <description>Empty array.</description>
+      <query name="q04_array" date="2016-06-09"/>
+      <output-file compare="Text">q04_array.txt</output-file>
+   </test-case>
+</test-group>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/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
new file mode 100644
index 0000000..dcdf6e6
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml
@@ -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.
+-->
+
+<test-group xmlns="http://www.w3.org/2005/02/query-test-XQTSCatalog" name="JsonObjectQueries" featureOwner="VXQuery">
+   <GroupInfo>
+      <title>Json Object</title>
+      <description/>
+   </GroupInfo>
+   <test-case name="json-object-q01" FilePath="Json/Object/" Creator="Christina Pavlopoulou">
+      <description>Object.</description>
+      <query name="q01_object" date="2016-06-09"/>
+      <output-file compare="Text">q01_object.txt</output-file>
+   </test-case>
+</test-group>
\ No newline at end of file


[18/19] vxquery git commit: merge master

Posted by pr...@apache.org.
merge master


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/bf475170
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/bf475170
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/bf475170

Branch: refs/heads/master
Commit: bf475170f4f86532dc0cf1b679a17080e423eb00
Parents: bb1fa8e
Author: Preston Carman <pr...@apache.org>
Authored: Thu Jun 9 20:25:36 2016 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Jun 9 20:25:36 2016 -0700

----------------------------------------------------------------------
 pom.xml                                         |  41 +-
 vxquery-core/pom.xml                            |  31 +-
 .../accessors/jsonItem/ObjectPointable.java     | 126 ---
 .../accessors/jsonitem/ArrayPointable.java      |  16 +
 .../accessors/jsonitem/ObjectPointable.java     | 126 +++
 .../builders/jsonItem/ObjectBuilder.java        |  39 -
 .../builders/jsonitem/AbstractJsonBuilder.java  |  16 +
 .../builders/jsonitem/ArrayBuilder.java         |  16 +
 .../builders/jsonitem/ObjectBuilder.java        |  39 +
 .../vxquery/functions/builtin-functions.xml     |  22 +
 .../apache/vxquery/index/IndexAttributes.java   | 287 ++++++
 .../vxquery/index/IndexDocumentBuilder.java     | 882 +++++++++++++++++++
 .../org/apache/vxquery/index/IndexElement.java  |  42 +
 .../VXQueryCollectionOperatorDescriptor.java    |  81 +-
 .../functions/index/CaseSensitiveAnalyzer.java  | 144 +++
 .../index/CaseSensitiveQueryParser.java         |  42 +
 ...ctionFromIndexUnnestingEvaluatorFactory.java | 327 +++++++
 .../IndexConstructorScalarEvaluatorFactory.java |  70 ++
 .../functions/index/IndexConstructorUtil.java   | 144 +++
 .../runtime/functions/util/FunctionHelper.java  |   7 +-
 .../vxquery/xmlparser/SAXContentHandler.java    |  72 +-
 .../org/apache/vxquery/xmlparser/XMLParser.java |   2 +-
 .../apache/vxquery/datamodel/ArrayByteTest.java |  16 +
 .../java/org/apache/vxquery/xtest/MiniDFS.java  |   7 +-
 .../org/apache/vxquery/xtest/VXQueryTest.java   |  53 +-
 .../Indexing/createIndex.txt                    |   0
 .../ExpectedTestResults/Indexing/useIndex1.txt  |   2 +
 .../ExpectedTestResults/Indexing/useIndex2.txt  |   1 +
 .../ExpectedTestResults/Indexing/useIndex3.txt  |   1 +
 .../ExpectedTestResults/Indexing/useIndex4.txt  |   1 +
 .../ExpectedTestResults/Indexing/useIndex5.txt  |   3 +
 .../ExpectedTestResults/Indexing/useIndex6.txt  |   2 +
 .../ExpectedTestResults/Indexing/useIndex7.txt  |   3 +
 .../Queries/XQuery/Indexing/createIndex.xq      |  20 +
 .../Queries/XQuery/Indexing/useIndex1.xq        |  25 +
 .../Queries/XQuery/Indexing/useIndex2.xq        |  24 +
 .../Queries/XQuery/Indexing/useIndex3.xq        |  27 +
 .../Queries/XQuery/Indexing/useIndex4.xq        |  24 +
 .../Queries/XQuery/Indexing/useIndex5.xq        |  23 +
 .../Queries/XQuery/Indexing/useIndex6.xq        |  23 +
 .../Queries/XQuery/Indexing/useIndex7.xq        |  27 +
 .../src/test/resources/VXQueryCatalog.xml       |  17 +-
 .../src/test/resources/cat/IndexingQueries.xml  |  63 ++
 43 files changed, 2649 insertions(+), 285 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dd51adf..a082505 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,10 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -475,20 +478,20 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-assembly-plugin</artifactId>
-                <!-- We override the configuration plugin to override the descriptor 
-                    to use for building the source release zip. Specifically, we would like to 
-                    control the inclusions/exclusions. For example, we exclude the KEYS file 
+                <!-- We override the configuration plugin to override the descriptor
+                    to use for building the source release zip. Specifically, we would like to
+                    control the inclusions/exclusions. For example, we exclude the KEYS file
                     from the zip -->
                 <executions>
                     <execution>
-                        <!-- Use this id to match the id mentioned in the assembly plugin configuration 
+                        <!-- Use this id to match the id mentioned in the assembly plugin configuration
                             in the apache parent POM under the apache-release profile -->
                         <id>source-release-assembly</id>
                         <phase>package</phase>
                         <goals>
                             <goal>single</goal>
                         </goals>
-                        <!-- combine.self should be override to replace the configuration in 
+                        <!-- combine.self should be override to replace the configuration in
                             the parent POM -->
                         <configuration combine.self="override">
                             <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
@@ -550,6 +553,30 @@
                 </executions>
             </plugin>
             <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <version>0.11</version>
+                <executions>
+                    <execution>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <excludes>
+                        <exclude>.gitignore</exclude>
+                        <exclude>.rat-excludes</exclude>
+                        <exclude>.project</exclude>
+                        <exclude>.classpath</exclude>
+                        <exclude>.basex</exclude>
+                        <exclude>**/ExpectedTestResults/**</exclude>
+                        <exclude>**/xqts.txt</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
             </plugin>
@@ -626,7 +653,7 @@
                     <maxmemory>2g</maxmemory>
                 </configuration>
             </plugin>
-            
+
         </plugins>
     </reporting>
 

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/pom.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/pom.xml b/vxquery-core/pom.xml
index d8f5f53..56eb45f 100644
--- a/vxquery-core/pom.xml
+++ b/vxquery-core/pom.xml
@@ -266,7 +266,36 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-
+        <dependency>
+            <artifactId>lucene-core</artifactId>
+            <groupId>org.apache.lucene</groupId>
+            <type>jar</type>
+            <version>5.5.1</version>
+        </dependency>
+        <dependency>
+            <artifactId>lucene-queryparser</artifactId>
+            <groupId>org.apache.lucene</groupId>
+            <type>jar</type>
+            <version>5.5.1</version>
+        </dependency>
+        <dependency>
+            <artifactId>lucene-analyzers-common</artifactId>
+            <groupId>org.apache.lucene</groupId>
+            <type>jar</type>
+            <version>5.5.1</version>
+        </dependency>
+        <dependency>
+            <artifactId>lucene-demo</artifactId>
+            <groupId>org.apache.lucene</groupId>
+            <type>jar</type>
+            <version>5.5.1</version>
+        </dependency>
+        <dependency>
+            <artifactId>lucene-backward-codecs</artifactId>
+            <groupId>org.apache.lucene</groupId>
+            <type>jar</type>
+            <version>5.5.1</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-mapreduce-client-core</artifactId>

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonItem/ObjectPointable.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonItem/ObjectPointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonItem/ObjectPointable.java
deleted file mode 100644
index 9c714ec..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonItem/ObjectPointable.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.datamodel.accessors.jsonitem;
-
-import java.io.IOException;
-
-import org.apache.hyracks.api.dataflow.value.ITypeTraits;
-import org.apache.hyracks.data.std.api.AbstractPointable;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.api.IPointableFactory;
-import org.apache.hyracks.data.std.primitive.IntegerPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.runtime.functions.util.FunctionHelper;
-
-/**
- * The datamodel of the JSON object is represented in this class:
- * Byte 1: Value tag of object (109)
- * Byte 2 to 5: number of key-value pairs in the object
- * Next few bytes: Offsets for each key-value pair in the object in the order appearing in the json data
- * Next bytes: The keys in the object each followed by the value of the key. Each key is a StringPointable and the value
- * of the key will be the respective pointable starting with its valuetag.
- */
-public class ObjectPointable extends AbstractPointable {
-    public static final IPointableFactory FACTORY = new IPointableFactory() {
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public ITypeTraits getTypeTraits() {
-            return VoidPointable.TYPE_TRAITS;
-        }
-
-        @Override
-        public IPointable createPointable() {
-            return new ObjectPointable();
-        }
-    };
-    private static final int ENTRY_COUNT_SIZE = IntegerPointable.TYPE_TRAITS.getFixedLength();
-    private static final int SLOT_SIZE = IntegerPointable.TYPE_TRAITS.getFixedLength();
-    private final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
-    private final SequenceBuilder sb = new SequenceBuilder();
-    private final UTF8StringPointable key = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
-
-    private static int getSlotValue(byte[] bytes, int start, int idx) {
-        return IntegerPointable.getInteger(bytes, getSlotArrayOffset(start) + idx * SLOT_SIZE);
-    }
-
-    private static int getEntryCount(byte[] bytes, int start) {
-        return IntegerPointable.getInteger(bytes, start);
-    }
-
-    private static int getKeyLength(byte[] b, int s) {
-        return UTF8StringPointable.getUTFLength(b, s) + 2;
-    }
-
-    private static int getSlotArrayOffset(int start) {
-        return start + ENTRY_COUNT_SIZE;
-    }
-
-    private static int getDataAreaOffset(byte[] bytes, int start) {
-        return getSlotArrayOffset(start) + getEntryCount(bytes, start) * SLOT_SIZE;
-    }
-
-    public void getKeys(IPointable result) throws IOException {
-        abvs.reset();
-        sb.reset(abvs);
-        int dataAreaOffset = getDataAreaOffset(bytes, start);
-        int entryCount = getEntryCount();
-        int s;
-        for (int i = 0; i < entryCount; i++) {
-            s = dataAreaOffset + getRelativeEntryStartOffset(i);
-            key.set(bytes, s, getKeyLength(bytes, s));
-            sb.addItem(ValueTag.XS_STRING_TAG, key);
-        }
-        sb.finish();
-        result.set(abvs);
-    }
-
-    public boolean getValue(UTF8StringPointable key, IPointable result) {
-        int dataAreaOffset = getDataAreaOffset(bytes, start);
-        int entryCount = getEntryCount();
-        int start;
-        int length;
-        int i;
-        for (i = 0; i < entryCount; i++) {
-            start = dataAreaOffset + getRelativeEntryStartOffset(i);
-            length = getKeyLength(bytes, start);
-            if (FunctionHelper.arraysEqual(bytes, start, length, key.getByteArray(), key.getStartOffset(),
-                    key.getLength())) {
-                result.set(bytes, start + length, getEntryLength(i) - length);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private int getRelativeEntryStartOffset(int idx) {
-        return idx == 0 ? 0 : getSlotValue(bytes, start, idx - 1);
-    }
-
-    private int getEntryLength(int idx) {
-        return getSlotValue(bytes, start, idx) - getRelativeEntryStartOffset(idx);
-    }
-
-    public int getEntryCount() {
-        return getEntryCount(bytes, start);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ArrayPointable.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ArrayPointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ArrayPointable.java
index 0b15604..462b4d6 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ArrayPointable.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ArrayPointable.java
@@ -1,3 +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.
+ */
 package org.apache.vxquery.datamodel.accessors.jsonitem;
 
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ObjectPointable.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ObjectPointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ObjectPointable.java
new file mode 100644
index 0000000..9c714ec
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ObjectPointable.java
@@ -0,0 +1,126 @@
+/*
+ * 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.datamodel.accessors.jsonitem;
+
+import java.io.IOException;
+
+import org.apache.hyracks.api.dataflow.value.ITypeTraits;
+import org.apache.hyracks.data.std.api.AbstractPointable;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.api.IPointableFactory;
+import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
+
+/**
+ * The datamodel of the JSON object is represented in this class:
+ * Byte 1: Value tag of object (109)
+ * Byte 2 to 5: number of key-value pairs in the object
+ * Next few bytes: Offsets for each key-value pair in the object in the order appearing in the json data
+ * Next bytes: The keys in the object each followed by the value of the key. Each key is a StringPointable and the value
+ * of the key will be the respective pointable starting with its valuetag.
+ */
+public class ObjectPointable extends AbstractPointable {
+    public static final IPointableFactory FACTORY = new IPointableFactory() {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public ITypeTraits getTypeTraits() {
+            return VoidPointable.TYPE_TRAITS;
+        }
+
+        @Override
+        public IPointable createPointable() {
+            return new ObjectPointable();
+        }
+    };
+    private static final int ENTRY_COUNT_SIZE = IntegerPointable.TYPE_TRAITS.getFixedLength();
+    private static final int SLOT_SIZE = IntegerPointable.TYPE_TRAITS.getFixedLength();
+    private final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
+    private final SequenceBuilder sb = new SequenceBuilder();
+    private final UTF8StringPointable key = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
+
+    private static int getSlotValue(byte[] bytes, int start, int idx) {
+        return IntegerPointable.getInteger(bytes, getSlotArrayOffset(start) + idx * SLOT_SIZE);
+    }
+
+    private static int getEntryCount(byte[] bytes, int start) {
+        return IntegerPointable.getInteger(bytes, start);
+    }
+
+    private static int getKeyLength(byte[] b, int s) {
+        return UTF8StringPointable.getUTFLength(b, s) + 2;
+    }
+
+    private static int getSlotArrayOffset(int start) {
+        return start + ENTRY_COUNT_SIZE;
+    }
+
+    private static int getDataAreaOffset(byte[] bytes, int start) {
+        return getSlotArrayOffset(start) + getEntryCount(bytes, start) * SLOT_SIZE;
+    }
+
+    public void getKeys(IPointable result) throws IOException {
+        abvs.reset();
+        sb.reset(abvs);
+        int dataAreaOffset = getDataAreaOffset(bytes, start);
+        int entryCount = getEntryCount();
+        int s;
+        for (int i = 0; i < entryCount; i++) {
+            s = dataAreaOffset + getRelativeEntryStartOffset(i);
+            key.set(bytes, s, getKeyLength(bytes, s));
+            sb.addItem(ValueTag.XS_STRING_TAG, key);
+        }
+        sb.finish();
+        result.set(abvs);
+    }
+
+    public boolean getValue(UTF8StringPointable key, IPointable result) {
+        int dataAreaOffset = getDataAreaOffset(bytes, start);
+        int entryCount = getEntryCount();
+        int start;
+        int length;
+        int i;
+        for (i = 0; i < entryCount; i++) {
+            start = dataAreaOffset + getRelativeEntryStartOffset(i);
+            length = getKeyLength(bytes, start);
+            if (FunctionHelper.arraysEqual(bytes, start, length, key.getByteArray(), key.getStartOffset(),
+                    key.getLength())) {
+                result.set(bytes, start + length, getEntryLength(i) - length);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private int getRelativeEntryStartOffset(int idx) {
+        return idx == 0 ? 0 : getSlotValue(bytes, start, idx - 1);
+    }
+
+    private int getEntryLength(int idx) {
+        return getSlotValue(bytes, start, idx) - getRelativeEntryStartOffset(idx);
+    }
+
+    public int getEntryCount() {
+        return getEntryCount(bytes, start);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonItem/ObjectBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonItem/ObjectBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonItem/ObjectBuilder.java
deleted file mode 100644
index 000110a..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonItem/ObjectBuilder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.datamodel.builders.jsonitem;
-
-import java.io.IOException;
-
-import org.apache.hyracks.data.std.api.IValueReference;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.vxquery.datamodel.builders.base.IBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-
-public class ObjectBuilder extends AbstractJsonBuilder implements IBuilder {
-
-    @Override
-    public int getValueTag() {
-        return ValueTag.OBJECT_TAG;
-    }
-
-    public void addItem(UTF8StringPointable key, IValueReference value) throws IOException {
-        dataArea.getDataOutput().write(key.getByteArray(), key.getStartOffset(), key.getLength());
-        dataArea.getDataOutput().write(value.getByteArray(), value.getStartOffset(), value.getLength());
-        slots.append(dataArea.getLength());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/AbstractJsonBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/AbstractJsonBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/AbstractJsonBuilder.java
index e5a11ed..75534c3 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/AbstractJsonBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/AbstractJsonBuilder.java
@@ -1,3 +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.
+ */
 package org.apache.vxquery.datamodel.builders.jsonitem;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ArrayBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ArrayBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ArrayBuilder.java
index 4ef642f..970071d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ArrayBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ArrayBuilder.java
@@ -1,3 +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.
+ */
 package org.apache.vxquery.datamodel.builders.jsonitem;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ObjectBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ObjectBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ObjectBuilder.java
new file mode 100644
index 0000000..000110a
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/jsonitem/ObjectBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.datamodel.builders.jsonitem;
+
+import java.io.IOException;
+
+import org.apache.hyracks.data.std.api.IValueReference;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.vxquery.datamodel.builders.base.IBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+
+public class ObjectBuilder extends AbstractJsonBuilder implements IBuilder {
+
+    @Override
+    public int getValueTag() {
+        return ValueTag.OBJECT_TAG;
+    }
+
+    public void addItem(UTF8StringPointable key, IValueReference value) throws IOException {
+        dataArea.getDataOutput().write(key.getByteArray(), key.getStartOffset(), key.getLength());
+        dataArea.getDataOutput().write(value.getByteArray(), value.getStartOffset(), value.getLength());
+        slots.append(dataArea.getLength());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/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 3b9371d..8379ccf 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
@@ -128,6 +128,28 @@
         <!-- Collection operator is added during the rewrite rules phase.  -->
     </function>
     
+    <!-- fn:build-index-on-collection($arg  as xs:string?, $indexFolder  as xs:string?) as  node()* -->
+    <function name="fn:build-index-on-collection">
+        <param name="collection-folder" type="xs:string?"/>
+        <param name="index-folder" type="xs:string?"/>
+        <return type="node()*"/> 
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.index.IndexConstructorScalarEvaluatorFactory"/>
+    </function>
+    
+    <!-- fn:collection-from-index($indexfolder  as xs:string?, $elementpath as xs:string?) as  node()* -->
+    <function name="fn:collection-from-index">
+        <param name="index-folder" type="xs:string?"/>
+        <param name="element-path" type="xs:string?"/>
+        <return type="node()*"/> 
+         <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.index.CollectionFromIndexUnnestingEvaluatorFactory"/>
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
+        </property>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
+        </property>
+    </function>
+    
     <!-- fn:collection-with-tag($arg1  as xs:string?, $arg2 as xs:string?) as  node()* -->
     <function name="fn:collection-with-tag">
         <param name="arg1" type="xs:string?"/>

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/index/IndexAttributes.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/index/IndexAttributes.java b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexAttributes.java
new file mode 100644
index 0000000..cf8e3c0
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexAttributes.java
@@ -0,0 +1,287 @@
+/*
+ * 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.index;
+
+import java.util.List;
+
+import org.xml.sax.Attributes;
+
+public class IndexAttributes implements Attributes {
+    int length;
+
+    List<String> names;
+    List<String> values;
+    List<String> uris;
+    List<String> localnames;
+    List<String> types;
+    List<String> qnames;
+
+    public IndexAttributes(List<String> n, List<String> v, List<String> u, List<String> l, List<String> t,
+            List<String> q) {
+        length = n.size();
+        names = n;
+        values = v;
+        uris = u;
+        localnames = l;
+        types = t;
+        qnames = q;
+    }
+
+    /**
+     * Return the number of attributes in the list.
+     * <p>
+     * Once you know the number of attributes, you can iterate through the list.
+     * </p>
+     * 
+     * @return The number of attributes in the list.
+     * @see #getURI(int)
+     * @see #getLocalName(int)
+     * @see #getQName(int)
+     * @see #getType(int)
+     * @see #getValue(int)
+     */
+    @Override
+    public int getLength() {
+        return length;
+    }
+
+    /**
+     * Look up an attribute's Namespace URI by index.
+     * 
+     * @param index
+     *            The attribute index (zero-based).
+     * @return The Namespace URI, or the empty string if none
+     *         is available, or null if the index is out of
+     *         range.
+     * @see #getLength
+     */
+    @Override
+    public String getURI(int index) {
+        return uris.get(index);
+    }
+
+    /**
+     * Look up an attribute's local name by index.
+     * 
+     * @param index
+     *            The attribute index (zero-based).
+     * @return The local name, or the empty string if Namespace
+     *         processing is not being performed, or null
+     *         if the index is out of range.
+     * @see #getLength
+     */
+    @Override
+    public String getLocalName(int index) {
+        return localnames.get(index);
+    }
+
+    /**
+     * Look up an attribute's XML qualified (prefixed) name by index.
+     * 
+     * @param index
+     *            The attribute index (zero-based).
+     * @return The XML qualified name, or the empty string
+     *         if none is available, or null if the index
+     *         is out of range.
+     * @see #getLength
+     */
+    @Override
+    public String getQName(int index) {
+        return qnames.get(index);
+    }
+
+    /**
+     * Look up an attribute's type by index.
+     * <p>
+     * The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
+     * "ENTITIES", or "NOTATION" (always in upper case).
+     * </p>
+     * <p>
+     * If the parser has not read a declaration for the attribute, or if the parser does not report attribute types,
+     * then it must return the value "CDATA" as stated in the XML 1.0 Recommendation (clause 3.3.3,
+     * "Attribute-Value Normalization").
+     * </p>
+     * <p>
+     * For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
+     * </p>
+     * 
+     * @param index
+     *            The attribute index (zero-based).
+     * @return The attribute's type as a string, or null if the
+     *         index is out of range.
+     * @see #getLength
+     */
+    @Override
+    public String getType(int index) {
+        return types.get(index);
+    }
+
+    /**
+     * Look up an attribute's value by index.
+     * <p>
+     * If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into
+     * a single string with each token separated by a single space.
+     * </p>
+     * 
+     * @param index
+     *            The attribute index (zero-based).
+     * @return The attribute's value as a string, or null if the
+     *         index is out of range.
+     * @see #getLength
+     */
+    @Override
+    public String getValue(int index) {
+        return values.get(index);
+    }
+
+    ////////////////////////////////////////////////////////////////////
+    // Name-based query.
+    ////////////////////////////////////////////////////////////////////
+
+    /**
+     * Look up the index of an attribute by Namespace name.
+     * 
+     * @param uri
+     *            The Namespace URI, or the empty string if
+     *            the name has no Namespace URI.
+     * @param localName
+     *            The attribute's local name.
+     * @return The index of the attribute, or -1 if it does not
+     *         appear in the list.
+     */
+    @Override
+    public int getIndex(String uri, String localName) {
+        for (int i = 0; i < length; i++) {
+            if (localnames.get(i).equals(localName) && uris.get(i).equals(uri)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Look up the index of an attribute by XML qualified (prefixed) name.
+     * 
+     * @param qName
+     *            The qualified (prefixed) name.
+     * @return The index of the attribute, or -1 if it does not
+     *         appear in the list.
+     */
+    @Override
+    public int getIndex(String qName) {
+        for (int i = 0; i < length; i++) {
+            if (qnames.get(i).equals(qName)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Look up an attribute's type by Namespace name.
+     * <p>
+     * See {@link #getType(int) getType(int)} for a description of the possible types.
+     * </p>
+     * 
+     * @param uri
+     *            The Namespace URI, or the empty String if the
+     *            name has no Namespace URI.
+     * @param localName
+     *            The local name of the attribute.
+     * @return The attribute type as a string, or null if the
+     *         attribute is not in the list or if Namespace
+     *         processing is not being performed.
+     */
+    @Override
+    public String getType(String uri, String localName) {
+        for (int i = 0; i < length; i++) {
+            if (localnames.get(i).equals(localName) && uris.get(i).equals(uri)) {
+                return types.get(i);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Look up an attribute's type by XML qualified (prefixed) name.
+     * <p>
+     * See {@link #getType(int) getType(int)} for a description of the possible types.
+     * </p>
+     * 
+     * @param qName
+     *            The XML qualified name.
+     * @return The attribute type as a string, or null if the
+     *         attribute is not in the list or if qualified names
+     *         are not available.
+     */
+    @Override
+    public String getType(String qName) {
+        for (int i = 0; i < length; i++) {
+            if (qnames.get(i).equals(qName)) {
+                return types.get(i);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Look up an attribute's value by Namespace name.
+     * <p>
+     * See {@link #getValue(int) getValue(int)} for a description of the possible values.
+     * </p>
+     * 
+     * @param uri
+     *            The Namespace URI, or the empty String if the
+     *            name has no Namespace URI.
+     * @param localName
+     *            The local name of the attribute.
+     * @return The attribute value as a string, or null if the
+     *         attribute is not in the list.
+     */
+    @Override
+    public String getValue(String uri, String localName) {
+        for (int i = 0; i < length; i++) {
+            if (localnames.get(i).equals(localName) && uris.get(i).equals(uri)) {
+                return values.get(i);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Look up an attribute's value by XML qualified (prefixed) name.
+     * <p>
+     * See {@link #getValue(int) getValue(int)} for a description of the possible values.
+     * </p>
+     * 
+     * @param qName
+     *            The XML qualified name.
+     * @return The attribute value as a string, or null if the
+     *         attribute is not in the list or if qualified names
+     *         are not available.
+     */
+    @Override
+    public String getValue(String qName) {
+        for (int i = 0; i < length; i++) {
+            if (qnames.get(i).equals(qName)) {
+                return values.get(i);
+            }
+        }
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/index/IndexDocumentBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/index/IndexDocumentBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexDocumentBuilder.java
new file mode 100644
index 0000000..2884097
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexDocumentBuilder.java
@@ -0,0 +1,882 @@
+/*
+ * 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.index;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.BooleanPointable;
+import org.apache.hyracks.data.std.primitive.BytePointable;
+import org.apache.hyracks.data.std.primitive.DoublePointable;
+import org.apache.hyracks.data.std.primitive.FloatPointable;
+import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.primitive.ShortPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDatePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSTimePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.AttributeNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.TextOrCommentNodePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.runtime.functions.cast.CastToStringOperation;
+import org.apache.vxquery.serializer.XMLSerializer;
+
+public class IndexDocumentBuilder extends XMLSerializer {
+    private final IPointable treePointable;
+
+    private final PointablePool pp;
+    private NodeTreePointable ntp;
+
+    private final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
+    private final DataOutput dOut = abvs.getDataOutput();
+    private final CastToStringOperation castToString = new CastToStringOperation();
+    private final Document doc;
+    private final List<ComplexItem> results;
+
+    private final byte[] bstart;
+    private final int sstart;
+    private final int lstart;
+    private final IndexWriter writer;
+
+    class ComplexItem {
+        public final StringField sf;
+        public final String id;
+
+        public ComplexItem(StringField sfin, String idin) {
+            sf = sfin;
+            id = idin;
+        }
+    }
+
+    //TODO: Handle Processing Instructions, PrefixedNames, and Namepsace entries
+    public IndexDocumentBuilder(IPointable tree, IndexWriter inWriter) {
+        this.treePointable = tree;
+        writer = inWriter;
+
+        //convert to tagged value pointable
+        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        tvp.set(treePointable.getByteArray(), 0, treePointable.getLength());
+
+        //get bytes and info from doc pointer
+        bstart = tvp.getByteArray();
+        sstart = tvp.getStartOffset();
+        lstart = tvp.getLength();
+
+        doc = new Document();
+
+        results = new ArrayList<ComplexItem>();
+
+        pp = PointablePoolFactory.INSTANCE.createPointablePool();
+    }
+
+    //This is a wrapper to start indexing using the functions adapted from XMLSerializer
+    public void printStart() throws IOException {
+
+        print(bstart, sstart, lstart, "0", "");
+        for (int i = 1; i < results.size() - 1; i++) {
+            //TODO: Since each doc is a file,
+            //we can only handle files 
+            //small enough to fit in memory
+            doc.add(results.get(i).sf);
+        }
+        writer.addDocument(doc);
+
+    }
+
+    //adapted from XMLSerializer. The following functions are used to traverse the TaggedValuePointable
+    //and create the index elements, then create the item for the lucene index
+    public void print(byte[] b, int s, int l, String deweyId, String epath) throws IOException {
+        TaggedValuePointable tvp = pp.takeOne(TaggedValuePointable.class);
+        try {
+            tvp.set(b, s, l);
+            printTaggedValuePointable(tvp, deweyId, epath);
+        } finally {
+            pp.giveBack(tvp);
+        }
+    }
+
+    private void printTaggedValuePointable(TaggedValuePointable tvp, String deweyId, String epath) throws IOException {
+        byte tag = tvp.getTag();
+        String type = "text";
+        String[] result = { "", "" };
+        switch ((int) tag) {
+            case ValueTag.XS_ANY_URI_TAG:
+                result = printString(tvp, epath);
+                break;
+
+            case ValueTag.XS_BASE64_BINARY_TAG:
+                result = printBase64Binary(tvp, epath);
+                break;
+
+            case ValueTag.XS_BOOLEAN_TAG:
+                result = printBoolean(tvp, epath);
+                break;
+
+            case ValueTag.XS_DATE_TAG:
+                result = printDate(tvp, epath);
+                break;
+
+            case ValueTag.XS_DATETIME_TAG:
+                result = printDateTime(tvp, epath);
+                break;
+
+            case ValueTag.XS_DAY_TIME_DURATION_TAG:
+                result = printDTDuration(tvp, epath);
+                break;
+
+            case ValueTag.XS_BYTE_TAG:
+                result = printByte(tvp, epath);
+                break;
+
+            case ValueTag.XS_DECIMAL_TAG:
+                result = printDecimal(tvp, epath);
+                break;
+
+            case ValueTag.XS_DOUBLE_TAG:
+                result = printDouble(tvp, epath);
+                break;
+
+            case ValueTag.XS_DURATION_TAG:
+                result = printDuration(tvp, epath);
+                break;
+
+            case ValueTag.XS_FLOAT_TAG:
+                result = printFloat(tvp, epath);
+                break;
+
+            case ValueTag.XS_G_DAY_TAG:
+                result = printGDay(tvp, epath);
+                break;
+
+            case ValueTag.XS_G_MONTH_TAG:
+                result = printGMonth(tvp, epath);
+                break;
+
+            case ValueTag.XS_G_MONTH_DAY_TAG:
+                result = printGMonthDay(tvp, epath);
+                break;
+
+            case ValueTag.XS_G_YEAR_TAG:
+                result = printGYear(tvp, epath);
+                break;
+
+            case ValueTag.XS_G_YEAR_MONTH_TAG:
+                result = printGYearMonth(tvp, epath);
+                break;
+
+            case ValueTag.XS_HEX_BINARY_TAG:
+                result = printHexBinary(tvp, epath);
+                break;
+
+            case ValueTag.XS_INT_TAG:
+            case ValueTag.XS_UNSIGNED_SHORT_TAG:
+                result = printInt(tvp, epath);
+                break;
+
+            case ValueTag.XS_INTEGER_TAG:
+            case ValueTag.XS_LONG_TAG:
+            case ValueTag.XS_NEGATIVE_INTEGER_TAG:
+            case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
+            case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
+            case ValueTag.XS_POSITIVE_INTEGER_TAG:
+            case ValueTag.XS_UNSIGNED_INT_TAG:
+            case ValueTag.XS_UNSIGNED_LONG_TAG:
+                result = printInteger(tvp, epath);
+                break;
+
+            case ValueTag.XS_NOTATION_TAG:
+                result = printString(tvp, epath);
+                break;
+
+            case ValueTag.XS_QNAME_TAG:
+                result = printQName(tvp, epath);
+                break;
+
+            case ValueTag.XS_SHORT_TAG:
+            case ValueTag.XS_UNSIGNED_BYTE_TAG:
+                result = printShort(tvp, epath);
+                break;
+
+            case ValueTag.XS_STRING_TAG:
+            case ValueTag.XS_NORMALIZED_STRING_TAG:
+            case ValueTag.XS_TOKEN_TAG:
+            case ValueTag.XS_LANGUAGE_TAG:
+            case ValueTag.XS_NMTOKEN_TAG:
+            case ValueTag.XS_NAME_TAG:
+            case ValueTag.XS_NCNAME_TAG:
+            case ValueTag.XS_ID_TAG:
+            case ValueTag.XS_IDREF_TAG:
+            case ValueTag.XS_ENTITY_TAG:
+                result = printString(tvp, epath);
+                break;
+
+            case ValueTag.XS_TIME_TAG:
+                result = printTime(tvp, epath);
+                break;
+
+            case ValueTag.XS_UNTYPED_ATOMIC_TAG:
+                result = printString(tvp, epath);
+                break;
+
+            case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
+                result = printYMDuration(tvp, epath);
+                break;
+
+            case ValueTag.ATTRIBUTE_NODE_TAG:
+                type = "attribute";
+                printAttributeNode(tvp, deweyId, epath);
+                break;
+
+            case ValueTag.TEXT_NODE_TAG:
+                type = "textnode";
+                result = printTextNode(tvp, epath);
+                break;
+
+            case ValueTag.COMMENT_NODE_TAG:
+                type = "comment";
+                result = printCommentNode(tvp, epath);
+                break;
+
+            case ValueTag.SEQUENCE_TAG:
+                type = "sequence";
+                printSequence(tvp, deweyId, epath);
+                break;
+
+            case ValueTag.NODE_TREE_TAG:
+                type = "tree";
+                printNodeTree(tvp, deweyId, epath);
+                break;
+
+            case ValueTag.ELEMENT_NODE_TAG:
+                type = "element";
+                printElementNode(tvp, deweyId, epath);
+                break;
+
+            case ValueTag.DOCUMENT_NODE_TAG:
+                type = "doc";
+                buildIndexItem(deweyId, type, result, epath);
+                printDocumentNode(tvp, deweyId, epath);
+                break;
+
+            default:
+                throw new UnsupportedOperationException("Encountered tag: " + tvp.getTag());
+        }
+        if ((int) tag != ValueTag.DOCUMENT_NODE_TAG && (int) tag != ValueTag.SEQUENCE_TAG
+                && (int) tag != ValueTag.NODE_TREE_TAG && (int) tag != ValueTag.ELEMENT_NODE_TAG
+                && (int) tag != ValueTag.ATTRIBUTE_NODE_TAG) {
+            buildIndexItem(deweyId, type, result, epath);
+        }
+
+    }
+
+    private void buildIndexItem(String deweyId, String type, String[] result, String parentPath) {
+        //Create an Index element
+        IndexElement test = new IndexElement(deweyId, type, result[1]);
+
+        String path = test.epath();
+
+        path = StringUtils.replace(path, parentPath, "");
+        //Parser doesn't like / so paths are saved as name.name....
+        String luceneParentPath = parentPath.replaceAll("/", ".");
+
+        if (!type.equals("doc")) {
+            path = path.replaceFirst("/", ":");
+        } else {
+            luceneParentPath = "";
+        }
+        //Parser doesn't like / so paths are saved as name.name....
+        path = path.replaceAll("/", ".");
+        //Add this element to the array (they will be added in reverse order.
+        String fullItem = luceneParentPath + path + "." + test.type();
+
+        results.add(new ComplexItem(new StringField("item", fullItem, Field.Store.YES), test.id()));
+    }
+
+    private String[] printDecimal(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDecimalPointable dp = pp.takeOne(XSDecimalPointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertDecimal(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private void printNodeTree(TaggedValuePointable tvp, String deweyId, String path) throws IOException {
+        if (ntp != null) {
+            throw new IllegalStateException("Nested NodeTreePointable found");
+        }
+        ntp = pp.takeOne(NodeTreePointable.class);
+        TaggedValuePointable rootTVP = pp.takeOne(TaggedValuePointable.class);
+        try {
+            tvp.getValue(ntp);
+            ntp.getRootNode(rootTVP);
+            printTaggedValuePointable(rootTVP, deweyId, path);
+        } finally {
+            pp.giveBack(rootTVP);
+            pp.giveBack(ntp);
+            ntp = null;
+        }
+    }
+
+    private String[] printCommentNode(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        TextOrCommentNodePointable tcnp = pp.takeOne(TextOrCommentNodePointable.class);
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        try {
+            tvp.getValue(tcnp);
+            tcnp.getValue(ntp, utf8sp);
+
+            result = printString(utf8sp, path);
+
+        } finally {
+            pp.giveBack(tcnp);
+            pp.giveBack(utf8sp);
+        }
+        return result;
+    }
+
+    private String[] printTextNode(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        TextOrCommentNodePointable tcnp = pp.takeOne(TextOrCommentNodePointable.class);
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        try {
+            tvp.getValue(tcnp);
+            tcnp.getValue(ntp, utf8sp);
+            result = printString(utf8sp, path);
+        } finally {
+            pp.giveBack(tcnp);
+            pp.giveBack(utf8sp);
+        }
+        return result;
+    }
+
+    private void printAttributeNode(TaggedValuePointable tvp, String deweyId, String path) throws IOException {
+        String[] result = { "", path };
+        AttributeNodePointable anp = pp.takeOne(AttributeNodePointable.class);
+        CodedQNamePointable cqp = pp.takeOne(CodedQNamePointable.class);
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        TaggedValuePointable valueTVP = pp.takeOne(TaggedValuePointable.class);
+        try {
+            tvp.getValue(anp);
+            anp.getName(cqp);
+            result = printPrefixedQName(cqp, utf8sp, path);
+            buildIndexItem(deweyId, "attribute", result, path);
+
+            anp.getValue(ntp, valueTVP);
+
+            String attributeValueId = deweyId + ".0";
+            printTaggedValuePointable(valueTVP, attributeValueId, result[1]);
+
+        } finally {
+            pp.giveBack(valueTVP);
+            pp.giveBack(utf8sp);
+            pp.giveBack(anp);
+            pp.giveBack(cqp);
+        }
+    }
+
+    private void printElementNode(TaggedValuePointable tvp, String deweyId, String path) throws IOException {
+        String[] result = { "", path };
+        ElementNodePointable enp = pp.takeOne(ElementNodePointable.class);
+        CodedQNamePointable cqp = pp.takeOne(CodedQNamePointable.class);
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        SequencePointable seqp = pp.takeOne(SequencePointable.class);
+        try {
+            tvp.getValue(enp);
+            enp.getName(cqp);
+            result = printPrefixedQName(cqp, utf8sp, path);
+            buildIndexItem(deweyId, "element", result, path);
+
+            enp.getAttributeSequence(ntp, seqp);
+            int numattributes = 0;
+            if (seqp.getByteArray() != null && seqp.getEntryCount() > 0) {
+                printSequence(seqp, deweyId, 0, result[1]);
+                numattributes = seqp.getEntryCount();
+            }
+
+            enp.getChildrenSequence(ntp, seqp);
+            if (seqp.getByteArray() != null) {
+                printSequence(seqp, deweyId, numattributes, result[1]);
+            }
+
+        } finally {
+            pp.giveBack(seqp);
+            pp.giveBack(utf8sp);
+            pp.giveBack(cqp);
+            pp.giveBack(enp);
+        }
+    }
+
+    private String[] printPrefixedQName(CodedQNamePointable cqp, UTF8StringPointable utf8sp, String path) {
+        ntp.getString(cqp.getLocalCode(), utf8sp);
+        return printString(utf8sp, path);
+    }
+
+    private void printDocumentNode(TaggedValuePointable tvp, String deweyId, String path) throws IOException {
+        DocumentNodePointable dnp = pp.takeOne(DocumentNodePointable.class);
+        SequencePointable seqp = pp.takeOne(SequencePointable.class);
+        try {
+            tvp.getValue(dnp);
+            dnp.getContent(ntp, seqp);
+            printSequence(seqp, deweyId, 0, path);
+        } finally {
+            pp.giveBack(seqp);
+            pp.giveBack(dnp);
+        }
+    }
+
+    private void printSequence(TaggedValuePointable tvp, String deweyId, String path) throws IOException {
+        SequencePointable seqp = pp.takeOne(SequencePointable.class);
+        try {
+            tvp.getValue(seqp);
+            printSequence(seqp, deweyId, 0, path);
+        } finally {
+            pp.giveBack(seqp);
+        }
+    }
+
+    private void printSequence(SequencePointable seqp, String deweyId, int addon, String path) throws IOException {
+        VoidPointable vp = pp.takeOne(VoidPointable.class);
+        try {
+            int len = seqp.getEntryCount();
+            for (int i = 0; i < len; ++i) {
+                int location = i + addon;
+                String childID = deweyId + "." + Integer.toString(location);
+                seqp.getEntry(i, vp);
+                print(vp.getByteArray(), vp.getStartOffset(), vp.getLength(), childID, path);
+            }
+        } finally {
+            pp.giveBack(vp);
+        }
+    }
+
+    private String[] printBase64Binary(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSBinaryPointable bp = pp.takeOne(XSBinaryPointable.class);
+        try {
+            tvp.getValue(bp);
+            abvs.reset();
+            castToString.convertBase64Binary(bp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(bp);
+        }
+        return result;
+    }
+
+    private String[] printBoolean(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        BooleanPointable bp = pp.takeOne(BooleanPointable.class);
+        try {
+            tvp.getValue(bp);
+            result[0] = Boolean.toString(bp.getBoolean());
+            result[1] = path + "/" + result[0];
+        } finally {
+            pp.giveBack(bp);
+        }
+        return result;
+    }
+
+    private String[] printByte(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        BytePointable bp = pp.takeOne(BytePointable.class);
+        try {
+            tvp.getValue(bp);
+            result[0] = Byte.toString(bp.byteValue());
+            result[1] = path + "/" + result[0];
+        } finally {
+            pp.giveBack(bp);
+        }
+        return result;
+    }
+
+    private String[] printDouble(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        DoublePointable dp = pp.takeOne(DoublePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertDouble(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printDate(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertDate(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printDateTime(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDateTimePointable dtp = pp.takeOne(XSDateTimePointable.class);
+        try {
+            tvp.getValue(dtp);
+            abvs.reset();
+            castToString.convertDatetime(dtp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dtp);
+        }
+        return result;
+    }
+
+    private String[] printDTDuration(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        LongPointable lp = pp.takeOne(LongPointable.class);
+        try {
+            tvp.getValue(lp);
+            abvs.reset();
+            castToString.convertDTDuration(lp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(lp);
+        }
+        return result;
+    }
+
+    private String[] printDuration(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDurationPointable dp = pp.takeOne(XSDurationPointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertDuration(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printFloat(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        FloatPointable fp = pp.takeOne(FloatPointable.class);
+        try {
+            tvp.getValue(fp);
+            abvs.reset();
+            castToString.convertFloat(fp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(fp);
+        }
+        return result;
+    }
+
+    private String[] printGDay(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertGDay(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printGMonth(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertGMonth(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printGMonthDay(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertGMonthDay(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printGYear(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertGYear(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printGYearMonth(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSDatePointable dp = pp.takeOne(XSDatePointable.class);
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertGYearMonth(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printHexBinary(TaggedValuePointable tvp, String path) throws IOException {
+        String[] result = { "", path };
+        XSBinaryPointable bp = pp.takeOne(XSBinaryPointable.class);
+        try {
+            tvp.getValue(bp);
+            abvs.reset();
+            castToString.convertHexBinary(bp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(bp);
+        }
+        return result;
+    }
+
+    private String[] printInt(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        IntegerPointable ip = pp.takeOne(IntegerPointable.class);
+        try {
+            tvp.getValue(ip);
+            result[0] = Integer.toString(ip.intValue());
+            result[1] = path + "/" + result[0];
+        } finally {
+            pp.giveBack(ip);
+        }
+        return result;
+    }
+
+    private String[] printInteger(TaggedValuePointable tvp, String path) {
+        String[] result = { "", path };
+        LongPointable lp = pp.takeOne(LongPointable.class);
+        try {
+            tvp.getValue(lp);
+            result[0] = Long.toString(lp.longValue());
+            result[1] = path + "/" + result[0];
+        } finally {
+            pp.giveBack(lp);
+        }
+        return result;
+    }
+
+    private String[] printShort(TaggedValuePointable tvp, String path) {
+        ShortPointable sp = pp.takeOne(ShortPointable.class);
+        String[] result = { "", path };
+        try {
+            tvp.getValue(sp);
+            result[0] = Short.toString(sp.shortValue());
+            result[1] = path + "/" + result[0];
+        } finally {
+            pp.giveBack(sp);
+        }
+        return result;
+    }
+
+    private String[] printQName(TaggedValuePointable tvp, String path) throws IOException {
+        XSQNamePointable dp = pp.takeOne(XSQNamePointable.class);
+        String[] result = { "", path };
+        try {
+            tvp.getValue(dp);
+            abvs.reset();
+            castToString.convertQName(dp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(dp);
+        }
+        return result;
+    }
+
+    private String[] printStringAbvs(String path) {
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        String[] result = { "", path };
+        try {
+            utf8sp.set(abvs.getByteArray(), abvs.getStartOffset() + 1, abvs.getLength() - 1);
+            result = printString(utf8sp, path);
+        } finally {
+            pp.giveBack(utf8sp);
+        }
+        return result;
+    }
+
+    private String[] printString(TaggedValuePointable tvp, String path) {
+        UTF8StringPointable utf8sp = pp.takeOne(UTF8StringPointable.class);
+        String[] result = { "", path };
+        try {
+            tvp.getValue(utf8sp);
+            result = printString(utf8sp, path);
+        } finally {
+            pp.giveBack(utf8sp);
+        }
+        return result;
+    }
+
+    private String[] printString(UTF8StringPointable utf8sp, String path) {
+        int utfLen = utf8sp.getUTFLength();
+        int offset = 2;
+        String[] result = { "", path };
+        while (utfLen > 0) {
+            char c = utf8sp.charAt(offset);
+            switch (c) {
+                case '<':
+                    result[0] += "&lt;";
+                    break;
+
+                case '>':
+                    result[0] += "&gt;";
+                    break;
+
+                case '&':
+                    result[0] += "&amp;";
+                    break;
+
+                case '"':
+                    result[0] += "&quot;";
+                    break;
+
+                case '\'':
+                    result[0] += "&apos;";
+                    break;
+
+                default:
+                    result[0] += Character.toString(c);
+                    break;
+            }
+            int cLen = UTF8StringPointable.getModifiedUTF8Len(c);
+            offset += cLen;
+            utfLen -= cLen;
+
+        }
+        result[1] = path + "/" + result[0];
+        return result;
+    }
+
+    private String[] printTime(TaggedValuePointable tvp, String path) throws IOException {
+        XSTimePointable tp = pp.takeOne(XSTimePointable.class);
+        String[] result = { "", path };
+        try {
+            tvp.getValue(tp);
+            abvs.reset();
+            castToString.convertTime(tp, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(tp);
+        }
+        return result;
+    }
+
+    private String[] printYMDuration(TaggedValuePointable tvp, String path) throws IOException {
+        IntegerPointable ip = pp.takeOne(IntegerPointable.class);
+        String[] result = { "", path };
+        try {
+            tvp.getValue(ip);
+            abvs.reset();
+            castToString.convertYMDuration(ip, dOut);
+            result = printStringAbvs(path);
+        } catch (Exception e) {
+            throw new IOException(e);
+        } finally {
+            pp.giveBack(ip);
+        }
+        return result;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/index/IndexElement.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/index/IndexElement.java b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexElement.java
new file mode 100644
index 0000000..d2487a5
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/index/IndexElement.java
@@ -0,0 +1,42 @@
+/*
+* 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.index;
+
+public class IndexElement {
+    private String id;
+    private String type;
+    private String elementpath;
+
+    public IndexElement(String id, String type, String elementpath) {
+        this.id = id;
+        this.type = type;
+        this.elementpath = elementpath;
+    }
+
+    public String id() {
+        return id;
+    }
+
+    public String type() {
+        return type;
+    }
+
+    public String epath() {
+        return elementpath;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
index b8dca63..ef51cee 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
@@ -18,8 +18,6 @@ package org.apache.vxquery.metadata;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
@@ -31,8 +29,6 @@ import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.TrueFileFilter;
 import org.apache.commons.lang.StringUtils;
@@ -67,7 +63,6 @@ import org.apache.vxquery.hdfs2.HDFSFunctions;
 import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
 import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
 import org.apache.vxquery.xmlparser.XMLParser;
-import org.xml.sax.SAXException;
 
 public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor {
     private static final long serialVersionUID = 1L;
@@ -179,50 +174,34 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
                                 for (int i = 0; i < size; i++) {
                                     //read split
                                     context = ctxFactory.createContext(job.getConfiguration(), i);
-                                    try {
-                                        reader = inputFormat.createRecordReader(inputSplits.get(i), context);
-                                        reader.initialize(inputSplits.get(i), context);
-                                        while (reader.nextKeyValue()) {
-                                            value = reader.getCurrentValue().toString();
-                                            //Split value if it contains more than one item with the tag
-                                            if (StringUtils.countMatches(value, tag) > 1) {
-                                                String items[] = value.split(tag);
-                                                for (String item : items) {
-                                                    if (item.length() > 0) {
-                                                        item = START_TAG + tag + item;
-                                                        stream = new ByteArrayInputStream(
-                                                                item.getBytes(StandardCharsets.UTF_8));
-                                                        parser.parseHDFSElements(stream, writer, fta, i);
-                                                    }
+
+                                    reader = inputFormat.createRecordReader(inputSplits.get(i), context);
+                                    reader.initialize(inputSplits.get(i), context);
+                                    while (reader.nextKeyValue()) {
+                                        value = reader.getCurrentValue().toString();
+                                        //Split value if it contains more than one item with the tag
+                                        if (StringUtils.countMatches(value, tag) > 1) {
+                                            String items[] = value.split(tag);
+                                            for (String item : items) {
+                                                if (item.length() > 0) {
+                                                    item = START_TAG + tag + item;
+                                                    stream = new ByteArrayInputStream(
+                                                            item.getBytes(StandardCharsets.UTF_8));
+                                                    parser.parseHDFSElements(stream, writer, fta, i);
                                                 }
-                                            } else {
-                                                value = START_TAG + value;
-                                                //create an input stream to the file currently reading and send it to parser
-                                                stream = new ByteArrayInputStream(
-                                                        value.getBytes(StandardCharsets.UTF_8));
-                                                parser.parseHDFSElements(stream, writer, fta, i);
                                             }
-                                        }
-
-                                    } catch (InterruptedException e) {
-                                        if (LOGGER.isLoggable(Level.SEVERE)) {
-                                            LOGGER.severe(e.getMessage());
+                                        } else {
+                                            value = START_TAG + value;
+                                            //create an input stream to the file currently reading and send it to parser
+                                            stream = new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8));
+                                            parser.parseHDFSElements(stream, writer, fta, i);
                                         }
                                     }
-                                }
 
-                            } catch (IOException e) {
-                                if (LOGGER.isLoggable(Level.SEVERE)) {
-                                    LOGGER.severe(e.getMessage());
-                                }
-                            } catch (ParserConfigurationException e) {
-                                if (LOGGER.isLoggable(Level.SEVERE)) {
-                                    LOGGER.severe(e.getMessage());
-                                }
-                            } catch (SAXException e) {
-                                if (LOGGER.isLoggable(Level.SEVERE)) {
-                                    LOGGER.severe(e.getMessage());
                                 }
+
+                            } catch (Exception e) {
+                                throw new HyracksDataException(e);
                             }
                         } else {
                             try {
@@ -248,22 +227,14 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
                                     throw new HyracksDataException("Invalid HDFS directory parameter (" + nodeId + ":"
                                             + directory + ") passed to collection.");
                                 }
-                            } catch (FileNotFoundException e) {
-                                if (LOGGER.isLoggable(Level.SEVERE)) {
-                                    LOGGER.severe(e.getMessage());
-                                }
-                            } catch (IOException e) {
-                                if (LOGGER.isLoggable(Level.SEVERE)) {
-                                    LOGGER.severe(e.getMessage());
-                                }
+                            } catch (Exception e) {
+                                throw new HyracksDataException(e);
                             }
                         }
                         try {
                             fs.close();
-                        } catch (IOException e) {
-                            if (LOGGER.isLoggable(Level.SEVERE)) {
-                                LOGGER.severe(e.getMessage());
-                            }
+                        } catch (Exception e) {
+                            throw new HyracksDataException(e);
                         }
                     }
                 }


[14/19] vxquery git commit: Working on some corrections

Posted by pr...@apache.org.
Working on some corrections


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/b93e4584
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/b93e4584
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/b93e4584

Branch: refs/heads/master
Commit: b93e4584c90adb9a1a1352b42aea65728a31706c
Parents: 1a4f192
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Thu Jun 9 13:26:18 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Thu Jun 9 13:26:18 2016 -0700

----------------------------------------------------------------------
 .../vxquery/functions/builtin-operators.xml     | 2296 +++++++++---------
 .../ArrayNodeConstructorScalarEvaluator.java    |   18 +-
 2 files changed, 1162 insertions(+), 1152 deletions(-)
----------------------------------------------------------------------



[03/19] vxquery git commit: Changing ArrayConstructor

Posted by pr...@apache.org.
Changing ArrayConstructor


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/beff6de5
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/beff6de5
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/beff6de5

Branch: refs/heads/master
Commit: beff6de50d0374b337ef38bf48989f53d985f7f5
Parents: 6c7dd29
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Mon May 30 21:35:55 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Mon May 30 21:35:55 2016 -0700

----------------------------------------------------------------------
 .../xmlquery/ast/ArrayConstructorNode.java      | 27 -------------------
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 28 +++-----------------
 2 files changed, 4 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/beff6de5/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
deleted file mode 100644
index 235f2c9..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.vxquery.xmlquery.ast;
-
-import java.util.List;
-
-import org.apache.vxquery.util.SourceLocation;
-
-public class ArrayConstructorNode extends ASTNode {
-    private List<ASTNode> items;
-
-    public ArrayConstructorNode(SourceLocation loc) {
-        super(loc);
-    }
-
-    @Override
-    public ASTTag getTag() {
-        return ASTTag.ARRAY_CONSTRUCTOR;
-    }
-
-    public List<ASTNode> getItems() {
-        return items;
-    }
-
-    public void setItems(List<ASTNode> items) {
-        this.items = items;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/beff6de5/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 91c9904..4db964a 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -1796,7 +1796,6 @@ ASTNode PrimaryExpr():
         | LOOKAHEAD(2) expr = OrderedExpr()
         | LOOKAHEAD(2) expr = UnorderedExpr()
         | expr = Constructor()
-        | expr = JsonConstructor()
     ) {
         return expr;
     }
@@ -1951,34 +1950,14 @@ ASTNode JsonConstructor()  :
 
 ASTNode ArrayConstructor()  :
 {
-	Token start, end;
-	List<ASTNode> items;
+	ASTNode expr;
 }
 {
-	start="[" items=ArrayItemList() end="]" {
-		ArrayConstructorNode array = new ArrayConstructorNode(createSourceLocation(start));
-		array.setItems(items);
-		return array;
+	"[" expr=Expr() "]" {
+		return expr;
 	}
 }
 
-List<ASTNode> ArrayItemList()  :
-{
-	List<ASTNode> items = new ArrayList<ASTNode>();
-	ASTNode arraynode;
-}
-{[
-	arraynode = Literal() {
-        items.add(arraynode);
-    } (
-        "," arraynode = Literal() {
-            items.add(arraynode);
-        }
-    )* ]{
-        return items;
-    }
-}	
-
 ASTNode Constructor()  :
 {
     ASTNode result;
@@ -1987,6 +1966,7 @@ ASTNode Constructor()  :
     (
         result = DirectConstructor()
         | result = ComputedConstructor()
+        | result = JsonConstructor()
     ) {
         return result;
     }


[16/19] vxquery git commit: Changing Array Constructor and Adding Test Cases

Posted by pr...@apache.org.
Changing Array Constructor and Adding Test Cases


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/bb1fa8ec
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/bb1fa8ec
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/bb1fa8ec

Branch: refs/heads/master
Commit: bb1fa8ec5e3904ee52d536924a668e0a5542c436
Parents: b93e458
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Thu Jun 9 19:12:34 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Thu Jun 9 19:12:34 2016 -0700

----------------------------------------------------------------------
 .../vxquery/functions/builtin-operators.xml     | 1208 ++++++++----------
 .../node/ArrayConstructorScalarEvaluator.java   |   76 ++
 .../ArrayConstructorScalarEvaluatorFactory.java |   37 +
 .../ArrayNodeConstructorScalarEvaluator.java    |   69 -
 ...ayNodeConstructorScalarEvaluatorFactory.java |   37 -
 .../vxquery/serializer/XMLSerializer.java       |   28 +-
 .../vxquery/xmlquery/ast/ArrayConstructor.java  |   40 +
 .../xmlquery/ast/ArrayConstructorNode.java      |   40 -
 .../xmlquery/translator/XMLQueryTranslator.java |   11 +-
 vxquery-core/src/main/javacc/xquery-grammar.jj  |    6 +-
 .../Json/Array/q01_array.txt                    |    1 +
 .../Json/Array/q02_array.txt                    |    1 +
 .../Json/Array/q03_array.txt                    |    1 +
 .../Json/Array/q04_array.txt                    |    1 +
 .../Json/Object/q01_object.txt                  |    1 +
 .../Queries/XQuery/Json/Array/q01_array.xq      |   20 +
 .../Queries/XQuery/Json/Array/q02_array.xq      |   20 +
 .../Queries/XQuery/Json/Array/q03_array.xq      |   20 +
 .../Queries/XQuery/Json/Array/q04_array.xq      |   20 +
 .../Queries/XQuery/Json/Object/q01_object.xq    |   20 +
 .../src/test/resources/VXQueryCatalog.xml       |   17 +
 .../src/test/resources/cat/JsonArrayQueries.xml |   43 +
 .../test/resources/cat/JsonObjectQueries.xml    |   28 +
 23 files changed, 907 insertions(+), 838 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/bb1fa8ec/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
index 0d4f0c6..05582e8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
+++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
@@ -16,1139 +16,1015 @@
   limitations under the License.
 -->
 <operators>
-    <!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
-        as xs:date -->
+    <!-- op:add-dayTimeDuration-to-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration)  as xs:date -->
     <operator name="op:add-dayTimeDuration-to-date">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:date" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:date"/>
     </operator>
 
-    <!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
-        xs:dayTimeDuration) as xs:dateTime -->
+    <!-- op:add-dayTimeDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration)  as xs:dateTime -->
     <operator name="op:add-dayTimeDuration-to-dateTime">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:dateTime" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:dateTime"/>
     </operator>
 
-    <!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
-        as xs:time -->
+    <!-- op:add-dayTimeDuration-to-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration)  as xs:time -->
     <operator name="op:add-dayTimeDuration-to-time">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:time" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:time"/>
     </operator>
 
-    <!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) 
-        as xs:dayTimeDuration -->
+    <!-- op:add-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:dayTimeDuration -->
     <operator name="op:add-dayTimeDurations">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:dayTimeDuration" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:dayTimeDuration"/>
     </operator>
 
-    <!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration) 
-        as xs:date -->
+    <!-- op:add-yearMonthDuration-to-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration)  as xs:date -->
     <operator name="op:add-yearMonthDuration-to-date">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:date" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:date"/>
     </operator>
 
-    <!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as 
-        xs:yearMonthDuration) as xs:dateTime -->
+    <!-- op:add-yearMonthDuration-to-dateTime( $arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration)  as xs:dateTime -->
     <operator name="op:add-yearMonthDuration-to-dateTime">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:dateTime" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:dateTime"/>
     </operator>
 
-    <!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as 
-        xs:yearMonthDuration) as xs:yearMonthDuration -->
+    <!-- op:add-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:yearMonthDuration -->
     <operator name="op:add-yearMonthDurations">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:yearMonthDuration" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:yearMonthDuration"/>
     </operator>
 
-    <!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary) 
-        as xs:boolean -->
+    <!-- op:base64Binary-equal( $value1 as xs:base64Binary, $value2 as xs:base64Binary)  as xs:boolean -->
     <operator name="op:base64Binary-equal">
-        <param name="value1" type="xs:base64Binary" />
-        <param name="value2" type="xs:base64Binary" />
-        <return type="xs:boolean" />
+        <param name="value1" type="xs:base64Binary"/>
+        <param name="value2" type="xs:base64Binary"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean -->
+    <!-- op:boolean-equal($value1  as xs:boolean, $value2 as xs:boolean)  as xs:boolean -->
     <operator name="op:boolean-equal">
-        <param name="value1" type="xs:boolean" />
-        <param name="value2" type="xs:boolean" />
-        <return type="xs:boolean" />
+        <param name="value1" type="xs:boolean"/>
+        <param name="value2" type="xs:boolean"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean) 
-        as xs:boolean -->
+    <!-- op:boolean-greater-than( $arg1 as xs:boolean, $arg2 as xs:boolean)  as xs:boolean -->
     <operator name="op:boolean-greater-than">
-        <param name="value1" type="xs:boolean" />
-        <param name="value2" type="xs:boolean" />
-        <return type="xs:boolean" />
+        <param name="value1" type="xs:boolean"/>
+        <param name="value2" type="xs:boolean"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean) as 
-        xs:boolean -->
+    <!-- op:boolean-less-than( $arg1 as xs:boolean, $arg2 as xs:boolean)  as xs:boolean -->
     <operator name="op:boolean-less-than">
-        <param name="value1" type="xs:boolean" />
-        <param name="value2" type="xs:boolean" />
-        <return type="xs:boolean" />
+        <param name="value1" type="xs:boolean"/>
+        <param name="value2" type="xs:boolean"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:concatenate($arg as item()*) as item()* -->
+    <!-- op:concatenate($arg as item()*)  as item()* -->
     <operator name="op:concatenate" varargs="true">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.sequence.ConcatenateScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <!-- op:date-equal($arg1  as xs:date, $arg2 as xs:date)  as xs:boolean -->
     <operator name="op:date-equal">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:date" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:date"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <!-- op:date-greater-than( $arg1 as xs:date, $arg2 as xs:date)  as xs:boolean -->
     <operator name="op:date-greater-than">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:date" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:date"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean -->
+    <!-- op:date-less-than($arg1  as xs:date, $arg2 as xs:date)  as xs:boolean -->
     <operator name="op:date-less-than">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:date" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:date"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean -->
+    <!-- op:dateTime-equal($arg1  as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
     <operator name="op:dateTime-equal">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dateTime" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dateTime"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-        as xs:boolean -->
+    <!-- op:dateTime-greater-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
     <operator name="op:dateTime-greater-than">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dateTime" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dateTime"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-        as xs:boolean -->
+    <!-- op:dateTime-less-than( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:boolean -->
     <operator name="op:dateTime-less-than">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dateTime" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dateTime"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 
-        as xs:dayTimeDuration) as xs:boolean -->
+    <!-- op:dayTimeDuration-greater-than( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:boolean -->
     <operator name="op:dayTimeDuration-greater-than">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as 
-        xs:dayTimeDuration) as xs:boolean -->
+    <!-- op:dayTimeDuration-less-than( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:boolean -->
     <operator name="op:dayTimeDuration-less-than">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double) 
-        as xs:dayTimeDuration -->
+    <!-- op:divide-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double)  as xs:dayTimeDuration -->
     <operator name="op:divide-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:double" />
-        <return type="xs:dayTimeDuration" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:double"/>
+        <return type="xs:dayTimeDuration"/>
     </operator>
 
-    <!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, 
-        $arg2 as xs:dayTimeDuration) as xs:decimal -->
+    <!-- op:divide-dayTimeDuration-by-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:decimal -->
     <operator name="op:divide-dayTimeDuration-by-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:decimal" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:decimal"/>
     </operator>
 
-    <!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as 
-        xs:double) as xs:yearMonthDuration -->
+    <!-- op:divide-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:double)  as xs:yearMonthDuration -->
     <operator name="op:divide-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:double" />
-        <return type="xs:yearMonthDuration" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:double"/>
+        <return type="xs:yearMonthDuration"/>
     </operator>
 
-    <!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, 
-        $arg2 as xs:yearMonthDuration) as xs:decimal -->
+    <!-- op:divide-yearMonthDuration-by-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:decimal -->
     <operator name="op:divide-yearMonthDuration-by-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:decimal" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:decimal"/>
     </operator>
 
-    <!-- op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean -->
+    <!-- op:duration-equal($arg1  as xs:duration, $arg2 as xs:duration)  as xs:boolean -->
     <operator name="op:duration-equal">
-        <param name="arg1" type="xs:duration" />
-        <param name="arg2" type="xs:duration" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:duration"/>
+        <param name="arg2" type="xs:duration"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:except($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+    <!-- op:except($parameter1  as node()*, $parameter2 as node()*)  as node()* -->
     <operator name="op:except">
-        <param name="parameter1" type="node()*" />
-        <param name="parameter2" type="node()*" />
-        <return type="node()*" />
+        <param name="parameter1" type="node()*"/>
+        <param name="parameter2" type="node()*"/>
+        <return type="node()*"/>
         <!-- implementation assumes input in document order -->
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
-    <!-- op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean -->
+    <!-- op:gDay-equal($arg1  as xs:gDay, $arg2 as xs:gDay)  as xs:boolean -->
     <operator name="op:gDay-equal">
-        <param name="arg1" type="xs:gDay" />
-        <param name="arg2" type="xs:gDay" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:gDay"/>
+        <param name="arg2" type="xs:gDay"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean -->
+    <!-- op:gMonth-equal($arg1  as xs:gMonth, $arg2 as xs:gMonth)  as xs:boolean -->
     <operator name="op:gMonth-equal">
-        <param name="arg1" type="xs:gMonth" />
-        <param name="arg2" type="xs:gMonth" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:gMonth"/>
+        <param name="arg2" type="xs:gMonth"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as 
-        xs:boolean -->
+    <!-- op:gMonthDay-equal($arg1  as xs:gMonthDay, $arg2 as xs:gMonthDay)  as xs:boolean -->
     <operator name="op:gMonthDay-equal">
-        <param name="arg1" type="xs:gMonthDay" />
-        <param name="arg2" type="xs:gMonthDay" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:gMonthDay"/>
+        <param name="arg2" type="xs:gMonthDay"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean -->
+    <!-- op:gYear-equal($arg1  as xs:gYear, $arg2 as xs:gYear)  as xs:boolean -->
     <operator name="op:gYear-equal">
-        <param name="arg1" type="xs:gYear" />
-        <param name="arg2" type="xs:gYear" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:gYear"/>
+        <param name="arg2" type="xs:gYear"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) 
-        as xs:boolean -->
+    <!-- op:gYearMonth-equal( $arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth)  as xs:boolean -->
     <operator name="op:gYearMonth-equal">
-        <param name="arg1" type="xs:gYearMonth" />
-        <param name="arg2" type="xs:gYearMonth" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:gYearMonth"/>
+        <param name="arg2" type="xs:gYearMonth"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) 
-        as xs:boolean -->
+    <!-- op:hexBinary-equal($value1 as xs:hexBinary, $value2 as xs:hexBinary) as xs:boolean -->
     <operator name="op:hexBinary-equal">
-        <param name="arg1" type="xs:hexBinary" />
-        <param name="arg2" type="xs:hexBinary" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:hexBinary"/>
+        <param name="arg2" type="xs:hexBinary"/>
+        <return type="xs:boolean"/>
     </operator>
 
     <!-- op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* -->
     <operator name="op:intersect">
-        <param name="parameter1" type="node()*" />
-        <param name="parameter2" type="node()*" />
-        <return type="node()*" />
+        <param name="parameter1" type="node()*"/>
+        <param name="parameter2" type="node()*"/>
+        <return type="node()*"/>
         <!-- implementation assumes input in document order -->
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
     <operator name="op:is-same-node">
-        <param name="parameter1" type="node()" />
-        <param name="parameter2" type="node()" />
-        <return type="xs:boolean" />
+        <param name="parameter1" type="node()"/>
+        <param name="parameter2" type="node()"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as 
-        xs:double) as xs:dayTimeDuration -->
+    <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double)  as xs:dayTimeDuration -->
     <operator name="op:multiply-dayTimeDuration">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:double" />
-        <return type="xs:dayTimeDuration" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:double"/>
+        <return type="xs:dayTimeDuration"/>
     </operator>
 
-    <!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 
-        as xs:double) as xs:yearMonthDuration -->
+    <!-- op:multiply-yearMonthDuration( $arg1 as xs:yearMonthDuration, $arg2 as xs:double)  as xs:yearMonthDuration -->
     <operator name="op:multiply-yearMonthDuration">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:double" />
-        <return type="xs:yearMonthDuration" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:double"/>
+        <return type="xs:yearMonthDuration"/>
     </operator>
 
-    <!-- op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+    <!-- op:node-after($parameter1  as node(), $parameter2 as node())  as xs:boolean -->
     <operator name="op:node-after">
-        <param name="parameter1" type="node()" />
-        <param name="parameter2" type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory" />
-        <return type="xs:boolean" />
+        <param name="parameter1" type="node()"/>
+        <param name="parameter2" type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeAfterEvaluatorFactory"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
+    <!-- op:node-before($parameter1  as node(), $parameter2 as node())  as xs:boolean -->
     <operator name="op:node-before">
-        <param name="parameter1" type="node()" />
-        <param name="parameter2" type="node()" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory" />
+        <param name="parameter1" type="node()"/>
+        <param name="parameter2" type="node()"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.OpNodeBeforeEvaluatorFactory"/>
     </operator>
 
-    <!-- op:NOTATION-equal($arg1 as xs:NOTATION, $arg2 as xs:NOTATION) as xs:boolean -->
+    <!-- op:NOTATION-equal($arg1  as xs:NOTATION, $arg2 as xs:NOTATION)  as xs:boolean -->
     <operator name="op:NOTATION-equal">
-        <param name="arg1" type="xs:NOTATION" />
-        <param name="arg2" type="xs:NOTATION" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:NOTATION"/>
+        <param name="arg2" type="xs:NOTATION"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <!-- op:numeric-add($arg1  as numeric, $arg2 as numeric)  as numeric -->
     <operator name="op:numeric-add">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xsext:numeric" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
     </operator>
 
-    <!-- op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <!-- op:numeric-divide($arg1  as numeric, $arg2 as numeric)  as numeric -->
     <operator name="op:numeric-divide">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xsext:numeric" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
     </operator>
 
-    <!-- op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <!-- op:numeric-equal($arg1  as numeric, $arg2 as numeric)  as xs:boolean -->
     <operator name="op:numeric-equal">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <!-- op:numeric-greater-than( $arg1 as numeric, $arg2 as numeric)  as xs:boolean -->
     <operator name="op:numeric-greater-than">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric) as xs:integer -->
+    <!-- op:numeric-integer-divide( $arg1 as numeric, $arg2 as numeric)  as xs:integer -->
     <operator name="op:numeric-integer-divide">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xs:integer" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xs:integer"/>
     </operator>
 
-    <!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric) as xs:boolean -->
+    <!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric)  as xs:boolean -->
     <operator name="op:numeric-less-than">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric -->
+    <!-- op:numeric-mod($arg1  as numeric, $arg2 as numeric)  as numeric -->
     <operator name="op:numeric-mod">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xsext:numeric" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
     </operator>
 
-    <!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric) as numeric -->
+    <!-- op:numeric-multiply( $arg1 as numeric, $arg2 as numeric)  as numeric -->
     <operator name="op:numeric-multiply">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xsext:numeric" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
     </operator>
 
-    <!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric) as numeric -->
+    <!-- op:numeric-subtract( $arg1 as numeric, $arg2 as numeric)  as numeric -->
     <operator name="op:numeric-subtract">
-        <param name="arg1" type="xsext:numeric" />
-        <param name="arg2" type="xsext:numeric" />
-        <return type="xsext:numeric" />
+        <param name="arg1" type="xsext:numeric"/>
+        <param name="arg2" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
     </operator>
 
-    <!-- op:numeric-unary-minus( $arg as numeric) as numeric -->
+    <!-- op:numeric-unary-minus( $arg as numeric) as  numeric -->
     <operator name="op:numeric-unary-minus">
-        <param name="arg1" type="xsext:numeric" />
-        <return type="xsext:numeric" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory" />
+        <param name="arg1" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.unary.NumericUnaryMinusScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- op:numeric-unary-plus( $arg as numeric) as numeric -->
+    <!-- op:numeric-unary-plus( $arg as numeric) as  numeric -->
     <operator name="op:numeric-unary-plus">
-        <param name="arg1" type="xsext:numeric" />
-        <return type="xsext:numeric" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory" />
+        <param name="arg1" type="xsext:numeric"/>
+        <return type="xsext:numeric"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.unary.NumericUnaryPlusScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean -->
+    <!-- op:QName-equal($arg1  as xs:QName, $arg2 as xs:QName)  as xs:boolean -->
     <operator name="op:QName-equal">
-        <param name="arg1" type="xs:QName" />
-        <param name="arg2" type="xs:QName" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:QName"/>
+        <param name="arg2" type="xs:QName"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration? -->
+    <!-- op:subtract-dates($arg1  as xs:date, $arg2 as xs:date)  as xs:dayTimeDuration? -->
     <operator name="op:subtract-dates">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:date" />
-        <return type="xs:dayTimeDuration?" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:date"/>
+        <return type="xs:dayTimeDuration?"/>
     </operator>
 
-    <!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime) 
-        as xs:dayTimeDuration? -->
+    <!-- op:subtract-dateTimes( $arg1 as xs:dateTime, $arg2 as xs:dateTime)  as xs:dayTimeDuration? -->
     <operator name="op:subtract-dateTimes">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dateTime" />
-        <return type="xs:dayTimeDuration?" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dateTime"/>
+        <return type="xs:dayTimeDuration?"/>
     </operator>
 
-    <!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration) 
-        as xs:date -->
+    <!-- op:subtract-dayTimeDuration-from-date( $arg1 as xs:date, $arg2 as xs:dayTimeDuration)  as xs:date -->
     <operator name="op:subtract-dayTimeDuration-from-date">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:date" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:date"/>
     </operator>
 
-    <!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 
-        as xs:dayTimeDuration) as xs:dateTime -->
+    <!-- op:subtract-dayTimeDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration)  as xs:dateTime -->
     <operator name="op:subtract-dayTimeDuration-from-dateTime">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:dateTime" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:dateTime"/>
     </operator>
 
-    <!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration) 
-        as xs:time -->
+    <!-- op:subtract-dayTimeDuration-from-time( $arg1 as xs:time, $arg2 as xs:dayTimeDuration)  as xs:time -->
     <operator name="op:subtract-dayTimeDuration-from-time">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:time" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:time"/>
     </operator>
 
-    <!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as 
-        xs:dayTimeDuration) as xs:dayTimeDuration -->
+    <!-- op:subtract-dayTimeDurations( $arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration)  as xs:dayTimeDuration -->
     <operator name="op:subtract-dayTimeDurations">
-        <param name="arg1" type="xs:dayTimeDuration" />
-        <param name="arg2" type="xs:dayTimeDuration" />
-        <return type="xs:dayTimeDuration" />
+        <param name="arg1" type="xs:dayTimeDuration"/>
+        <param name="arg2" type="xs:dayTimeDuration"/>
+        <return type="xs:dayTimeDuration"/>
     </operator>
 
-    <!-- op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration -->
+    <!-- op:subtract-times($arg1  as xs:time, $arg2 as xs:time)  as xs:dayTimeDuration -->
     <operator name="op:subtract-times">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:time" />
-        <return type="xs:dayTimeDuration" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:time"/>
+        <return type="xs:dayTimeDuration"/>
     </operator>
 
-    <!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as 
-        xs:yearMonthDuration) as xs:date -->
+    <!-- op:subtract-yearMonthDuration-from-date( $arg1 as xs:date, $arg2 as xs:yearMonthDuration)  as xs:date -->
     <operator name="op:subtract-yearMonthDuration-from-date">
-        <param name="arg1" type="xs:date" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:date" />
+        <param name="arg1" type="xs:date"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:date"/>
     </operator>
 
-    <!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, 
-        $arg2 as xs:yearMonthDuration) as xs:dateTime -->
+    <!-- op:subtract-yearMonthDuration-from-dateTime( $arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration)  as xs:dateTime -->
     <operator name="op:subtract-yearMonthDuration-from-dateTime">
-        <param name="arg1" type="xs:dateTime" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:dateTime" />
+        <param name="arg1" type="xs:dateTime"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:dateTime"/>
     </operator>
 
-    <!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 
-        as xs:yearMonthDuration) as xs:yearMonthDuration -->
+    <!-- op:subtract-yearMonthDurations( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:yearMonthDuration -->
     <operator name="op:subtract-yearMonthDurations">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:yearMonthDuration" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:yearMonthDuration"/>
     </operator>
 
-    <!-- op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <!-- op:time-equal($arg1  as xs:time, $arg2 as xs:time)  as xs:boolean -->
     <operator name="op:time-equal">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:time" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:time"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <!-- op:time-greater-than( $arg1 as xs:time, $arg2 as xs:time)  as xs:boolean -->
     <operator name="op:time-greater-than">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:time" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:time"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean -->
+    <!-- op:time-less-than($arg1  as xs:time, $arg2 as xs:time)  as xs:boolean -->
     <operator name="op:time-less-than">
-        <param name="arg1" type="xs:time" />
-        <param name="arg2" type="xs:time" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:time"/>
+        <param name="arg2" type="xs:time"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer* -->
+    <!-- op:to($firstval as  xs:integer, $lastval as xs:integer)  as xs:integer* -->
     <operator name="op:to">
-        <param name="firstval" type="xs:integer" />
-        <param name="lastval" type="xs:integer" />
-        <return type="xs:integer*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory" />
+        <param name="firstval" type="xs:integer"/>
+        <param name="lastval" type="xs:integer"/>
+        <return type="xs:integer*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.sequence.OpToScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- op:union($parameter1 as node()*, $parameter2 as node()*) as node()* -->
+    <!-- op:union($parameter1  as node()*, $parameter2 as node()*)  as node()* -->
     <operator name="op:union">
-        <param name="parameter1" type="node()*" />
-        <param name="parameter2" type="node()*" />
-        <return type="node()*" />
+        <param name="parameter1" type="node()*"/>
+        <param name="parameter2" type="node()*"/>
+        <return type="node()*"/>
         <!-- as we do the doc-order-sort and the duplicate elimination -->
         <!-- after the concatenation, we can reuse the concat iterator -->
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
-    <!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 
-        as xs:yearMonthDuration) as xs:boolean -->
+    <!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:boolean -->
     <operator name="op:yearMonthDuration-greater-than">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:boolean"/>
     </operator>
 
-    <!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 
-        as xs:yearMonthDuration) as xs:boolean -->
+    <!-- op:yearMonthDuration-less-than( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:boolean -->
     <operator name="op:yearMonthDuration-less-than">
-        <param name="arg1" type="xs:yearMonthDuration" />
-        <param name="arg2" type="xs:yearMonthDuration" />
-        <return type="xs:boolean" />
+        <param name="arg1" type="xs:yearMonthDuration"/>
+        <param name="arg2" type="xs:yearMonthDuration"/>
+        <return type="xs:boolean"/>
     </operator>
 
     <!-- fn:avg-local($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
     <operator name="opext:avg-local">
-        <param name="arg" type="xs:anyAtomicType*" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="aggregate"
-            class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory" />
+        <param name="arg" type="xs:anyAtomicType*"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.aggregate.AvgLocalAggregateEvaluatorFactory"/>
     </operator>
 
     <!-- fn:avg-global($arg as xs:anyAtomicType*) as xs:anyAtomicType? -->
     <operator name="opext:avg-global">
-        <param name="arg" type="xs:anyAtomicType*" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="aggregate"
-            class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory" />
+        <param name="arg" type="xs:anyAtomicType*"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.aggregate.AvgGlobalAggregateEvaluatorFactory"/>
     </operator>
 
     <!-- opext:ordered($arg as item()*) as item()* -->
     <operator name="opext:ordered">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
     </operator>
 
     <!-- opext:unordered($arg as item()*) as item()* -->
     <operator name="opext:unordered">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
     </operator>
 
-    <!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-eq($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-eq">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-ne">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueNeComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-lt">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueLtComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-le">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueLeComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-gt">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueGtComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:boolean? -->
+    <!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
     <operator name="opext:value-ge">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.ValueGeComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-eq">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralEqComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-ne">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralNeComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-lt">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLtComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-le">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralLeComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-gt">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGtComparisonScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
     <operator name="opext:general-ge">
-        <param name="arg1" type="item()*" />
-        <param name="arg2" type="item()*" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory" />
+        <param name="arg1" type="item()*"/>
+        <param name="arg2" type="item()*"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.comparison.general.GeneralGeComparisonScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
-        xs:anyAtomicType? -->
+    <!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:add">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.AddScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:anyAtomicType? -->
+    <!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:subtract">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.SubtractScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:anyAtomicType? -->
+    <!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:multiply">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.MultiplyScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:anyAtomicType? -->
+    <!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:divide">
-        <param name="arg1" type="xs:anyAtomicType?" />
-        <param name="arg2" type="xs:anyAtomicType?" />
-        <return type="xs:anyAtomicType?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:anyAtomicType?"/>
+        <param name="arg2" type="xs:anyAtomicType?"/>
+        <return type="xs:anyAtomicType?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.DivideScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) 
-        as xs:anyAtomicType? -->
+    <!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:idiv">
-        <param name="arg1" type="xsext:numeric?" />
-        <param name="arg2" type="xsext:numeric?" />
-        <return type="xs:integer?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory" />
+        <param name="arg1" type="xsext:numeric?"/>
+        <param name="arg2" type="xsext:numeric?"/>
+        <return type="xs:integer?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.IntegerDivideScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as 
-        xs:anyAtomicType? -->
+    <!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
     <operator name="opext:mod">
-        <param name="arg1" type="xsext:numeric?" />
-        <param name="arg2" type="xsext:numeric?" />
-        <return type="xs:integer?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory" />
+        <param name="arg1" type="xsext:numeric?"/>
+        <param name="arg2" type="xsext:numeric?"/>
+        <return type="xs:integer?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.arithmetic.ModScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
     <operator name="opext:and">
-        <param name="arg1" type="xs:boolean?" />
-        <param name="arg2" type="xs:boolean?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:boolean?"/>
+        <param name="arg2" type="xs:boolean?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.bool.AndScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
     <operator name="opext:or">
-        <param name="arg1" type="xs:boolean?" />
-        <param name="arg2" type="xs:boolean?" />
-        <return type="xs:boolean?" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory" />
+        <param name="arg1" type="xs:boolean?"/>
+        <param name="arg2" type="xs:boolean?"/>
+        <return type="xs:boolean?"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.bool.OrScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
     <operator name="opext:sort-nodes-asc">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-nodes-asc-or-atomics">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:sort-distinct-nodes-asc($arg as node()*) as node()* -->
     <operator name="opext:sort-distinct-nodes-asc">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
-
+    
     <!-- opext:sort-distinct-nodes-asc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-distinct-nodes-asc-or-atomics">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:distinct-nodes-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:distinct-nodes-or-atomics">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.nodeid.SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
     <operator name="opext:sort-nodes-desc">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-nodes-desc-or-atomics">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:sort-distinct-nodes-desc($arg as node()*) as node()* -->
     <operator name="opext:sort-distinct-nodes-desc">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:sort-distinct-nodes-desc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-distinct-nodes-desc-or-atomics">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
     </operator>
 
     <!-- opext:id-from-node($arg as item()) as xs:integer -->
     <operator name="opext:id-from-node">
-        <param name="arg" type="item()" />
-        <return type="xs:integer" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory" />
+        <param name="arg" type="item()"/>
+        <return type="xs:integer"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.IdFromNodeScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:local-id-from-node($arg as item()) as xs:int -->
     <operator name="opext:local-id-from-node">
-        <param name="arg" type="item()" />
-        <return type="xs:int" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory" />
+        <param name="arg" type="item()"/>
+        <return type="xs:int"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.LocalIdFromNodeScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:tree-id-from-node($arg as item()) as xs:int -->
     <operator name="opext:tree-id-from-node">
-        <param name="arg" type="item()" />
-        <return type="xs:int" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory" />
+        <param name="arg" type="item()"/>
+        <return type="xs:int"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.TreeIdFromNodeScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:deflate-sequences($arg as item()*) as item()* -->
     <operator name="opext:deflate-sequences">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
-    <!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as 
-        node() -->
+    <!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as node() -->
     <operator name="opext:pi-constructor">
-        <param name="target" type="xs:string" />
-        <param name="content" type="xs:string" />
-        <return type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory" />
+        <param name="target" type="xs:string"/>
+        <param name="content" type="xs:string"/>
+        <return type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.PINodeConstructorScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:comment-constructor($content as xs:string) as node() -->
     <operator name="opext:comment-constructor">
-        <param name="content" type="xs:string" />
-        <return type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory" />
+        <param name="content" type="xs:string"/>
+        <return type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.CommentNodeConstructorScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:element-constructor($name as xs:QName, $content as item()*) as 
-        node() -->
+    <!-- opext:element-constructor($name as xs:QName, $content as item()*) as node() -->
     <operator name="opext:element-constructor">
-        <param name="name" type="xs:QName" />
-        <param name="content" type="item()*" />
-        <return type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory" />
-    </operator>
-
-    <!-- opext:array-constructor($expression as node()) as node() -->
-    <operator name="opext:array-constructor">
-        <param name="expession" type="node()" />
-        <return type="item()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.ArrayNodeConstructorScalarEvaluatorFactory" />
+        <param name="name" type="xs:QName"/>
+        <param name="content" type="item()*"/>
+        <return type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.ElementNodeConstructorScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) 
-        as node() -->
+    <!-- opext:attribute-constructor($name as xs:QName, $content as xs:anyAtomicType*) as node() -->
     <operator name="opext:attribute-constructor">
-        <param name="name" type="xs:QName" />
-        <param name="content" type="xs:anyAtomicType*" />
-        <return type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory" />
+        <param name="name" type="xs:QName"/>
+        <param name="content" type="xs:anyAtomicType*"/>
+        <return type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.AttributeNodeConstructorScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:text-constructor($content as xs:anyAtomicType*) as node() -->
     <operator name="opext:text-constructor">
-        <param name="content" type="xs:anyAtomicType*" />
-        <return type="node()" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory" />
+        <param name="content" type="xs:anyAtomicType*"/>
+        <return type="node()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.TextNodeConstructorScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:document-constructor($content as node()) as node() -->
     <operator name="opext:document-constructor">
-        <param name="content" type="node()" />
-        <return type="node()" />
+        <param name="content" type="node()"/>
+        <return type="node()"/>
+    </operator>
+    
+    <!-- opext:array-constructor($expression as node()) as node() -->
+    <operator name="opext:array-constructor">
+        <param name="expession" type="node()"/>
+        <return type="item()"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.ArrayConstructorScalarEvaluatorFactory"/>
     </operator>
 
-    <!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else 
-        as item()*) as item()* -->
+    <!-- opext:if-then-else($condition as xs:boolean, $then as item()*, $else as item()*) as item()* -->
     <operator name="opext:if-then-else">
-        <param name="condition" type="xs:boolean" />
-        <param name="then" type="item()*" />
-        <param name="else" type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory" />
-        <return type="item()*" />
+        <param name="condition" type="xs:boolean"/>
+        <param name="then" type="item()*"/>
+        <param name="else" type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.conditional.IfThenElseScalarEvaluatorFactory"/>
+        <return type="item()*"/>
     </operator>
 
     <!-- opext:ancestor($arg as node()*) as node()* -->
     <operator name="opext:ancestor">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:ancestor-or-self($arg as node()*) as node()* -->
     <operator name="opext:ancestor-or-self">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:attribute($arg as node()*) as node()* -->
     <operator name="opext:attribute">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.AttributePathStepScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:child($arg as node()*) as node()* -->
     <operator name="opext:child">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory" />
-        <runtime type="unnesting"
-            class="org.apache.vxquery.runtime.functions.step.ChildPathStepUnnestingEvaluatorFactory" />
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.ChildPathStepScalarEvaluatorFactory"/>
+        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.step.ChildPathStepUnnestingEvaluatorFactory"/>
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:descendant($arg as node()*) as node()* -->
     <operator name="opext:descendant">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.step.DescendantPathStepScalarEvaluatorFactory" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.DescendantPathStepScalarEvaluatorFactory"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy"/>
     </operator>
 
     <!-- opext:descendant-or-self($arg as node()*) as node()* -->
     <operator name="opext:descendant-or-self">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepScalarEvaluatorFactory" />
-        <runtime type="unnesting"
-            class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepUnnestingEvaluatorFactory" />
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepScalarEvaluatorFactory"/>
+        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.step.DescendantOrSelfPathStepUnnestingEvaluatorFactory"/>
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodesNOPropagationPolicy"/>
     </operator>
 
     <!-- opext:following($arg as node()*) as node()* -->
     <operator name="opext:following">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:following-sibling($arg as node()*) as node()* -->
     <operator name="opext:following-sibling">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:parent($arg as node()*) as node()* -->
     <operator name="opext:parent">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:preceding($arg as node()*) as node()* -->
     <operator name="opext:preceding">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:preceding-sibling($arg as node()*) as node()* -->
     <operator name="opext:preceding-sibling">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
     </operator>
 
     <!-- opext:self($arg as node()*) as node()* -->
     <operator name="opext:self">
-        <param name="arg" type="node()*" />
-        <return type="node()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.step.SelfPathStepScalarEvaluatorFactory" />
+        <param name="arg" type="node()*"/>
+        <return type="node()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.step.SelfPathStepScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:sequence($arg as item()*) as item()* -->
     <operator name="opext:sequence">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
-        <runtime type="aggregate"
-            class="org.apache.vxquery.runtime.functions.sequence.SequenceAggregateEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
+        <runtime type="aggregate" class="org.apache.vxquery.runtime.functions.sequence.SequenceAggregateEvaluatorFactory"/>
     </operator>
 
     <!-- opext:iterate($arg as item()*) as item() -->
     <operator name="opext:iterate">
-        <param name="arg" type="item()*" />
-        <return type="item()" />
-        <runtime type="unnesting"
-            class="org.apache.vxquery.runtime.functions.sequence.IterateUnnestingEvaluatorFactory" />
-        <property type="DocumentOrder"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <param name="arg" type="item()*"/>
+        <return type="item()"/>
+        <runtime type="unnesting" class="org.apache.vxquery.runtime.functions.sequence.IterateUnnestingEvaluatorFactory"/>
+        <property type="DocumentOrder" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
-        <property type="UniqueNodes"
-            class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
-            <argument value="0" />
+        <property type="UniqueNodes" class="org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.InputPropertyPropagationPolicy">
+            <argument value="0"/>
         </property>
     </operator>
 
     <!-- opext:validate-lax($arg as item()*) as item()* -->
     <operator name="opext:validate-lax">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
     </operator>
 
     <!-- opext:validate-strict($arg as item()*) as item()* -->
     <operator name="opext:validate-strict">
-        <param name="arg" type="item()*" />
-        <return type="item()*" />
+        <param name="arg" type="item()*"/>
+        <return type="item()*"/>
     </operator>
 
     <!-- opext:promote($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:promote">
-        <param name="arg" type="item()*" />
-        <param name="type" type="xs:int" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.type.PromoteScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <param name="type" type="xs:int"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.PromoteScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:treat($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:treat">
-        <param name="arg" type="item()*" />
-        <param name="type" type="xs:int" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.type.TreatScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <param name="type" type="xs:int"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.TreatScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:cast($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:cast">
-        <param name="arg" type="item()*" />
-        <param name="type" type="xs:int" />
-        <return type="item()*" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.cast.CastScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <param name="type" type="xs:int"/>
+        <return type="item()*"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.cast.CastScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:castable($arg as item()*, $type as xsext:type) as xs:boolean -->
     <operator name="opext:castable">
-        <param name="arg" type="item()*" />
-        <param name="type" type="xs:int" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.castable.CastableScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <param name="type" type="xs:int"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.castable.CastableScalarEvaluatorFactory"/>
     </operator>
 
     <!-- opext:instance-of($arg as item()*, $type as xsext:type) as xs:boolean -->
     <operator name="opext:instance-of">
-        <param name="arg" type="item()*" />
-        <param name="type" type="xs:int" />
-        <return type="xs:boolean" />
-        <runtime type="scalar"
-            class="org.apache.vxquery.runtime.functions.type.InstanceOfScalarEvaluatorFactory" />
+        <param name="arg" type="item()*"/>
+        <param name="type" type="xs:int"/>
+        <return type="xs:boolean"/>
+        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.type.InstanceOfScalarEvaluatorFactory"/>
     </operator>
 </operators>


[02/19] vxquery git commit: Merge branch 'pavlopoulou/newjsonparser' into pavlopoulou/newmaster/jsonparser

Posted by pr...@apache.org.
Merge branch 'pavlopoulou/newjsonparser' into pavlopoulou/newmaster/jsonparser


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/6c7dd292
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/6c7dd292
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/6c7dd292

Branch: refs/heads/master
Commit: 6c7dd2924d26e091d261a4e8729b1c46dfc83599
Parents: 2b59326 2410db8
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Wed May 25 14:24:30 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Wed May 25 14:24:30 2016 -0700

----------------------------------------------------------------------
 .../org/apache/vxquery/xmlquery/ast/ASTTag.java | 92 +++++++++++++++++++-
 .../xmlquery/ast/ArrayConstructorNode.java      | 27 ++++++
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 42 +++++++++
 3 files changed, 160 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[06/19] vxquery git commit: changing format

Posted by pr...@apache.org.
changing format


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/c292e450
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/c292e450
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/c292e450

Branch: refs/heads/master
Commit: c292e4506bf45301b0b787df41a0dc5583a84ff8
Parents: 39328ab
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Fri Jun 3 17:28:11 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Fri Jun 3 17:28:11 2016 -0700

----------------------------------------------------------------------
 vxquery-core/src/main/javacc/xquery-grammar.jj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/c292e450/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 115531d..7ea478c 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -2460,7 +2460,7 @@ ASTNode ArrayConstructor()  :
     Token start;
 }
 {
-    (start="[") expr=Expr() "]" {
+    (start="[") expr = Expr() "]" {
         ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
         an.setExpression(expr);
         return an;


[05/19] vxquery git commit: Adding ArrayConstructorNode and correct format

Posted by pr...@apache.org.
Adding ArrayConstructorNode and correct format


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/39328ab0
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/39328ab0
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/39328ab0

Branch: refs/heads/master
Commit: 39328ab0e51a7455b793f51c4be60f6214a18979
Parents: 609930e
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Thu Jun 2 17:00:25 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Thu Jun 2 17:00:25 2016 -0700

----------------------------------------------------------------------
 vxquery-core/src/main/javacc/xquery-grammar.jj | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/39328ab0/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index a1d9de9..115531d 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -97,7 +97,7 @@ public class XMLQuery {
 
 PARSER_END(XMLQuery)
 
-	
+    
 
 TOKEN_MGR_DECLS : {
   public Stack<Integer> stateStack = new Stack<Integer>();
@@ -105,7 +105,7 @@ TOKEN_MGR_DECLS : {
   public int offset = 0;
   
   
-  void CommonTokenAction(Token t) {}	
+  void CommonTokenAction(Token t) {}    
 
   
   /**
@@ -148,13 +148,13 @@ TOKEN_MGR_DECLS : {
    */
   private boolean isState(int state)
   {
-	for (int i = 0; i < stateStack.size(); i++) {
+    for (int i = 0; i < stateStack.size(); i++) {
         if(stateStack.elementAt(i) == state)
         {
-        	return true;
+            return true;
         }
-	}
-	return false;
+    }
+    return false;
   }
 
   /**
@@ -2450,8 +2450,8 @@ ASTNode JsonConstructor()  :
 {
     result = ArrayConstructor()
     {
-	    return result;
-	}
+        return result;
+    }
 }
 
 ASTNode ArrayConstructor()  :
@@ -2463,7 +2463,7 @@ ASTNode ArrayConstructor()  :
     (start="[") expr=Expr() "]" {
         ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
         an.setExpression(expr);
-	    return an;
+        return an;
     }
 }
 
@@ -2825,7 +2825,7 @@ void FTSelection()  :
 void FTOrExpr()  : 
 {}
 {
-	FTOr()
+    FTOr()
 }
 
 void FTOr()  : 


[12/19] vxquery git commit: Working on some corrections

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/b93e4584/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
index 924e2c0..05f4498 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ArrayNodeConstructorScalarEvaluator.java
@@ -44,16 +44,20 @@ public class ArrayNodeConstructorScalarEvaluator extends AbstractNodeConstructor
             throws IOException, SystemException {
         ab.reset(mvs);
         TaggedValuePointable arg = args[0];
-        TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class);
         if (arg.getTag() == ValueTag.SEQUENCE_TAG) {
-            arg.getValue(sp);
-            for (int i = 0; i < sp.getEntryCount(); ++i) {
-                sp.getEntry(i, tempTvp);
-                ab.addItem(tempTvp);
+            TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class);
+            try {
+                arg.getValue(sp);
+                for (int i = 0; i < sp.getEntryCount(); ++i) {
+                    sp.getEntry(i, tempTvp);
+                    ab.addItem(tempTvp);
+                }
+            } finally {
+                ppool.giveBack(tempTvp);
             }
-            ppool.giveBack(tempTvp);
+        } else {
+            ab.addItem(arg);
         }
-
         ab.finish();
     }
 


[17/19] vxquery git commit: merge master

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveAnalyzer.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveAnalyzer.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveAnalyzer.java
new file mode 100644
index 0000000..803aeee
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveAnalyzer.java
@@ -0,0 +1,144 @@
+/*
+ * 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.index;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.core.StopAnalyzer;
+import org.apache.lucene.analysis.core.StopFilter;
+import org.apache.lucene.analysis.standard.ClassicAnalyzer;
+import org.apache.lucene.analysis.standard.ClassicTokenizer;
+import org.apache.lucene.analysis.standard.StandardFilter;
+import org.apache.lucene.analysis.standard.StandardTokenizer;
+import org.apache.lucene.analysis.standard.std40.StandardTokenizer40;
+import org.apache.lucene.analysis.util.CharArraySet;
+import org.apache.lucene.analysis.util.StopwordAnalyzerBase;
+import org.apache.lucene.analysis.util.WordlistLoader;
+import org.apache.lucene.util.Version;
+
+/**
+ * Filters {@link StandardTokenizer} with {@link StandardFilter},
+ * and {@link StopFilter}, using a list of
+ * English stop words.
+ * <a name="version"/>
+ * <p>
+ * You must specify the required {@link Version}
+ * compatibility when creating StandardAnalyzer:
+ * <ul>
+ * <li>As of 3.4, Hiragana and Han characters are no longer wrongly split
+ * from their combining characters. If you use a previous version number,
+ * you get the exact broken behavior for backwards compatibility.
+ * <li>As of 3.1, StandardTokenizer implements Unicode text segmentation,
+ * and StopFilter correctly handles Unicode 4.0 supplementary characters
+ * in stopwords. {@link ClassicTokenizer} and {@link ClassicAnalyzer}
+ * are the pre-3.1 implementations of StandardTokenizer and
+ * StandardAnalyzer.
+ * <li>As of 2.9, StopFilter preserves position increments
+ * <li>As of 2.4, Tokens incorrectly identified as acronyms
+ * are corrected (see <a href="https://issues.apache.org/jira/browse/LUCENE-1068">LUCENE-1068</a>)
+ * </ul>
+ */
+public final class CaseSensitiveAnalyzer extends StopwordAnalyzerBase {
+
+    /** Default maximum allowed token length */
+    public static final int DEFAULT_MAX_TOKEN_LENGTH = 255;
+
+    private int maxTokenLength = DEFAULT_MAX_TOKEN_LENGTH;
+
+    /**
+     * An unmodifiable set containing some common English words that are usually not
+     * useful for searching.
+     */
+    public static final CharArraySet STOP_WORDS_SET = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
+
+    /**
+     * Builds an analyzer with the given stop words.
+     * 
+     * @param stopWords
+     *            stop words
+     */
+    public CaseSensitiveAnalyzer(CharArraySet stopWords) {
+        super(stopWords);
+    }
+
+    /**
+     * Builds an analyzer with the default stop words ({@link #STOP_WORDS_SET}).
+     */
+    public CaseSensitiveAnalyzer() {
+        this(STOP_WORDS_SET);
+    }
+
+    /**
+     * Builds an analyzer with the stop words from the given reader.
+     * 
+     * @see WordlistLoader#getWordSet(Reader)
+     * @param stopwords
+     *            Reader to read stop words from
+     */
+    public CaseSensitiveAnalyzer(Reader stopwords) throws IOException {
+        this(loadStopwordSet(stopwords));
+    }
+
+    /**
+     * Set maximum allowed token length. If a token is seen
+     * that exceeds this length then it is discarded. This
+     * setting only takes effect the next time tokenStream or
+     * tokenStream is called.
+     */
+    public void setMaxTokenLength(int length) {
+        maxTokenLength = length;
+    }
+
+    /**
+     * @see #setMaxTokenLength
+     */
+    public int getMaxTokenLength() {
+        return maxTokenLength;
+    }
+
+    @Override
+    protected TokenStreamComponents createComponents(final String fieldName) {
+        final Tokenizer src;
+        if (getVersion().onOrAfter(Version.LUCENE_4_7_0)) {
+            StandardTokenizer t = new StandardTokenizer();
+            t.setMaxTokenLength(maxTokenLength);
+            src = t;
+        } else {
+            StandardTokenizer40 t = new StandardTokenizer40();
+            t.setMaxTokenLength(maxTokenLength);
+            src = t;
+        }
+        TokenStream tok = new StandardFilter(src);
+        tok = new StopFilter(tok, stopwords);
+        return new TokenStreamComponents(src, tok) {
+            @Override
+            protected void setReader(final Reader reader) {
+                int m = CaseSensitiveAnalyzer.this.maxTokenLength;
+                if (src instanceof StandardTokenizer) {
+                    ((StandardTokenizer) src).setMaxTokenLength(m);
+                } else {
+                    ((StandardTokenizer40) src).setMaxTokenLength(m);
+                }
+                super.setReader(reader);
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveQueryParser.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveQueryParser.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveQueryParser.java
new file mode 100644
index 0000000..7cb0a18
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CaseSensitiveQueryParser.java
@@ -0,0 +1,42 @@
+/*
+* 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.index;
+
+import java.io.StringReader;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.queryparser.classic.FastCharStream;
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.queryparser.classic.QueryParser;
+import org.apache.lucene.search.Query;
+
+public class CaseSensitiveQueryParser extends QueryParser {
+
+    public CaseSensitiveQueryParser(String f, Analyzer a) {
+        super(new FastCharStream(new StringReader("")));
+        init(f, a);
+    }
+
+    @Override
+    protected Query getPrefixQuery(String field, String termStr) throws ParseException {
+        if (!getAllowLeadingWildcard() && termStr.startsWith("*"))
+            throw new ParseException("'*' not allowed as first character in PrefixQuery");
+        Term t = new Term(field, termStr);
+        return newPrefixQuery(t);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CollectionFromIndexUnnestingEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CollectionFromIndexUnnestingEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CollectionFromIndexUnnestingEvaluatorFactory.java
new file mode 100644
index 0000000..cf0b203
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/CollectionFromIndexUnnestingEvaluatorFactory.java
@@ -0,0 +1,327 @@
+/*
+ * 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.index;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+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.algebricks.runtime.base.IUnnestingEvaluator;
+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.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.queryparser.classic.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.exceptions.ErrorCode;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.index.IndexAttributes;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluator;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluatorFactory;
+import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.SAXContentHandler;
+import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class CollectionFromIndexUnnestingEvaluatorFactory extends AbstractTaggedValueArgumentUnnestingEvaluatorFactory {
+    private static final long serialVersionUID = 1L;
+
+    public CollectionFromIndexUnnestingEvaluatorFactory(IScalarEvaluatorFactory[] args) {
+        super(args);
+    }
+
+    @Override
+    protected IUnnestingEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
+            throws AlgebricksException {
+
+        return new AbstractTaggedValueArgumentUnnestingEvaluator(args) {
+
+            private ArrayBackedValueStorage nodeAbvs = new ArrayBackedValueStorage();
+
+            private int indexPlace;
+            private int indexLength;
+            private String elementPath;
+            private String indexName;
+
+            private UTF8StringPointable stringIndexFolder = (UTF8StringPointable) UTF8StringPointable.FACTORY
+                    .createPointable();
+            private UTF8StringPointable stringElementPath = (UTF8StringPointable) UTF8StringPointable.FACTORY
+                    .createPointable();
+            private ByteBufferInputStream bbis = new ByteBufferInputStream();
+            private DataInputStream di = new DataInputStream(bbis);
+
+            private IndexReader reader;
+            private IndexSearcher searcher;
+            private Analyzer analyzer;
+            private QueryParser parser;
+            private ScoreDoc[] hits;
+            private SAXContentHandler handler;
+            private Query query;
+            private Document doc;
+            private List<IndexableField> fields;
+
+            @Override
+            public boolean step(IPointable result) throws AlgebricksException {
+                /* each step will create a tuple for a single xml file
+                 * This is done using the parse function
+                 * checkoverflow is used throughout. This is because memory might not be
+                 * able to hold all of the results at once, so we return 1 million at
+                 * a time and check when we need to get more
+                 */
+                if (indexPlace < indexLength) {
+                    nodeAbvs.reset();
+                    try {
+                        //TODO: now we get back the entire document
+                        doc = searcher.doc(hits[indexPlace].doc);
+                        fields = doc.getFields();
+                        parse(nodeAbvs);
+                    } catch (IOException e) {
+                        throw new AlgebricksException(e);
+                    }
+                    indexPlace += 1;
+                    result.set(nodeAbvs.getByteArray(), nodeAbvs.getStartOffset(), nodeAbvs.getLength());
+                    return true;
+                }
+                return false;
+            }
+
+            @Override
+            protected void init(TaggedValuePointable[] args) throws SystemException {
+
+                int partition = ctxview.getTaskAttemptId().getTaskId().getPartition();
+                ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition);
+                handler = new SAXContentHandler(false, nodeIdProvider, true);
+
+                nodeAbvs.reset();
+                indexPlace = 0;
+                TaggedValuePointable tvp1 = args[0];
+                TaggedValuePointable tvp2 = args[1];
+
+                if (tvp1.getTag() != ValueTag.XS_STRING_TAG || tvp2.getTag() != ValueTag.XS_STRING_TAG) {
+                    throw new SystemException(ErrorCode.FORG0006);
+                }
+                tvp1.getValue(stringIndexFolder);
+                tvp2.getValue(stringElementPath);
+                //This whole loop is to get the string arguments, indefolder, elementpath, and match option
+                try {
+                    // Get the list of files.
+                    bbis.setByteBuffer(ByteBuffer.wrap(
+                            Arrays.copyOfRange(stringIndexFolder.getByteArray(), stringIndexFolder.getStartOffset(),
+                                    stringIndexFolder.getLength() + stringIndexFolder.getStartOffset())),
+                            0);
+                    indexName = di.readUTF();
+                    bbis.setByteBuffer(ByteBuffer.wrap(
+                            Arrays.copyOfRange(stringElementPath.getByteArray(), stringElementPath.getStartOffset(),
+                                    stringElementPath.getLength() + stringElementPath.getStartOffset())),
+                            0);
+                    elementPath = di.readUTF();
+
+                    indexPlace = 0;
+
+                    //Create the index reader.
+                    reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexName)));
+                } catch (IOException e) {
+                    throw new SystemException(ErrorCode.SYSE0001, e);
+                }
+
+                searcher = new IndexSearcher(reader);
+                analyzer = new CaseSensitiveAnalyzer();
+
+                parser = new CaseSensitiveQueryParser("item", analyzer);
+
+                String queryString = elementPath.replaceAll("/", ".");
+                queryString = "item:" + queryString + "*";
+
+                int lastslash = elementPath.lastIndexOf("/");
+                elementPath = elementPath.substring(0, lastslash) + ":" + elementPath.substring(lastslash + 1);
+                elementPath = elementPath.replaceAll("/", ".") + ".element";
+
+                TopDocs results = null;
+                try {
+                    query = parser.parse(queryString);
+
+                    //TODO: Right now it only returns 1000000 results
+                    results = searcher.search(query, 1000000);
+
+                } catch (Exception e) {
+                    throw new SystemException(null);
+                }
+
+                hits = results.scoreDocs;
+                System.out.println("found: " + results.totalHits);
+                indexPlace = 0;
+                indexLength = hits.length;
+
+            }
+
+            public void parse(ArrayBackedValueStorage abvsFileNode) throws IOException {
+                try {
+                    handler.startDocument();
+
+                    for (int i = 0; i < fields.size(); i++) {
+                        String fieldValue = fields.get(i).stringValue();
+                        if (fieldValue.equals(elementPath)) {
+                            buildElement(abvsFileNode, i);
+                        }
+                    }
+
+                    handler.endDocument();
+                    handler.writeDocument(abvsFileNode);
+                } catch (Exception e) {
+                    throw new IOException(e);
+                }
+            }
+
+            private int buildElement(ArrayBackedValueStorage abvsFileNode, int fieldNum) throws SAXException {
+                int whereIFinish = fieldNum;
+                IndexableField field = fields.get(fieldNum);
+                String contents = field.stringValue();
+                String uri = "";
+
+                int firstColon = contents.indexOf(':');
+                int lastDot = contents.lastIndexOf('.');
+                String type = contents.substring(lastDot + 1);
+                String lastBit = contents.substring(firstColon + 1, lastDot);
+
+                if (type.equals("textnode")) {
+                    char[] charContents = lastBit.toCharArray();
+                    handler.characters(charContents, 0, charContents.length);
+
+                }
+                if (type.equals("element")) {
+                    List<String> names = new ArrayList<String>();
+                    List<String> values = new ArrayList<String>();
+                    List<String> uris = new ArrayList<String>();
+                    List<String> localNames = new ArrayList<String>();
+                    List<String> types = new ArrayList<String>();
+                    List<String> qNames = new ArrayList<String>();
+                    whereIFinish = findAttributeChildren(whereIFinish, names, values, uris, localNames, types, qNames);
+                    Attributes atts = new IndexAttributes(names, values, uris, localNames, types, qNames);
+
+                    handler.startElement(uri, lastBit, lastBit, atts);
+
+                    boolean noMoreChildren = false;
+
+                    while (whereIFinish + 1 < fields.size() && !noMoreChildren) {
+                        if (isChild(fields.get(whereIFinish + 1), field)) {
+                            whereIFinish = buildElement(abvsFileNode, whereIFinish + 1);
+                        } else {
+                            noMoreChildren = true;
+                        }
+                    }
+
+                    handler.endElement(uri, lastBit, lastBit);
+
+                }
+                return whereIFinish;
+            }
+
+            /*This function creates the attribute children for an element node
+             * 
+             */
+            int findAttributeChildren(int fieldnum, List<String> n, List<String> v, List<String> u, List<String> l,
+                    List<String> t, List<String> q) {
+                int nextindex = fieldnum + 1;
+                boolean foundattributes = false;
+                if (nextindex < fields.size()) {
+                    IndexableField nextguy;
+
+                    while (nextindex < fields.size()) {
+                        nextguy = fields.get(nextindex);
+                        String contents = nextguy.stringValue();
+                        int firstcolon = contents.indexOf(':');
+                        int lastdot = contents.lastIndexOf('.');
+                        String lastbit = contents.substring(firstcolon + 1, lastdot);
+
+                        if (isDirectChildAttribute(nextguy, fields.get(fieldnum))) {
+                            foundattributes = true;
+                            n.add(lastbit);
+                            IndexableField nextnextguy = fields.get(nextindex + 1);
+                            contents = nextnextguy.stringValue();
+                            firstcolon = contents.indexOf(':');
+                            lastdot = contents.lastIndexOf('.');
+                            String nextlastbit = contents.substring(firstcolon + 1, lastdot);
+                            v.add(nextlastbit);
+                            u.add(lastbit);
+                            l.add(lastbit);
+                            t.add(lastbit);
+                            q.add(lastbit);
+                        } else {
+                            break;
+                        }
+                        nextindex += 2;
+                    }
+                }
+                if (foundattributes) {
+                    return nextindex - 1;
+
+                } else {
+                    return fieldnum;
+                }
+            }
+
+            boolean isChild(IndexableField child, IndexableField adult) {
+                String childId = child.stringValue();
+                String adultId = adult.stringValue();
+
+                int lastDotChild = childId.lastIndexOf('.');
+                int lastDotAdult = adultId.lastIndexOf('.');
+
+                String childPath = childId.substring(0, lastDotChild);
+                String adultPath = adultId.substring(0, lastDotAdult);
+                adultPath = adultPath.replaceFirst(":", ".");
+
+                return (childPath.startsWith(adultPath + ":") || childPath.startsWith(adultPath + "."));
+            }
+
+            boolean isDirectChildAttribute(IndexableField child, IndexableField adult) {
+                String childId = child.stringValue();
+                String adultId = adult.stringValue();
+
+                String childPath = childId.substring(0, childId.lastIndexOf('.'));
+                String adultPath = adultId.substring(0, adultId.lastIndexOf('.'));
+                adultPath = adultPath.replaceFirst(":", ".");
+                String[] childSegments = child.stringValue().split("\\.");
+
+                String childType = childSegments[childSegments.length - 1];
+
+                return (childPath.startsWith(adultPath + ":") && childType.equals("attribute"));
+            }
+
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorScalarEvaluatorFactory.java
new file mode 100644
index 0000000..c3776d9
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorScalarEvaluatorFactory.java
@@ -0,0 +1,70 @@
+/*
+* 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.index;
+
+import java.io.DataInputStream;
+
+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.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
+import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
+
+public class IndexConstructorScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
+    //Creates one Lucene doc per file
+
+    private static final long serialVersionUID = 1L;
+
+    public IndexConstructorScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
+        super(args);
+    }
+
+    @Override
+    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
+            throws AlgebricksException {
+        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
+        final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
+        final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        final ByteBufferInputStream bbis = new ByteBufferInputStream();
+        final DataInputStream di = new DataInputStream(bbis);
+        final SequenceBuilder sb = new SequenceBuilder();
+        final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage();
+        final int partition = ctx.getTaskAttemptId().getTaskId().getPartition();
+        final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId();
+        final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition);
+
+        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
+
+            @Override
+            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+                IndexConstructorUtil.evaluate(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode,
+                        nodep, false, nodeId);
+            }
+
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorUtil.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorUtil.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorUtil.java
new file mode 100644
index 0000000..7191827
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/IndexConstructorUtil.java
@@ -0,0 +1,144 @@
+/*
+* 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.index;
+
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+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.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+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.index.IndexDocumentBuilder;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
+import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.XMLParser;
+
+public class IndexConstructorUtil {
+    public static void evaluate(TaggedValuePointable[] args, IPointable result, UTF8StringPointable stringp,
+            ByteBufferInputStream bbis, DataInputStream di, SequenceBuilder sb, ArrayBackedValueStorage abvs,
+            ITreeNodeIdProvider nodeIdProvider, ArrayBackedValueStorage abvsFileNode, TaggedValuePointable nodep,
+            boolean isElementPath, String nodeId) throws SystemException {
+        String collectionFolder;
+        String indexFolder;
+        TaggedValuePointable collectionTVP = args[0];
+        TaggedValuePointable indexTVP = args[1];
+
+        if (collectionTVP.getTag() != ValueTag.XS_STRING_TAG || indexTVP.getTag() != ValueTag.XS_STRING_TAG) {
+            throw new SystemException(ErrorCode.FORG0006);
+        }
+
+        try {
+            // Get the list of files.
+            collectionTVP.getValue(stringp);
+            bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
+                    stringp.getLength() + stringp.getStartOffset())), 0);
+            collectionFolder = di.readUTF();
+
+            // Get the index folder
+            indexTVP.getValue(stringp);
+            bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
+                    stringp.getLength() + stringp.getStartOffset())), 0);
+            indexFolder = di.readUTF();
+        } catch (IOException e) {
+            throw new SystemException(ErrorCode.SYSE0001, e);
+        }
+        File collectionDirectory = new File(collectionFolder);
+        if (!collectionDirectory.exists()) {
+            throw new RuntimeException("The collection directory (" + collectionFolder + ") does not exist.");
+        }
+
+        try {
+            abvs.reset();
+            sb.reset(abvs);
+
+            Directory dir = FSDirectory.open(Paths.get(indexFolder));
+            Analyzer analyzer = new CaseSensitiveAnalyzer();
+            IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
+
+            // Create will overwrite the index everytime
+            iwc.setOpenMode(OpenMode.CREATE);
+
+            //Create an index writer
+            IndexWriter writer = new IndexWriter(dir, iwc);
+
+            //Add files to index
+            indexXmlFiles(collectionDirectory, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di,
+                    nodeId);
+
+            //This makes write slower but search faster.
+            writer.forceMerge(1);
+
+            writer.close();
+
+            sb.finish();
+            result.set(abvs);
+        } catch (IOException e) {
+            throw new SystemException(ErrorCode.SYSE0001, e);
+        }
+    }
+
+    /*This function goes recursively one file at a time. First it turns the file into an ABVS document node, then
+     * it indexes that document node.
+     */
+    public static void indexXmlFiles(File collectionDirectory, IndexWriter writer, boolean isElementPath,
+            TaggedValuePointable nodep, ArrayBackedValueStorage abvsFileNode, ITreeNodeIdProvider nodeIdProvider,
+            SequenceBuilder sb, ByteBufferInputStream bbis, DataInputStream di, String nodeId)
+                    throws SystemException, IOException {
+        for (File file : collectionDirectory.listFiles()) {
+
+            if (readableXmlFile(file.getPath())) {
+                abvsFileNode.reset();
+                // Get the document node
+                XMLParser parser = new XMLParser(false, nodeIdProvider, nodeId);
+                FunctionHelper.readInDocFromString(file.getPath(), bbis, di, abvsFileNode, parser);
+
+                nodep.set(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(), abvsFileNode.getLength());
+
+                //Add the document to the index
+                //Creates one lucene doc per file
+                IndexDocumentBuilder ibuilder = new IndexDocumentBuilder(nodep, writer);
+
+                ibuilder.printStart();
+
+            } else if (file.isDirectory()) {
+                // Consider all XML file in sub directories.
+                indexXmlFiles(file, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di, nodeId);
+            }
+        }
+    }
+
+    public static boolean readableXmlFile(String path) {
+        return (path.toLowerCase().endsWith(".xml") || path.toLowerCase().endsWith(".xml.gz"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index d394bbc..b6668ba 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -480,7 +480,7 @@ public class FunctionHelper {
 
     public static boolean compareTaggedValues(AbstractValueComparisonOperation aOp, TaggedValuePointable tvp1,
             TaggedValuePointable tvp2, DynamicContext dCtx, TypedPointables tp1, TypedPointables tp2)
-            throws SystemException {
+                    throws SystemException {
         int tid1 = getBaseTypeForComparisons(tvp1.getTag());
         int tid2 = getBaseTypeForComparisons(tvp2.getTag());
 
@@ -1217,6 +1217,11 @@ public class FunctionHelper {
         } catch (SystemException e) {
             throw new HyracksDataException(e);
         }
+        readInDocFromString(fName, bbis, di, abvs, parser);
+    }
+
+    public static void readInDocFromString(String fName, ByteBufferInputStream bbis, DataInputStream di,
+            ArrayBackedValueStorage abvs, XMLParser parser) throws HyracksDataException {
         if (!fName.contains("hdfs:/")) {
             File file = new File(fName);
             if (file.exists()) {

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
index 03a125b..846c27b 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
@@ -51,40 +51,41 @@ import org.xml.sax.ext.LexicalHandler;
 
 public class SAXContentHandler implements ContentHandler, LexicalHandler {
     // XML node builders
-    private final AttributeNodeBuilder anb;
-    private final CommentNodeBuilder cnb;
-    private final DictionaryBuilder db;
-    private final DocumentNodeBuilder docb;
-    private final PINodeBuilder pinb;
-    private final TextNodeBuilder tnb;
-    private final UTF8StringBuilder utf8b;
-    private final List<ElementNodeBuilder> enbStack;
-    private final List<ElementNodeBuilder> freeENBList;
+    protected final AttributeNodeBuilder anb;
+    protected final CommentNodeBuilder cnb;
+    protected final DictionaryBuilder db;
+    protected final DocumentNodeBuilder docb;
+    protected final PINodeBuilder pinb;
+    protected final TextNodeBuilder tnb;
+    protected final UTF8StringBuilder utf8b;
+    protected final List<ElementNodeBuilder> enbStack;
+    protected final List<ElementNodeBuilder> freeENBList;
+    protected boolean isIndexHandler;
 
     // Frame writing variables
-    private IFrameFieldAppender appender;
+    protected IFrameFieldAppender appender;
     private int tupleIndex;
     private IFrameWriter writer;
 
     // Element writing and path step variables
-    private boolean skipping;
+    protected boolean skipping;
     private String[] childLocalName = null;
     private String[] childUri = null;
     private boolean[] subElement = null;
     private final TaggedValuePointable tvp;
 
     // Basic tracking and setting variables
-    private final boolean attachTypes;
-    private final boolean createNodeIds;
+    protected final boolean attachTypes;
+    protected final boolean createNodeIds;
     private int depth;
-    private final ArrayBackedValueStorage resultABVS;
-    private boolean pendingText;
-    private int nodeIdCounter;
-    private final ITreeNodeIdProvider nodeIdProvider;
-    private final ArrayBackedValueStorage tempABVS;
+    protected final ArrayBackedValueStorage resultABVS;
+    protected boolean pendingText;
+    protected int nodeIdCounter;
+    protected final ITreeNodeIdProvider nodeIdProvider;
+    protected final ArrayBackedValueStorage tempABVS;
     private final ArrayBackedValueStorage textABVS;
 
-    public SAXContentHandler(boolean attachTypes, ITreeNodeIdProvider nodeIdProvider) {
+    public SAXContentHandler(boolean attachTypes, ITreeNodeIdProvider nodeIdProvider, boolean isIndexHandler) {
         // XML node builders
         anb = new AttributeNodeBuilder();
         cnb = new CommentNodeBuilder();
@@ -110,11 +111,16 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
         this.nodeIdProvider = nodeIdProvider;
         tempABVS = new ArrayBackedValueStorage();
         textABVS = new ArrayBackedValueStorage();
+        this.isIndexHandler = isIndexHandler;
+        if (isIndexHandler) {
+            this.appender = null;
+            this.skipping = false;
+        }
     }
 
     public SAXContentHandler(boolean attachTypes, ITreeNodeIdProvider nodeIdProvider, IFrameFieldAppender appender,
             List<SequenceType> childSequenceTypes) {
-        this(attachTypes, nodeIdProvider);
+        this(attachTypes, nodeIdProvider, false);
 
         // Frame writing variables
         this.appender = appender;
@@ -189,16 +195,21 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
             return;
         }
         try {
-            boolean nonSkipped = foundFirstNonSkippedElement();
+            boolean nonSkipped = false;
+            if (!isIndexHandler) {
+                nonSkipped = foundFirstNonSkippedElement();
+            }
             flushText();
             ElementNodeBuilder enb = enbStack.remove(enbStack.size() - 1);
             enb.endChildrenChunk();
             endChildInParent(enb, nonSkipped);
             freeENB(enb);
-            if (nonSkipped) {
-                writeElement();
+            if (!isIndexHandler) {
+                if (nonSkipped) {
+                    writeElement();
+                }
+                endElementChildPathStep();
             }
-            endElementChildPathStep();
         } catch (IOException e) {
             e.printStackTrace();
             throw new SAXException(e);
@@ -248,7 +259,7 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
 
     @Override
     public void startDocument() throws SAXException {
-        if (subElement == null) {
+        if (isIndexHandler || subElement == null) {
             skipping = false;
         }
         db.reset();
@@ -305,7 +316,10 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
     @Override
     public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
         ++depth;
-        boolean start = startElementChildPathStep(uri, localName);
+        boolean start = false;
+        if (!isIndexHandler) {
+            start = startElementChildPathStep(uri, localName);
+        }
 
         if (skipping) {
             return;
@@ -392,7 +406,7 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
         }
     }
 
-    private void flushText() throws IOException {
+    protected void flushText() throws IOException {
         if (pendingText) {
             peekENBStackTop().startChild(tnb);
             if (createNodeIds) {
@@ -471,7 +485,7 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
         out.write(resultABVS.getByteArray(), resultABVS.getStartOffset(), resultABVS.getLength());
     }
 
-    private ElementNodeBuilder createENB() {
+    protected ElementNodeBuilder createENB() {
         if (freeENBList.isEmpty()) {
             return new ElementNodeBuilder();
         }
@@ -482,7 +496,7 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
         freeENBList.add(enb);
     }
 
-    private ElementNodeBuilder peekENBStackTop() {
+    protected ElementNodeBuilder peekENBStackTop() {
         return enbStack.get(enbStack.size() - 1);
     }
 

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
index a62a26c..34d7ba9 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
@@ -57,7 +57,7 @@ public class XMLParser {
         try {
             parser = XMLReaderFactory.createXMLReader();
             if (appender == null) {
-                handler = new SAXContentHandler(attachTypes, idProvider);
+                handler = new SAXContentHandler(attachTypes, idProvider, false);
             } else {
                 List<SequenceType> childSequenceTypes = new ArrayList<SequenceType>();
                 for (int typeCode : childSeq) {

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ArrayByteTest.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ArrayByteTest.java b/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ArrayByteTest.java
index 68af1d5..eec32b9 100644
--- a/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ArrayByteTest.java
+++ b/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ArrayByteTest.java
@@ -1,3 +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.
+ */
 package org.apache.vxquery.datamodel;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/MiniDFS.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/MiniDFS.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/MiniDFS.java
index a675150..345a6b5 100644
--- a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/MiniDFS.java
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/MiniDFS.java
@@ -18,7 +18,6 @@ package org.apache.vxquery.xtest;
 
 import java.io.IOException;
 
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
@@ -31,9 +30,8 @@ public class MiniDFS {
     private static final String PATH_TO_HADOOP_CONF = "src/test/resources/hadoop/conf";
     private static final String DATA_PATH = "src/test/resources/TestSources/ghcnd";
 
-    public void startHDFS() throws IOException {
+    public void startHDFS(String folder) throws IOException {
 
-        FileSystem lfs = FileSystem.getLocal(new Configuration());
         JobConf conf = new JobConf();
         conf.addResource(new Path(PATH_TO_HADOOP_CONF + "/core-site.xml"));
         conf.addResource(new Path(PATH_TO_HADOOP_CONF + "/mapred-site.xml"));
@@ -41,9 +39,8 @@ public class MiniDFS {
         int numDataNodes = 1;
         int nameNodePort = 40000;
 
-        // cleanup artifacts created on the local file system
-        lfs.delete(new Path("build"), true);
         System.setProperty("hadoop.log.dir", "logs");
+        System.setProperty("test.build.data", folder.concat("/"));
         MiniDFSCluster.Builder build = new MiniDFSCluster.Builder(conf);
         build.nameNodePort(nameNodePort);
         build.nameNodeHttpPort(nameNodePort + 34);

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
index 4d0ddc0..3679aba 100644
--- a/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
+++ b/vxquery-xtest/src/test/java/org/apache/vxquery/xtest/VXQueryTest.java
@@ -1,25 +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.
-*/
+ * 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.xtest;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -30,9 +31,10 @@ import org.junit.runners.Parameterized.Parameters;
 @RunWith(Parameterized.class)
 public class VXQueryTest extends AbstractXQueryTest {
     private static MiniDFS dfs;
+    private final static String TMP = "target/tmp";
 
-    private static String VXQUERY_CATALOG = StringUtils.join(new String[] { "src", "test", "resources",
-            "VXQueryCatalog.xml" }, File.separator);
+    private static String VXQUERY_CATALOG = StringUtils
+            .join(new String[] { "src", "test", "resources", "VXQueryCatalog.xml" }, File.separator);
 
     public VXQueryTest(TestCase tc) throws Exception {
         super(tc);
@@ -57,17 +59,28 @@ public class VXQueryTest extends AbstractXQueryTest {
     }
 
     @BeforeClass
-    public static void setupHDFS() {
+    public static void setup() throws IOException {
+        File tmp = new File(TMP);
+        if (tmp.exists()) {
+            FileUtils.deleteDirectory(tmp);
+        }
+        new File(TMP.concat("/indexFolder")).mkdirs();
+        String HDFSFolder = TMP.concat("/hdfsFolder");
+        new File(HDFSFolder).mkdirs();
         dfs = new MiniDFS();
         try {
-            dfs.startHDFS();
+            dfs.startHDFS(HDFSFolder);
         } catch (IOException e) {
             System.err.println(e);
         }
     }
 
     @AfterClass
-    public static void shutdownHDFS() {
+    public static void shutdown() throws IOException {
+        File tmp = new File(TMP);
+        if (tmp.exists()) {
+            FileUtils.deleteDirectory(tmp);
+        }
         dfs.shutdownHDFS();
     }
 

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/createIndex.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/createIndex.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/createIndex.txt
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex1.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex1.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex1.txt
new file mode 100644
index 0000000..baf9dca
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex1.txt
@@ -0,0 +1,2 @@
+<data><date>2003-03-03T00:00:00.000</date><dataType>TMIN</dataType><station>GHCND:AS000000003</station><value>13.75</value><attributes><attribute/><attribute/><attribute>a</attribute><attribute/></attributes></data>
+<data><date>2003-03-03T00:00:00.000</date><dataType>TMAX</dataType><station>GHCND:AS000000003</station><value>33</value><attributes><attribute/><attribute/><attribute>a</attribute></attributes></data>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex2.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex2.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex2.txt
new file mode 100644
index 0000000..ef8dde4
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex2.txt
@@ -0,0 +1 @@
+<data><date>2001-01-01T00:00:00.000</date><dataType>AWND</dataType><station>GHCND:US000000001</station><value>1000</value><attributes><attribute/><attribute/><attribute>a</attribute></attributes></data>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex3.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex3.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex3.txt
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex3.txt
@@ -0,0 +1 @@
+2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex4.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex4.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex4.txt
new file mode 100644
index 0000000..f30101c
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex4.txt
@@ -0,0 +1 @@
+3.3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex5.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex5.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex5.txt
new file mode 100644
index 0000000..c84c360
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex5.txt
@@ -0,0 +1,3 @@
+<data><date>2002-02-02T00:00:00.000</date><dataType>TMIN</dataType><station>GHCND:US000000002</station><value>12.5</value><attributes><attribute/><attribute/><attribute>a</attribute><attribute/></attributes></data>
+<data><date>2002-02-02T00:00:00.000</date><dataType>TMAX</dataType><station>GHCND:US000000002</station><value>32</value><attributes><attribute/><attribute/><attribute>a</attribute><attribute/></attributes></data>
+<data><date>2002-02-02T00:00:00.000</date><dataType>PRCP</dataType><station>GHCND:US000000002</station><value>20</value><attributes><attribute/><attribute/><attribute>a</attribute></attributes></data>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex6.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex6.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex6.txt
new file mode 100644
index 0000000..9abedff
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex6.txt
@@ -0,0 +1,2 @@
+<station><id>GHCND:US000000001</id><displayName>Station 1</displayName><latitude>10.000</latitude><longitude>-10.000</longitude><elevation>1000.0</elevation><locationLabels><type>ST</type><id>FIPS:1</id><displayName>State 1</displayName></locationLabels><locationLabels><type>CNTY</type><id>FIPS:-9999</id><displayName>County 1</displayName></locationLabels><locationLabels><type>CNTRY</type><id>FIPS:US</id><displayName/></locationLabels></station>
+<station><id>GHCND:US000000002</id><displayName>Station 2</displayName><latitude>20.000</latitude><longitude>-20.000</longitude><elevation>2000.0</elevation><locationLabels><type>ST</type><id>FIPS:1</id><displayName>State 1</displayName></locationLabels><locationLabels><type>CNTY</type><id>FIPS:-9999</id><displayName>County 2</displayName></locationLabels><locationLabels><type>CNTRY</type><id>FIPS:US</id><displayName/></locationLabels></station>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex7.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex7.txt b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex7.txt
new file mode 100644
index 0000000..c84c360
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/ExpectedTestResults/Indexing/useIndex7.txt
@@ -0,0 +1,3 @@
+<data><date>2002-02-02T00:00:00.000</date><dataType>TMIN</dataType><station>GHCND:US000000002</station><value>12.5</value><attributes><attribute/><attribute/><attribute>a</attribute><attribute/></attributes></data>
+<data><date>2002-02-02T00:00:00.000</date><dataType>TMAX</dataType><station>GHCND:US000000002</station><value>32</value><attributes><attribute/><attribute/><attribute>a</attribute><attribute/></attributes></data>
+<data><date>2002-02-02T00:00:00.000</date><dataType>PRCP</dataType><station>GHCND:US000000002</station><value>20</value><attributes><attribute/><attribute/><attribute>a</attribute></attributes></data>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/createIndex.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/createIndex.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/createIndex.xq
new file mode 100644
index 0000000..f34ac4c
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/createIndex.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. :)
+   
+(: Build Lucene Index :)
+build-index-on-collection( "src/test/resources/TestSources/ghcnd", "target/tmp/indexFolder")
+   
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex1.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex1.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex1.xq
new file mode 100644
index 0000000..1635f61
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex1.xq
@@ -0,0 +1,25 @@
+(: 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. :)
+   
+(: Search Lucene Index :)
+for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+let $datetime := xs:dateTime(fn:data($r/date))
+where $r/station eq "GHCND:AS000000003" 
+    and fn:year-from-dateTime($datetime) ge 2000
+    and fn:month-from-dateTime($datetime) eq 3 
+    and fn:day-from-dateTime($datetime) eq 3
+return $r
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex2.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex2.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex2.xq
new file mode 100644
index 0000000..bf19ee9
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex2.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. :)
+
+(: Search Lucene Index :)
+(: Find all reading for hurricane force wind warning or extreme wind warning. :)
+(: The warnings occur when the wind speed (AWND) exceeds 110 mph (49.1744     :)
+(: meters per second). (Wind value is in tenth of a meter per second)         :)
+for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+where $r/dataType eq "AWND" and xs:decimal($r/value) gt 491.744
+return $r

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex3.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex3.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex3.xq
new file mode 100644
index 0000000..28cf019
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex3.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. :)
+
+(: Search Lucene Index :)
+(: Find the annual precipitation (PRCP) for a Seattle using the airport       :)
+(: station (US000000002) for 2002.                                            :)
+fn:sum(
+    for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+    where $r/station eq "GHCND:US000000002" 
+        and $r/dataType eq "PRCP" 
+        and fn:year-from-dateTime(xs:dateTime(fn:data($r/date))) eq 2002
+    return $r/value
+) div 10

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex4.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex4.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex4.xq
new file mode 100644
index 0000000..2b75cf4
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex4.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. :)
+
+(: Search Lucene Index :)
+(: Find the highest recorded temperature (TMAX) in Celsius.                   :)
+fn:max(
+    for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+    where $r/dataType eq "TMAX"
+    return $r/value
+) div 10

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex5.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex5.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex5.xq
new file mode 100644
index 0000000..e83484a
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex5.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. :)
+
+(: Search Lucene Index :)
+(: Find all the weather readings for Washington state for a specific day    :)
+(: 2002-2-2.                                                                  :)
+for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+where xs:dateTime(fn:data($r/date)) eq xs:dateTime("2002-02-02T00:00:00.000")
+return $r

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex6.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex6.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex6.xq
new file mode 100644
index 0000000..04f6672
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex6.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. :)
+
+(: Search Lucene Index :)
+(: Find all the weather readings for Washington state for a specific day    :)
+(: 2002-2-2.                                                                  :)
+for $s in collection-from-index("target/tmp/indexFolder", "/stationCollection/station")/station
+where (some $x in $s/locationLabels satisfies ($x/type eq "ST" and fn:upper-case(fn:data($x/displayName)) eq "STATE 1"))
+return $s

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex7.xq
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex7.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex7.xq
new file mode 100644
index 0000000..e471baa
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Indexing/useIndex7.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. :)
+
+(: Search Lucene Index :)
+(: Find all the weather readings for Washington state for a specific day    :)
+(: 2002-2-2.                                                                  :)
+for $s in collection-from-index("target/tmp/indexFolder", "/stationCollection/station")/station
+for $r in collection-from-index("target/tmp/indexFolder", "/dataCollection/data")/data
+    
+where $s/id eq $r/station 
+    and (some $x in $s/locationLabels satisfies ($x/type eq "ST" and fn:upper-case(fn:data($x/displayName)) eq "STATE 1"))
+    and xs:dateTime(fn:data($r/date)) eq xs:dateTime("2002-02-02T00:00:00.000")
+return $r

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/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 076341e..5e6eb62 100644
--- a/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
+++ b/vxquery-xtest/src/test/resources/VXQueryCatalog.xml
@@ -42,6 +42,8 @@
 
 <!ENTITY HDFSAggregateQueries SYSTEM "cat/HDFSAggregateQueries.xml">
 
+<!ENTITY IndexingQueries SYSTEM "cat/IndexingQueries.xml">
+
 <!ENTITY JsonArrayQueries SYSTEM "cat/JsonArrayQueries.xml">
 <!ENTITY JsonObjectQueries SYSTEM "cat/JsonObjectQueries.xml">
 
@@ -208,7 +210,20 @@
             <title>Aggregate HDFS Execution Tests</title>
             <description/>
          </GroupInfo>
-        &HDFSAggregateQueries;
+         &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>
+            <description/>
+         </GroupInfo>
+         &IndexingQueries;
       </test-group>
    </test-group>
    <test-group name="JsoniqQueries" featureOwner="Christina Pavlopoulou">

http://git-wip-us.apache.org/repos/asf/vxquery/blob/bf475170/vxquery-xtest/src/test/resources/cat/IndexingQueries.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/test/resources/cat/IndexingQueries.xml b/vxquery-xtest/src/test/resources/cat/IndexingQueries.xml
new file mode 100644
index 0000000..1f8291d
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/cat/IndexingQueries.xml
@@ -0,0 +1,63 @@
+<!--
+  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="IndexingQueries" featureOwner="VXQuery">
+   <GroupInfo>
+      <title>Indexing</title>
+      <description/>
+   </GroupInfo>
+   <test-case name="create-index" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Create Lucene Index from Collection.</description>
+      <query name="createIndex" date="2016-05-26"/>
+      <output-file compare="Text">createIndex.txt</output-file>
+   </test-case>
+   <test-case name="use-index-1" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex1" date="2016-05-26"/>
+      <output-file compare="Text">useIndex1.txt</output-file>
+   </test-case>
+   <test-case name="use-index-2" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex2" date="2016-05-26"/>
+      <output-file compare="Text">useIndex2.txt</output-file>
+   </test-case>
+   <test-case name="use-index-3" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex3" date="2016-05-26"/>
+      <output-file compare="Text">useIndex3.txt</output-file>
+   </test-case>
+   <test-case name="use-index-4" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex4" date="2016-05-26"/>
+      <output-file compare="Text">useIndex4.txt</output-file>
+   </test-case>
+   <test-case name="use-index-5" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex5" date="2016-05-26"/>
+      <output-file compare="Text">useIndex5.txt</output-file>
+   </test-case>
+   <test-case name="use-index-6" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex6" date="2016-05-26"/>
+      <output-file compare="Text">useIndex6.txt</output-file>
+   </test-case>
+   <test-case name="use-index-7" FilePath="Indexing/" Creator="Steven Jacobs">
+      <description>Get Collection From Lucene Index</description>
+      <query name="useIndex7" date="2016-05-26"/>
+      <output-file compare="Text">useIndex7.txt</output-file>
+   </test-case>
+</test-group>