Commit 4733675d authored by David Baelde's avatar David Baelde

Removing outdated files

parent 37958e61
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
start = expr
include "expr/cst.rnc"
# ----------------------------------------------------------------
# Expressions
expr = op | path | primary
# these can be expressed
include "expr/if.rnc"
# ----------------------------------------------------------------
# Operations
op = element ( andOp | orOp | unionOp ) {
element firstOperand { expr },
element secondOperand { expr }
}
op |= element ( eqOp | neOp | equalOp | notEqualOp # equality
| ltOp | leOp | gtOp | geOp # order
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
) {
( element firstOperand { expr },
element secondOperand { cst.expr })
| ( element firstOperand { cst.expr },
element secondOperand { expr } )
}
op |= cst.op
# ----------------------------------------------------------------
# Function calls
include "expr/literal.rnc"
include "expr/varref.rnc"
primary = literal
| varref
| element contextItemExpr { empty }
| fun
| element sequenceExpr { expr* }
# Boolean functions
fun = element functionCallExpr {
element functionName { external "fn/bool.rnc" },
element arguments { expr* }?
}
fun |= cst.fun | fun.root | fun.child
# functions that can be implemented via other means
# 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* }?
}
# 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* }?
}
cst.fun |= fun.name
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* }?
}
# ----------------------------------------------------------------
# Paths
path = element pathExpr {
( element rootExpr { empty }, step* ) | step+
}
step = element stepExpr {
((axis, nodetest) | element filterExpr { primary } ),
predicates?
}
axis = forward.axis | backward.axis | deterministic.axis
forward.axis = element xpathAxis {
( string "child"
| string "descendant-or-self"
| string "descendant"
| string "following-sibling"
)
}
backward.axis = element xpathAxis {
string "following" # equivalent to descendant | ancestor/following-sibling/descendant-or-self
| string "ancestor"
| string "ancestor-or-self"
| string "preceding"
| string "preceding-sibling"
}
deterministic.axis = element xpathAxis {
string "attribute"
| string "self"
| string "parent"
}
nodetest = element nameTest { external "misc/eqname.rnc" }
| external "misc/tests.rnc"
| element Wildcard {
( element star { empty } & element NCName { xsd:NCName } )?
}
# which predicates can we handle?
predicates = element predicates { expr* }
# Allowing some use of last()
include "expr/last.rnc" {
# Allowed axes before a [last()] predicate.
last.axis = deterministic.axis | element xpathAxis {
string "child" # Can be encoded using 'child' and 'following-sibling'
| string "following-sibling" # ... using 'following-sibling'
| string "following" # ... using 'descendant' and 'following'
}
}
step |= last.step
# XPath Data fragment of XQueryX in Relax NG compact syntax
#
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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-core.rnc" {
op = element ( andOp | orOp | unionOp
| eqOp | neOp | equalOp | notEqualOp # equality
) {
element firstOperand { expr },
element secondOperand { expr }
}
| element ( ltOp | leOp | gtOp | geOp # order
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
) {
( element firstOperand { expr },
element secondOperand { cst.expr })
| ( element firstOperand { cst.expr },
element secondOperand { expr } )
}
| cst.op
}
# Downward DataXPath fragment of XQueryX in Relax NG compact syntax
#
# Based on Diego Figueira _Decidability of Downward XPath_, ACM
# Transactions on Computational Logic (TOCL), volume 13(4), article
# 34, 2012. doi:10.1145/2362355.2362362
#
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
include "xpath-1.0-vertical.rnc" {
start = element pathExpr { element rootExpr { empty }, step* }
| expr
path = element pathExpr { step+ }
axis = element xpathAxis {
( string "child"
| string "attribute"
| string "self"
| string "descendant-or-self"
| string "descendant"
)
}
last.axis = element xpathAxis {
string "self" # Always
| string "attribute"
}
# Same as in expr/last.rnc but disallowing varref
last.primary = literal
| element contextItemExpr { empty }
| fun
| element sequenceExpr { last.path* }
# everything except numerical literals, operations, and functions
predicates = element predicates {
( varref
| str
| element contextItemExpr { empty }
| fun # needs to be refined!
| element sequenceExpr { expr* }
| op # needs to be refined!
| path
| if.expr )*
}
fun.root = notAllowed
}
# XPath fragment of XQueryX in Relax NG compact syntax
#
# This fragment can be evaluated in linear time in the size of the XML
# document. It is based on Mikołaj Bojańczyk and Paweł Parys, _XPath
# evaluation in linear time_, Journal of the ACM, Volume 58(4),
# Article No. 17, 2011. doi:10.1145/1989727.1989731
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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-data.rnc"
op |= element ( ltOp | leOp | gtOp | geOp
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
) {
element firstOperand { expr },
element secondOperand { expr }
}
fun |= element functionCallExpr {
element functionName {
attribute xqx:prefix { string "fn" }?,
attribute xqx:URI { string "http://www.w3.org/2005/xpath-functions" }?,
( string "string"
| string "starts-with"
| string "ends-with"
| string "contains"
)
},
element arguments { expr* }?
}
\ No newline at end of file
# Forward DataXPath fragment of XQueryX in Relax NG compact syntax
#
# Based on Diego Figueira, _Forward-XPath and extended register
# automata on data-trees_, in the Proceedings of the 13th
# International Conference on Database Theory (ICDT'10), pages
# 230--240, ACM Press, 2010. doi:10.1145/1804669.1804699
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
include "xpath-1.0-data.rnc" {
start = element pathExpr { element rootExpr { empty }, step* }
| expr
path = element pathExpr { step+ }
axis = element xpathAxis {
( string "child"
| string "attribute"
| string "self"
| string "descendant-or-self"
| string "descendant"
| string "following-sibling" )
}
last.axis = element xpathAxis {
( string "child" # Needs 'following-sibling'
| string "attribute"
| string "self" # Always
| string "following-sibling" # Always (needs itself)
| string "descendant" # We have child and regular XPath
| string "descendant-or-self"
)
}
# everything except numerical literals, operations, and functions
predicates = element predicates {
( varref
| str
| element contextItemExpr { empty }
| fun # needs to be refined!
| element sequenceExpr { expr* }
| op # needs to be refined!
| path
| if.expr )*
}
fun.root = notAllowed
}
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
start = expr
# ----------------------------------------------------------------
# Expressions
expr = op | path | primary
# ----------------------------------------------------------------
# Operations
op = element ( andOp | orOp | unionOp ) {
element firstOperand { expr },
element secondOperand { expr }
}
# ----------------------------------------------------------------
# Function calls
include "expr/literal.rnc"
include "expr/varref.rnc"
primary = literal
| varref
| element contextItemExpr { empty }
| fun
| element sequenceExpr { expr* }
# Boolean functions
fun = element functionCallExpr {
element functionName { external "fn/bool.rnc" },
element arguments { expr* }?
}
# ----------------------------------------------------------------
# Paths
path = element pathExpr {
( element rootExpr { empty }, step* ) | step+
}
step = element stepExpr {
((axis, nodetest) | element filterExpr { primary } ),
predicates?
}
axis = forward.axis | backward.axis | deterministic.axis
forward.axis = element xpathAxis {
( string "child"
| string "descendant-or-self"
| string "descendant"
| string "following-sibling"
)
}
backward.axis = element xpathAxis {
string "following" # equivalent to descendant | ancestor/following-sibling/descendant-or-self
| string "ancestor"
| string "ancestor-or-self"
| string "preceding"
| string "preceding-sibling"
}
deterministic.axis = element xpathAxis {
string "attribute"
| string "self"
| string "parent"
}
nodetest = element nameTest { external "misc/eqname.rnc" }
| external "misc/tests.rnc"
| element Wildcard {
( element star { empty } & element NCName { xsd:NCName } )?
}
# which predicates can we handle?
predicates = element predicates { expr* }
# Vertical DataXPath fragment of XQueryX in Relax NG compact syntax
#
# Based on Diego Figueira and Luc Segoufin, _Bottom-up automata on
# data trees and vertical XPath_, in the Proceedings of the 28th Annual
# Symposium on Theoretical Aspects of Computer Science (STACS'11),
# volume 9 of LIPIcs, pages 93--109, LZI, 2011.
# doi:10.4230/LIPIcs.STACS.2011.93
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
include "xpath-1.0-data.rnc" {
axis = element xpathAxis {
( string "child"
| string "attribute"
| string "self"
| string "parent"
| string "descendant-or-self"
| string "descendant"
| string "ancestor"
| string "ancestor-or-self"
| string "namespace" # obtainable using the ancestor axis
)
}
last.axis = element xpathAxis {
( string "self" # Always
| string "attribute"
| string "parent" # Always
)
}
# Same as in expr/last.rnc but disallowing varref
last.primary = literal
| element contextItemExpr { empty }
| fun
| element sequenceExpr { last.path* }
# everything except numerical literals, operations, and functions
predicates = element predicates {
( varref
| str
| element contextItemExpr { empty }
| fun # needs to be refined!
| element sequenceExpr { expr* }
| op # needs to be refined!
| path
| if.expr )*
}
}
# XPath 2.0 Core fragment of XQueryX in Relax NG compact syntax.
#
# Based on Balder ten Cate and Carsten Lutz, _The complexity of query
# containment in expressive fragments of XPath 2.0_, Journal of the
# ACM, vol. 56(6), article 31, 2009. doi:10.1145/1568318.1568321
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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-core.rnc"
include "expr/for.rnc"
include "expr/quant.rnc"
op |= element ( intersectOp | exceptOp # path intersection
| isOp | nodeBeforeOp | nodeAfterOp # node comparisons
# is this really handled?
) {
element firstOperand { expr },
element secondOperand { expr }
}
# Allow last() on arbitrary paths
predicates |= last.predicate
# XPath fragment of XQueryX in Relax NG compact syntax
#
# Copyright (C) 2016-2017
# David Baelde, Anthony Lick and 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"
start = expr
# [7] ExprSingle ::= ForExpr | LetExpr | QuantifiedExpr
# | IfExpr
include "expr/flwor.rnc"
include "expr/quant.rnc"
include "expr/if.rnc"
# ----------------------------------------------------------------
# Expressions
# [7] ExprSingle ::= ... | OrExpr
expr |= op
# [20] RangeExpr ::= AdditiveExpr ("to" AdditiveExpr)*
#expr |= element rangeSequenceExpr {
# element startExpr { expr },
# element endExpr { expr }
#}
# [30] ValueExpr ::= SimpleMapExpr
# [34] SimpleMapExpr ::= PathExpr ("!" PathExpr)*
#expr |= element simpleMapExpr { path, path+ }
expr |= path
expr |= primary
# ----------------------------------------------------------------
# Operations
# [16] OrExpr ::= AndExpr ("or" AndExpr)*
# [17] AndExpr ::= ComparisonExpr ( "and" ComparisonExpr)*
# [18] ComparisonExpr ::= StringConcatExpr ( (Valuecomp
# |GeneralComp
# |NodeComp) StringConcatExpr)?
# [19] StringConcatExpr ::= RangeExpr ("||" RangeExpr)*
# [21] AdditiveExpr ::= MultiplicativeExpr( ("+"|"-") MultiplicativeExpr)*
# [22] MultiplicativeExpr ::= UnionExpr ( ("*" | "div" | "idiv" | "mod")
# UnionExpr)*
# [23] UnionExpr ::= IntersectExceptExpr ( ("union" | "|")
# IntersectExceptExpr)*
# [24] IntersectExceptExpr ::= InstanceofExpr ( ("intersect" | "except" )
# InstanceofExpr)*
# [31] GeneralComp ::= "=" | "!=" | "<" | "<=" | ">" | ">="
# [32] ValueComp ::= "eq" | "ne" | "lt" | "le" | "gt" | "ge"
# [33] NodeComp ::= "is" | "<<" | ">>"
op |= element ( andOp | orOp # Boolean
| unionOp # path union
| eqOp | neOp | equalOp | notEqualOp # equality
| ltOp | leOp | gtOp | geOp # order
| lessThanOp | lessThanOrEqualOp
| greaterThanOp | greaterThanOrEqualOp
| isOp | nodeBeforeOp | nodeAfterOp # node comparisons
| addOp | subtractOp | multiplyOp # arithmetic
| divOp | idivOp | modOp
| intersectOp | exceptOp # path intersection
| stringConcatenateOp # string
) {
element firstOperand { expr },
element secondOperand { expr }
}
# [29] UnaryExpr ::= ("-" | "+")* ValueExpr
op |= element ( unaryPlusOp | unaryMinusOp ) {
element operand { expr }
}
# ----------------------------------------------------------------
# Function calls
# [52] PrimaryExpr ::= Literal | VarRef | ParenthesizedExpr
# | ContextItemExpr | FunctionCall | FunctionItemExpr
# [58] ContextItemExpr ::= "."
include "expr/literal.rnc"
include "expr/varref.rnc"
primary = literal
| varref
| element contextItemExpr { empty }
| fun
# [6] Expr ::= ExprSingle ("," ExprSingle ")"
primary |= element sequenceExpr { expr* }
# [59] FunctionCall ::= EQName ArgumentList
# [49] ArgumentList ::= "(" (Argument ("," Argument)* )? ")"
# [60] Argument ::= ExprSingle | ArgumentPlaceholder
# [61] ArgumentPlaceholder ::= "?"
fun = element functionCallExpr {
element functionName {
external "fn/standard.rnc" | external "fn/math.rnc"
},
element arguments {
( expr | element argumentPlaceholder { empty } )*
}?
}
# ----------------------------------------------------------------
# Paths
# [35] PathExpr ::= ( "/" RelativePathExpr?)
# | ( "//" RelativePathExpr)
# | RelativePathExpr
# [36] RelativePathExpr ::= StepExpr (("/" | "//") StepExpr)*
path = element pathExpr {
( element rootExpr { empty }, step* ) | step+
}
# [37] StepExpr ::= PostfixExpr | AxisStep
# [38] AxisStep ::= (ReverseStep | ForwardStep) PredicateList
# [39] ForwardStep ::= (ForwardAxis NodeTest) | AbbrevForwardStep
# [42] ReverseStep ::= (ReverseAxis NodeTest) | AbbrevReverseStep
step = element stepExpr {
((axis, nodetest) | element filterExpr { primary } ),
element predicates { expr* }?
}
# [40] ForwardAxis ::= ("child" "::")
# | ("descendant" "::")
# | ("attribute" "::")
# | ("self" "::")
# | ("descendant-or-self" "::")
# | ("following-sibling" "::")
# | ("following" "::")
# | ("namespace" "::")
# [41] AbbrevForwardStep ::= "@"? NodeTest
# [43] ReverseAxis ::= ("parent" "::")
# | ("ancestor" "::")
# | ("preceding-sibling" "::")
# | ("preceding" "::")
# | ("ancestor-or-self" "::")
# [44] AbbrevReverseStep ::= ".."
axis = element xpathAxis {
( string "child"
| string "attribute"
| string "self"
| string "parent"
| string "descendant-or-self"
| string "descendant"
| string "following"
| string "following-sibling"
| string "ancestor"
| string "ancestor-or-self"
| string "preceding"
| string "preceding-sibling"