Commit 1e42749a authored by Sylvain Schmitz's avatar Sylvain Schmitz

multiple fixes

parent bbd4cdcd
......@@ -20,9 +20,9 @@ namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-core-join.rnc"
include "expr/varref.rnc"
primary |= varref
join.primary |= varref
# include "expr/varref.rnc"
# primary |= varref
# join.primary |= varref
include "expr/last.rnc" {
last.axis = axis
......
......@@ -20,6 +20,6 @@ namespace xqx = "http://www.w3.org/2005/XQueryX"
include "misc/join.rnc"
include "xpath-1.0-core-basic" {
include "xpath-1.0-core-basic.rnc" {
start = join.expr
}
......@@ -18,7 +18,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-core-basic"
include "xpath-1.0-core-basic.rnc"
# Allowing some use of last()
include "expr/last.rnc" {
......
......@@ -32,12 +32,6 @@ include "expr/cst.rnc"
op |= cst.op
# ---------------------------------------------------------------------------
# Allow variables
include "expr/varref.rnc"
primary |= varref
# ---------------------------------------------------------------------------
# Allow some functions
......
xpath-1.0-downward-last.rnc
\ No newline at end of file
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016 Sylvain Schmitz (ENS Cachan)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-downward-basic.rnc"
# Allowing some use of last()
include "expr/last.rnc" {
# Allowed axes before a [last()] predicate.
last.axis = element xpathAxis {
string "self" # Always
| string "attribute"
}
}
step |= last.step
xpath-1.0-forward-last.rnc
\ No newline at end of file
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016 Sylvain Schmitz (ENS Cachan)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-forward-basic.rnc"
# Allowing some use of last()
include "expr/last.rnc" {
# Allowed axes before a [last()] predicate.
last.axis = element xpathAxis {
string "self" # Deterministic
| string "attribute" # Deterministic
| string "child" # Can be encoded using 'child' and 'following-sibling'
| string "following-sibling" # ... using 'following-sibling'
| string "descendant" # With 'child'+'following-sibling' and regular XPath
| string "descendant-or-self"
}
}
step |= last.step
......@@ -18,7 +18,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-forward-basic"
include "xpath-1.0-forward-basic.rnc"
# Allowing some use of last()
include "expr/last.rnc" {
......
......@@ -24,7 +24,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-vertical-basic"
include "xpath-1.0-vertical-basic.rnc"
include "misc/id.rnc"
path |= id.rootedpath
......@@ -18,7 +18,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-1.0-vertical-basic"
include "xpath-1.0-vertical-basic.rnc"
# Allowing some use of last()
include "expr/last.rnc" {
......
xpath-2.0-core-join.rnc
\ No newline at end of file
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016 Sylvain Schmitz (ENS Cachan)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "misc/join.rnc"
include "xpath-2.0-core-basic.rnc" {
start = join.expr
}
join.op |= element ( intersectOp | isOp | nodeBeforeOp | nodeAfterOp ) {
element firstOperand { join.expr },
element secondOperand { join.expr }
}
join.op |= element exceptOp {
element firstOperand { join.expr },
element secondOperand { expr }
}
join.expr |= element quantifiedExpr {
element quantifier { string "some" },
element quantifiedExprInClause {
element typedVariableBinding {
element varName { external "misc/eqname.rnc" }
},
element sourceExpr { join.expr }
}+,
element predicateExpr { join.expr }
}
join.primary |= varref
join.step |= element stepExpr {
((join.axis, join.nodetest) | element filterExpr { primary } ),
element predicates {
(last.op | last.fun | expr)*,
joinlast.expr,
join.expr*
}
}
joinlast.expr = element andOp {
(element firstOperand { joinlast.expr },
element secondOperand { joinlast.expr }) |
(element secondOperand { joinlast.expr },
element firstOperand { joinlast.expr })
}
joinlast.expr |= last.op | join.expr
......@@ -20,7 +20,8 @@ namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-emso2-join.rnc"
include "misc/id.rnc"
include "expr/varref.rnc"
#include "expr/varref.rnc"
#primary |= varref
path |= id.rootedpath
primary |= varref
\ No newline at end of file
......@@ -18,7 +18,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-emso2-basic"
include "xpath-emso2-basic.rnc"
include "misc/id.rnc"
path |= id.rootedpath
......@@ -19,7 +19,7 @@
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-emso2-basic" {
include "xpath-emso2-basic.rnc" {
start = emso2.expr
}
......
xpath-non-mixing-basic.rnc
\ No newline at end of file
# XPath 1.0-core fragment with variables
#
# Copyright (C) 2016 Sylvain Schmitz (ENS Cachan)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default namespace = "http://www.w3.org/2005/XQueryX"
namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-non-mixing-orig.rnc"
# ---------------------------------------------------------------------------
# Allow constants
pos.op |= element ( eqOp | neOp | equalOp | notEqualOp # equality
| ltOp | leOp | gtOp | geOp # order
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
) {
( element firstOperand { pos.expr },
element secondOperand { cst.expr })
| ( element firstOperand { cst.expr },
element secondOperand { pos.expr } )
}
pos.op |= cst.op
neg.op |= element ( eqOp | neOp | equalOp | notEqualOp # equality
| ltOp | leOp | gtOp | geOp # order
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
) {
( element firstOperand { neg.expr },
element secondOperand { cst.expr })
| ( element firstOperand { cst.expr },
element secondOperand { neg.expr } )
}
neg.op |= cst.op
# ---------------------------------------------------------------------------
# Allow some functions
fun |= cst.fun | fun.root | fun.child | fun.name
# root() admissible when both the ancestor and parent axes are available using
# `ancestor-or-self::*[not(parent::*)]'
fun.root = element functionCallExpr {
element functionName {
attribute xqx:prefix { string "fn" }?,
attribute xqx:URI { string "http://www.w3.org/2005/xpath-functions" }?,
( string "root")
},
element arguments { expr* }?
}
# has-children() admissible when the child axis is available
fun.child = element functionCallExpr {
element functionName {
attribute xqx:prefix { string "fn" }?,
attribute xqx:URI { string "http://www.w3.org/2005/xpath-functions" }?,
( string "has-children" )
},
element arguments { expr* }?
}
# various name accessor functions are admissible
fun.name = element functionCallExpr {
element functionName {
attribute xqx:prefix { string "fn" }?,
attribute xqx:URI { string "http://www.w3.org/2005/xpath-functions" }?,
( string "name"
| string "local-name"
| string "namespace-uri"
| string "node-name"
)
},
element arguments { expr* }?
}
......@@ -55,11 +55,11 @@ public class RNCValidator implements Validator {
throw new SAXException(e);
}
//this.f = TransformerFactory.newInstance();
this.f = TransformerFactory.newInstance();
}
public void validate(Source source) throws IOException, SAXException {
this.f = TransformerFactory.newInstance();
//this.f = TransformerFactory.newInstance();
eh.reset();
try {
f.newTransformer().transform
......
......@@ -566,7 +566,9 @@ public class XPathVisitor implements XParserVisitor, XParserTreeConstants {
int nChildren = node.jjtGetNumChildren();
NodeList nl =
(NodeList) visit(node.getChild(nChildren - 1), data);
return new NodeList(nl.getBool(), nl.getList());
// more than two children means a positional variable
return new NodeList((nChildren <= 2) && nl.getBool(),
nl.getList());
}
case JJTTYPEDECLARATION: {
......
......@@ -40,6 +40,7 @@ public class XQuerySource implements Iterable<XPathEntry> {
// parse the input XQuery
XParser parser = new XParser(str);
SimpleNode ast = parser.START();
// for debugging the visitor: ast.dump("");
nodeList = XPathVisitor.visit(ast).iterator();
}
......
#!/bin/bash
# path to benchmark files
path=$1
full=$2
xmlarray=(docbook htmlbook existdb histei marklogic xqjson)
names=(DocBook HTMLBook eXist-db HisTEI MarkLogic XQJSON)
echo "\\toprule"
echo "Source & \\textsf{Core~1.0} & \\textsf{Core~2.0} & \\textsf{Downward} & \\textsf{Vertical} & \\textsf{Forward} & \\textsf{EMSO\$^\\textsf 2\$} & \\textsf{NonMixing}\\\\"
echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-basic.rnc.*yes' 'xpath-2.0-core-basic.rnc.*yes' 'xpath-1.0-downward-basic.rnc.*yes' 'xpath-1.0-vertical-basic.rnc.*yes' 'xpath-1.0-forward-basic.rnc.*yes' 'xpath-emso2-basic.rnc.*yes' 'xpath-non-mixing-basic.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
......@@ -13,7 +13,7 @@ echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-full.rnc.*yes' 'xpath-2.0-core-join.rnc.*yes' 'xpath-1.0-downward-last.rnc.*yes' 'xpath-1.0-vertical-full.rnc.*yes' 'xpath-1.0-forward-last.rnc.*yes' 'xpath-emso2-full.rnc.*yes' 'xpath-patterns-orig.rnc.*yes'`\\\\"
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-full.rnc.*yes' 'xpath-2.0-core-join.rnc.*yes' 'xpath-1.0-downward-last.rnc.*yes' 'xpath-1.0-vertical-full.rnc.*yes' 'xpath-1.0-forward-last.rnc.*yes' 'xpath-emso2-full.rnc.*yes' 'xpath-non-mixing-basic.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
#!/bin/bash
# path to benchmark files
path=$1
full=$2
xmlarray=(docbook htmlbook existdb histei marklogic xqjson)
names=(DocBook HTMLBook eXist-db HisTEI MarkLogic XQJSON)
echo "\\toprule"
echo "Source & \\textsf{Core~1.0} & \\textsf{Core~2.0} & \\textsf{Downward} & \\textsf{Vertical} & \\textsf{Forward} & \\textsf{EMSO\$^\\textsf 2\$} & \\textsf{NonMixing}\\\\"
echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-orig.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-id.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-id.rnc.*yes' 'xpath-non-mixing-orig.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
......@@ -13,7 +13,7 @@ echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-join.rnc.*yes' 'xpath-2.0-core-join.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-orig.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-join.rnc.*yes' 'xpath-patterns-orig.rnc.*yes'`\\\\"
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-join.rnc.*yes' 'xpath-2.0-core-join.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-orig.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-join.rnc.*yes' 'xpath-non-mixing-orig.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
......@@ -13,7 +13,7 @@ echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-last.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-last.rnc.*yes' 'xpath-1.0-forward-last.rnc.*yes' 'xpath-emso2-var.rnc.*yes' 'xpath-patterns-orig.rnc.*yes'`\\\\"
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-last.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-last.rnc.*yes' 'xpath-1.0-forward-last.rnc.*yes' 'xpath-emso2-var.rnc.*yes' 'xpath-non-mixing-orig.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
......@@ -13,7 +13,7 @@ echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-orig.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-orig.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-orig.rnc.*yes' 'xpath-patterns-orig.rnc.*yes'`\\\\"
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-orig.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-orig.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-orig.rnc.*yes' 'xpath-non-mixing-orig.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
......@@ -13,7 +13,7 @@ echo "\\midrule"
for ((i = 0; i < ${#xmlarray[@]}; ++i))
do
printf "${names[$i]} "
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-var.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-var.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-var.rnc.*yes' 'xpath-patterns-orig.rnc.*yes'`\\\\"
echo "`./numbers.sh $path/${xmlarray[$i]}$2.xml 'xpath-1.0-core-var.rnc.*yes' 'xpath-2.0-core-orig.rnc.*yes' 'xpath-1.0-downward-orig.rnc.*yes' 'xpath-1.0-vertical-var.rnc.*yes' 'xpath-1.0-forward-orig.rnc.*yes' 'xpath-emso2-var.rnc.*yes' 'xpath-non-mixing-orig.rnc.*yes'`\\\\"
done
echo "\\bottomrule"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment