Commit 515df0a0 authored by Sylvain Schmitz's avatar Sylvain Schmitz

various small changes

parent c651dad9
......@@ -81,7 +81,7 @@
</bib>
</schema>
<schema file="xpath-non-mixing-basic.rnc"
name="Non-mixing"
name="NonMixing"
color="#b3cde3">
<bib>
<author>Wojciech Czerwinski</author>
......
......@@ -14,7 +14,7 @@
<doi>10.1145/1456650.1456653</doi>
</bib>
</schema>
<schema file="xpath-2.0-core-full.rnc"
<schema file="xpath-2.0-core-join.rnc"
name="Core 2.0"
color="#ccebc5">
<bib>
......@@ -28,7 +28,7 @@
<doi>10.1145/1568318.1568321</doi>
</bib>
</schema>
<schema file="xpath-1.0-downward-full.rnc"
<schema file="xpath-1.0-downward-last.rnc"
name="Downward"
color="#b3cde3">
<bib>
......@@ -40,7 +40,7 @@
<doi>10.1145/2362355.2362362</doi>
</bib>
</schema>
<schema file="xpath-1.0-forward-full.rnc"
<schema file="xpath-1.0-forward-last.rnc"
name="Forward"
color="#b3cde3">
<bib>
......@@ -80,8 +80,8 @@
<doi>10.1145/1516512.1516515</doi>
</bib>
</schema>
<schema file="xpath-non-mixing-full.rnc"
name="Non-mixing"
<schema file="xpath-non-mixing-basic.rnc"
name="NonMixing"
color="#b3cde3">
<bib>
<author>Wojciech Czerwinski</author>
......
......@@ -3,7 +3,7 @@
original academic fragments. -->
<schemas>
<schema file="xpath-1.0-core-orig.rnc"
name="Core 1.0"
name="Core~1.0"
color="#ccebc5">
<bib>
<author>Michael Benedikt</author>
......@@ -81,7 +81,7 @@
</bib>
</schema>
<schema file="xpath-non-mixing-orig.rnc"
name="Non-mixing"
name="NonMixing"
color="#b3cde3">
<bib>
<author>Wojciech Czerwinski</author>
......
......@@ -49,10 +49,19 @@ op |= cst.op
include "expr/varref.rnc"
primary |= varref
# ---------------------------------------------------------------------------
# Allow root
fun |= fun.root
path |= element pathExpr {
( element rootExpr { empty }, step* )
}
# ---------------------------------------------------------------------------
# Allow some functions
fun |= cst.fun | fun.root | fun.child | fun.name
fun |= cst.fun | fun.child | fun.name
# root() admissible when both the ancestor and parent axes are available using
# `ancestor-or-self::*[not(parent::*)]'
......
......@@ -51,7 +51,7 @@ fun = element functionCallExpr {
# Paths
path = element pathExpr {
( element rootExpr { empty }, step* ) | step+
step+
}
step = element stepExpr {
......
# 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 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
......@@ -38,6 +38,15 @@ op |= cst.op
include "expr/varref.rnc"
primary |= varref
# ---------------------------------------------------------------------------
# Allow root
fun |= fun.root
path |= element pathExpr {
( element rootExpr { empty }, step* )
}
# ---------------------------------------------------------------------------
# Allow some functions
......
......@@ -43,10 +43,18 @@ op |= element ( eqOp | neOp | equalOp | notEqualOp # equality
op |= cst.op
# ---------------------------------------------------------------------------
# Allow root
fun |= fun.root
path |= element pathExpr {
( element rootExpr { empty }, step* )
}
# ---------------------------------------------------------------------------
# Allow some functions
fun |= cst.fun | fun.root | fun.child | fun.name
fun |= cst.fun | fun.child | fun.name
# root() admissible when both the ancestor and parent axes are available using
# `ancestor-or-self::*[not(parent::*)]'
......
# 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,6 +20,16 @@ namespace xqx = "http://www.w3.org/2005/XQueryX"
include "xpath-emso2-orig.rnc"
# ---------------------------------------------------------------------------
# Allow root
path |= element pathExpr {
( element rootExpr { empty }, step* )
}
# allow root() function more generally
fun |= fun.root
# ---------------------------------------------------------------------------
# Allow constants
......@@ -52,7 +62,7 @@ primary |= varref
# ---------------------------------------------------------------------------
# Allow some functions
fun |= cst.fun | fun.root | fun.child | fun.name
fun |= cst.fun | fun.child | fun.name
# has-children() admissible when the child axis is available
fun.child = element functionCallExpr {
......
......@@ -38,19 +38,7 @@ one.path = element contextItemExpr { empty }
predicates?
}
}
# data test using an absolute path on one side
op |= element ( eqOp | neOp | equalOp | notEqualOp ) {
( element firstOperand { expr },
element secondOperand { rooted.path })
| ( element firstOperand { rooted.path },
element secondOperand { expr })
| ( element firstOperand { local.path },
element secondOperand { one.path })
| ( element firstOperand { one.path },
element secondOperand { local.path })
}
rooted.path
= fun.root
| element pathExpr {
......@@ -60,9 +48,7 @@ rooted.path
element stepExpr { element filterExpr { fun.root } },
step*
}
# allow root() function more generally
primary |= fun.root
fun.root = element functionCallExpr {
element functionName {
attribute xqx:prefix { string "fn" }?,
......@@ -71,3 +57,16 @@ fun.root = element functionCallExpr {
},
element arguments { expr* }?
}
# data test using an absolute path on one side
op |= element ( eqOp | neOp | equalOp | notEqualOp ) {
( element firstOperand { expr },
element secondOperand { rooted.path })
| ( element firstOperand { rooted.path },
element secondOperand { expr })
| ( element firstOperand { local.path },
element secondOperand { one.path })
| ( element firstOperand { one.path },
element secondOperand { local.path })
}
# Unions of Conjunctive Queries fragment in Relax NG compact syntax.
#
# Based on: Wojciech Czerwinski, Claire David, Filip Murlak, and Pawel
# Parys, _Reasoning About Integrity Constraints for Tree-Structured
# Data_, in the Proceedings of the 19th International Conference on
# Database Theory (ICDT 2016), volume 48 of LIPIcs, article 20, LZI,
# 2016. doi:10.4230/LIPIcs.ICDT.2016.20.
#
# Copyright (C) 2017 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-2.0-core-basic.rnc" {
start = pattern.expr
}
primary |= element contextItemExpr { empty }
| cst.expr
| fun
| element sequenceExpr { expr* }
pattern.expr = pos.expr | neg.expr
| element unionOp {
element firstOperand { pattern.expr },
element secondOperand { pattern.expr }
}
pos.expr |= expr
neg.expr |= expr
include "expr/pos.rnc"
include "expr/neg.rnc"
......@@ -25,11 +25,17 @@ public class ElementBuilder {
private int count;
private int maxdepth;
private int curdepth;
private Document doc;
public ElementBuilder (Element parent) {
this.doc = parent.getOwnerDocument();
this.count = 0;
this.curdepth = 0;
this.maxdepth = 0;
}
public Element createElementNS (String namespaceURI, String qualifiedName) {
......@@ -42,7 +48,20 @@ public class ElementBuilder {
return doc.createElement(tagName);
}
public void enter() {
curdepth++;
maxdepth = (curdepth > maxdepth)? curdepth: maxdepth;
}
public void leave() {
curdepth--;
}
public int getCount() {
return count;
}
public int getDepth() {
return maxdepth;
}
}
......@@ -27,7 +27,8 @@ import org.w3c.xqparser.SimpleNode;
public abstract class XPathEntry {
final static int MAX_AST_SIZE = 330;
final static int MAX_AST_DEPTH = 100;
final static int MAX_AST_SIZE = 500;
/**
* The name of the file from which this entry was extracted.
......@@ -39,6 +40,7 @@ public abstract class XPathEntry {
private Node domnode;
private int astSize;
private int astDepth;
SourceFactory sf;
......@@ -74,8 +76,11 @@ public abstract class XPathEntry {
xxc.transform(getASTNode(), ast, eb);
domnode = ast.getFirstChild();
astSize = eb.getCount();
astDepth = eb.getDepth();
ast.setAttributeNS(XMLConstants.NULL_NS_URI,
"size", String.valueOf(astSize));
ast.setAttributeNS(XMLConstants.NULL_NS_URI,
"depth", String.valueOf(astDepth));
}
return domnode;
}
......@@ -112,7 +117,7 @@ public abstract class XPathEntry {
query.appendChild(text);
xpath.appendChild(query);
}
if (astSize < MAX_AST_SIZE) {
if (astSize < MAX_AST_SIZE && astDepth < MAX_AST_DEPTH) {
xpath.appendChild(ast);
Element schemas = doc.createElementNS
......@@ -146,8 +151,12 @@ public abstract class XPathEntry {
}
xpath.appendChild(schemas);
}
else
xpath.appendChild(doc.createComment("AST size "+astSize+" exceeds XPathEntry.MAX_AST_SIZE; no validation"));
else {
if (astSize >= MAX_AST_SIZE)
xpath.appendChild(doc.createComment("AST size "+astSize+" exceeds XPathEntry.MAX_AST_SIZE "+MAX_AST_SIZE+"; no validation"));
if (astDepth >= MAX_AST_DEPTH)
xpath.appendChild(doc.createComment("AST depth "+astDepth+" exceeds XPathEntry.MAX_AST_DEPTH "+MAX_AST_DEPTH+"; no validation"));
}
// print
printer.transform(doc, os);
}
......
......@@ -4,8 +4,8 @@
<description>Extract data from benchmark results.</description>
<property name="xml" value="xpathmark"/>
<property name="target.dir" value="${user.home}/public_html/chord/"/>
<property name="xml" value="xpathmark-full"/>
<property name="target.dir" value="$./public_html/chord/"/>
<property name="project.root" value="../.."/>
<property name="bench.dir" value="${project.root}/benchmark"/>
<property name="lib.dir" value="${project.root}/lib"/>
......@@ -48,13 +48,13 @@
</classpath>
</xslt>
<!-- get the number of fragments -->
<xpath document="${project.root}/relaxng/meta.xml"
<xpath document="${project.root}/relaxng/fragments-full.xml"
xpath="count(//schema)"
outputproperty="fragments"/>
<!-- get the number of entries -->
<xpath document="${bench.dir}/${xml}.xml"
xpath="count(//xpath[ast/descendant::*[local-name() = 'xpathAxis']])"
outputproperty="entries"/>
xpath="count(//xpath/ast)"
outputproperty="entries"/><!-- //xpath[ast/descendant::*[local-name() = 'xpathAxis']])" -->
<!-- process index.html -->
<copy file="index.html" todir="${target.dir}/${xml}">
<filterchain>
......@@ -124,4 +124,4 @@
src="https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar"
dest="${lib.dir}" usetimestamp="true"/>
</target>
</project>
\ No newline at end of file
</project>
......@@ -74,4 +74,24 @@
\caption{Differences between \textsf{Forward} fragments}
\end{figure}
\begin{table}
\caption{Differences between the baseline fragments.}
\vspace*{.5em}
\centering
\input{matrix_all-full_orig.tex}
\end{table}
\begin{table}
\caption{Differences between the basic fragments.}
\vspace*{.5em}
\centering
\input{matrix_all-full_basic.tex}
\end{table}
\begin{table}
\caption{Differences between the full fragments.}
\vspace*{.5em}
\centering
\input{matrix_all-full_full.tex}
\end{table}
\end{document}
......@@ -24,7 +24,7 @@
<xsl:text></xsl:text>
<xsl:for-each select="$fragments">
<xsl:text> &amp; </xsl:text>
<xsl:value-of select="current()/@name" />
\textsf{<xsl:value-of select="current()/@name" />}
</xsl:for-each>
<xsl:text> \\ &#xa;\midrule&#xa;</xsl:text>
......@@ -43,7 +43,7 @@
<xsl:template name="line">
<xsl:param name="source"/>
<xsl:param name="root"/>
<xsl:value-of select="$source/@name" />
\textsf{<xsl:value-of select="$source/@name" />}
<xsl:text> &amp; </xsl:text>
<xsl:for-each select="$fragments">
<xsl:call-template name="entry">
......
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