diff --git a/shacl-compact-syntax/grammar/Makefile b/shacl-compact-syntax/grammar/Makefile new file mode 100644 index 0000000..ae93d36 --- /dev/null +++ b/shacl-compact-syntax/grammar/Makefile @@ -0,0 +1,34 @@ +# delete targets that caused an error +.DELETE_ON_ERROR: + +# make as many targets as you can +# .IGNORE: + +ebnf-convert = java -jar c:/prog/bin/ebnf-convert.war +rr = java -jar c:/prog/bin/rr.war + +HTML = shaclc-ANTLR.html shaclc-JavaCC.html shaclc-Jison.html shaclc-XText.html + +# MD = shaclc-ANTLR.md shaclc-JavaCC.md shaclc-Jison.md shaclc-XText.md +# Neither embedded PNG nor SVG is rendered by Github markdown + +all: $(HTML) # $(MD) + +%.html: %.ebnf + $(rr) $^ > $@ + +%.md: %.ebnf + $(rr) -md -png $^ > $@ + +shaclc-ANTLR.ebnf : shaclc-ANTLR.g4 + $(ebnf-convert) $^ > $@ + +shaclc-JavaCC.ebnf: shaclc-JavaCC.jj + $(ebnf-convert) $^ > $@ + +shaclc-Jison.ebnf : shaclc-Jison.jison + $(ebnf-convert) $^ > $@ + +shaclc-XText.ebnf : shaclc-XText.xtext + $(ebnf-convert) $^ > $@ + diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md new file mode 100644 index 0000000..252f517 --- /dev/null +++ b/shacl-compact-syntax/grammar/README.md @@ -0,0 +1,31 @@ +# Unifying SHACL-C Grammars +(Task: https://github.com/w3c/shacl/issues/37#issuecomment-1997655429 ) + +As a first task of the SHACL Compact Syntax Task Force, we look at proposed SHACL-C grammars: + +- [ANTLR](shaclc-ANTLR.g4) (was part of TopQuadrant SHACL, also in the [grammar-section](https://w3c.github.io/shacl/shacl-compact-syntax/#grammar-section) of the candidate spec) by @HolgerKnublauch +- [JavaCC](https://github.com/apache/jena/blob/main/jena-shacl/shaclc/shaclc.jj) (part of Jena) by @afs +- [XText](https://gitlab.com/allotrope-open-source/shape-editor/-/blob/master/src/com.osthus.shapes.shaclc.parent/com.osthus.shapes.shaclc/src/com/osthus/shapes/shaclc/SHACLC.xtext) (part of Allotrope-open-source) by @tw-osthus +- [Jison](https://github.com/jeswr/shaclcjs/blob/main/lib/shaclc.jison) (part of shacl.js) by @jeswr + +We use two tools to understand them and try to unify them: +- https://github.com/GuntherRademacher/ebnf-convert to convert them to W3C-style EBNF, which is also needed for official publication. +- https://github.com/GuntherRademacher/rr to produce "rail-road" diagrams, which make it easier to understand the grammars. + +Problems: +- DONE: Unicode escapes in XText: https://github.com/GuntherRademacher/ebnf-convert/issues/8 . + This was fixed 22-Mar-2024: build from source and use `build/distributions/ebnf-convert-0.68-SNAPSHOT-java11.zip/ebnf-convert.war` +- DONE: fixed problems in Jison: https://github.com/w3c/shacl/issues/48 . + +`rr` can make railroad diagrams in HTML or Markdown. +- The Markdown uses embedded images (eg `data:image/png;base64`), which are not rendered by Github (neither PNG nor SVG) +- We could ask `rr` to put the images outside, but I think that's too much trouble +- So instead, we use HTML where the images are embedded as SVG and render properly + +# Candidate SHACL-C Grammars + +- [shacl-ANTLR.g4](shacl-ANTLR.g4) -> [shacl-ANTLR.ebnf](shacl-ANTLR.ebnf) -> [shaclc-ANTLR.html](https://rawgit2.com/shacl/master/shacl-compact-syntax/grammar/shaclc-ANTLR.html) (or [in branch](https://rawgit2.com/VladimirAlexiev/shacl/shaclc-grammars/shacl-compact-syntax/grammar/shaclc-ANTLR.html)) +- [shacl-JavaCC.jj](shacl-JavaCC.jj) -> [shacl-JavaCC.ebnf](shacl-JavaCC.ebnf) -> [shaclc-JavaCC.html](https://rawgit2.com/shacl/master/shacl-compact-syntax/grammar/shaclc-JavaCC.html) (or [in branch](https://rawgit2.com/VladimirAlexiev/shacl/shaclc-grammars/shacl-compact-syntax/grammar/shaclc-JavaCC.html)) +- [shacl-XText.xtext](shacl-XText.xtext) -> [shacl-XText.ebnf](shacl-XText.ebnf) -> [shaclc-XText.html](https://rawgit2.com/shacl/master/shacl-compact-syntax/grammar/shaclc-XText.html) (or [in branch](https://rawgit2.com/VladimirAlexiev/shacl/shaclc-grammars/shacl-compact-syntax/grammar/shaclc-XText.html)) +- [shacl-Jison.jison](shacl-Jison.jison) -> [shacl-Jison.ebnf](shacl-Jison.ebnf) -> [shaclc-Jison.html](https://rawgit2.com/shacl/master/shacl-compact-syntax/grammar/shaclc-Jison.html) (or [in branch](https://rawgit2.com/VladimirAlexiev/shacl/shaclc-grammars/shacl-compact-syntax/grammar/shaclc-Jison.html)) + diff --git a/shacl-compact-syntax/grammar/shaclc-ANTLR.ebnf b/shacl-compact-syntax/grammar/shaclc-ANTLR.ebnf new file mode 100644 index 0000000..d744bbe --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-ANTLR.ebnf @@ -0,0 +1,203 @@ +/* converted on Mon Mar 18, 2024, 18:17 (UTC+02) by antlr_4-to-w3c v0.67 which is Copyright (c) 2011-2024 by Gunther Rademacher */ + +shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF +directive + ::= baseDecl + | importsDecl + | prefixDecl +baseDecl ::= 'BASE' IRIREF +importsDecl + ::= 'IMPORTS' IRIREF +prefixDecl + ::= 'PREFIX' PNAME_NS IRIREF +shapeClass + ::= 'shapeClass' iri nodeShapeBody +nodeShape + ::= 'shape' iri targetClass? nodeShapeBody +nodeShapeBody + ::= '{' constraint* '}' +targetClass + ::= '->' iri+ +constraint + ::= ( nodeOr+ | propertyShape ) '.' +nodeOr ::= nodeNot ( '|' nodeNot )* +nodeNot ::= '!'? nodeValue +nodeValue + ::= nodeParam '=' iriOrLiteralOrArray +propertyShape + ::= path ( propertyCount | propertyOr )* +propertyOr + ::= propertyNot ( '|' propertyNot )* +propertyNot + ::= '!'? propertyAtom +propertyAtom + ::= propertyType + | nodeKind + | shapeRef + | propertyValue + | nodeShapeBody +propertyCount + ::= '[' propertyMinCount '..' propertyMaxCount ']' +propertyMinCount + ::= INTEGER +propertyMaxCount + ::= INTEGER + | '*' +propertyType + ::= iri +nodeKind ::= 'BlankNode' + | 'IRI' + | 'Literal' + | 'BlankNodeOrIRI' + | 'BlankNodeOrLiteral' + | 'IRIOrLiteral' +shapeRef ::= ATPNAME_LN + | ATPNAME_NS + | '@' IRIREF +propertyValue + ::= propertyParam '=' iriOrLiteralOrArray +path ::= pathAlternative +pathAlternative + ::= pathSequence ( '|' pathSequence )* +pathSequence + ::= pathEltOrInverse ( '/' pathEltOrInverse )* +pathElt ::= pathPrimary pathMod? +pathEltOrInverse + ::= '^'? pathElt +pathMod ::= '?' + | '*' + | '+' +pathPrimary + ::= iri + | '(' path ')' +iriOrLiteralOrArray + ::= iriOrLiteral + | array +iriOrLiteral + ::= iri + | literal +iri ::= IRIREF + | prefixedName +prefixedName + ::= PNAME_LN + | PNAME_NS +literal ::= rdfLiteral + | numericLiteral + | booleanLiteral +booleanLiteral + ::= 'true' + | 'false' +numericLiteral + ::= INTEGER + | DECIMAL + | DOUBLE +rdfLiteral + ::= string ( LANGTAG | '^^' datatype )? +datatype ::= iri +string ::= STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 + | STRING_LITERAL1 + | STRING_LITERAL2 +array ::= '[' iriOrLiteral* ']' +nodeParam + ::= 'targetNode' + | 'targetObjectsOf' + | 'targetSubjectsOf' + | 'deactivated' + | 'severity' + | 'message' + | 'class' + | 'datatype' + | 'nodeKind' + | 'minExclusive' + | 'minInclusive' + | 'maxExclusive' + | 'maxInclusive' + | 'minLength' + | 'maxLength' + | 'pattern' + | 'flags' + | 'languageIn' + | 'equals' + | 'disjoint' + | 'closed' + | 'ignoredProperties' + | 'hasValue' + | 'in' +propertyParam + ::= 'deactivated' + | 'severity' + | 'message' + | 'class' + | 'datatype' + | 'nodeKind' + | 'minExclusive' + | 'minInclusive' + | 'maxExclusive' + | 'maxInclusive' + | 'minLength' + | 'maxLength' + | 'pattern' + | 'flags' + | 'languageIn' + | 'uniqueLang' + | 'equals' + | 'disjoint' + | 'lessThan' + | 'lessThanOrEquals' + | 'qualifiedValueShape' + | 'qualifiedMinCount' + | 'qualifiedMaxCount' + | 'qualifiedValueShapesDisjoint' + | 'closed' + | 'ignoredProperties' + | 'hasValue' + | 'in' +_ ::= PASS + | COMMENT + /* ws: definition */ + + + +PASS ::= [ #x9#xd#xa]+ +COMMENT ::= '#' [^#xd#xa]* +IRIREF ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] | UCHAR )* '>' +PNAME_NS ::= PN_PREFIX? ':' +PNAME_LN ::= PNAME_NS PN_LOCAL +ATPNAME_NS + ::= '@' PN_PREFIX? ':' +ATPNAME_LN + ::= '@' PNAME_NS PN_LOCAL +LANGTAG ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )* +INTEGER ::= [+#x2D]? [0-9]+ +DECIMAL ::= [+#x2D]? [0-9]* '.' [0-9]+ +DOUBLE ::= [+#x2D]? ( [0-9]+ '.' | '.'? [0-9] ) [0-9]* EXPONENT +EXPONENT ::= [eE] [+#x2D]? [0-9]+ +STRING_LITERAL1 + ::= "'" ( [^#x0027#x005C#x000A#x000D] | ECHAR | UCHAR )* "'" +STRING_LITERAL2 + ::= '"' ( [^#x0022#x005C#x000A#x000D] | ECHAR | UCHAR )* '"' +STRING_LITERAL_LONG1 + ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" +STRING_LITERAL_LONG2 + ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' +UCHAR ::= ( '\u' | '\U' HEX HEX HEX HEX ) HEX HEX HEX HEX +ECHAR ::= '\' [tbnrf\"'] +WS ::= [#x0020#x0009#x000D#x000A] +PN_CHARS_BASE + ::= [A-Za-z#x00C0-#x00D6#x00D8-#x00F6#x00F8-#x02FF#x0370-#x037D#x037F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD] +PN_CHARS_U + ::= PN_CHARS_BASE + | '_' +PN_CHARS ::= PN_CHARS_U + | [-0-9#x00B7#x0300-#x036F#x203F-#x2040] +PN_PREFIX + ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )? +PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )? +PLX ::= PERCENT + | PN_LOCAL_ESC +PERCENT ::= '%' HEX HEX +HEX ::= [0-9A-Fa-f] +PN_LOCAL_ESC + ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) +EOF ::= $ \ No newline at end of file diff --git a/shacl-compact-syntax/SHACLC.g4 b/shacl-compact-syntax/grammar/shaclc-ANTLR.g4 similarity index 100% rename from shacl-compact-syntax/SHACLC.g4 rename to shacl-compact-syntax/grammar/shaclc-ANTLR.g4 diff --git a/shacl-compact-syntax/grammar/shaclc-ANTLR.html b/shacl-compact-syntax/grammar/shaclc-ANTLR.html new file mode 100644 index 0000000..d19e165 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-ANTLR.html @@ -0,0 +1,2142 @@ + + + + + + + + + + +

shaclDoc:

+ + + + + directive + + + nodeShape + + + shapeClass + + + EOF + +

+

+
shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF
+

+

no references


directive:

+ + + + + baseDecl + + + importsDecl + + + prefixDecl + +

+

+
directive
+
         ::= baseDecl
+
           | importsDecl
+
           | prefixDecl
+

+

referenced by: +

+


baseDecl:

+ + + + + BASE + + + IRIREF + +

+

+
baseDecl ::= 'BASE' IRIREF
+

+

referenced by: +

+


importsDecl:

+ + + + + IMPORTS + + + IRIREF + +

+

+
importsDecl
+
         ::= 'IMPORTS' IRIREF
+

+

referenced by: +

+


prefixDecl:

+ + + + + PREFIX + + + PNAME_NS + + + IRIREF + +

+

+
prefixDecl
+
         ::= 'PREFIX' PNAME_NS IRIREF
+

+

referenced by: +

+


shapeClass:

+ + + + + shapeClass + + + iri + + + nodeShapeBody + +

+

+
shapeClass
+
         ::= 'shapeClass' iri nodeShapeBody
+

+

referenced by: +

+


nodeShape:

+ + + + + shape + + + iri + + + targetClass + + + nodeShapeBody + +

+

+
nodeShape
+
         ::= 'shape' iri targetClass? nodeShapeBody
+

+

referenced by: +

+


nodeShapeBody:

+ + + + + { + + + constraint + + } + + +

+

+
nodeShapeBody
+
         ::= '{' constraint* '}'
+

+

referenced by: +

+


targetClass:

+ + + + + -> + + + iri + +

+

+
targetClass
+
         ::= '->' iri+
+

+

referenced by: +

+


constraint:

+ + + + + nodeOr + + + propertyShape + + . + + +

+

+
constraint
+
         ::= ( nodeOr+ | propertyShape ) '.'
+

+

referenced by: +

+


nodeOr:

+ + + + + nodeNot + + | + + +

+

+
nodeOr   ::= nodeNot ( '|' nodeNot )*
+

+

referenced by: +

+


nodeNot:

+ + + + + ! + + + nodeValue + +

+

+
nodeNot  ::= '!'? nodeValue
+

+

referenced by: +

+


nodeValue:

+ + + + + nodeParam + + = + + + iriOrLiteralOrArray + +

+

+
nodeValue
+
         ::= nodeParam '=' iriOrLiteralOrArray
+

+

referenced by: +

+


propertyShape:

+ + + + + path + + + propertyCount + + + propertyOr + +

+

+
propertyShape
+
         ::= path ( propertyCount | propertyOr )*
+

+

referenced by: +

+


propertyOr:

+ + + + + propertyNot + + | + + +

+

+
propertyOr
+
         ::= propertyNot ( '|' propertyNot )*
+

+

referenced by: +

+


propertyNot:

+ + + + + ! + + + propertyAtom + +

+

+
propertyNot
+
         ::= '!'? propertyAtom
+

+

referenced by: +

+


propertyAtom:

+ + + + + propertyType + + + nodeKind + + + shapeRef + + + propertyValue + + + nodeShapeBody + +

+

+
propertyAtom
+
         ::= propertyType
+
           | nodeKind
+
           | shapeRef
+
           | propertyValue
+
           | nodeShapeBody
+

+

referenced by: +

+


propertyCount:

+ + + + + [ + + + propertyMinCount + + .. + + + propertyMaxCount + + ] + + +

+

+
propertyCount
+
         ::= '[' propertyMinCount '..' propertyMaxCount ']'
+

+

referenced by: +

+


propertyMinCount:

+ + + + + INTEGER + +

+

+
propertyMinCount
+
         ::= INTEGER
+

+

referenced by: +

+


propertyMaxCount:

+ + + + + INTEGER + + * + + +

+

+
propertyMaxCount
+
         ::= INTEGER
+
           | '*'
+

+

referenced by: +

+


propertyType:

+ + + + + iri + +

+

+
propertyType
+
         ::= iri
+

+

referenced by: +

+


nodeKind:

+ + + + + BlankNode + + + IRI + + + Literal + + + BlankNodeOrIRI + + + BlankNodeOrLiteral + + + IRIOrLiteral + + +

+

+
nodeKind ::= 'BlankNode'
+
           | 'IRI'
+
           | 'Literal'
+
           | 'BlankNodeOrIRI'
+
           | 'BlankNodeOrLiteral'
+
           | 'IRIOrLiteral'
+

+

referenced by: +

+


shapeRef:

+ + + + + ATPNAME_LN + + + ATPNAME_NS + + @ + + + IRIREF + +

+

+
shapeRef ::= ATPNAME_LN
+
           | ATPNAME_NS
+
           | '@' IRIREF
+

+

referenced by: +

+


propertyValue:

+ + + + + propertyParam + + = + + + iriOrLiteralOrArray + +

+

+
propertyValue
+
         ::= propertyParam '=' iriOrLiteralOrArray
+

+

referenced by: +

+


path:

+ + + + + pathAlternative + +

+

+
path     ::= pathAlternative
+

+

referenced by: +

+


pathAlternative:

+ + + + + pathSequence + + | + + +

+

+
pathAlternative
+
         ::= pathSequence ( '|' pathSequence )*
+

+

referenced by: +

+


pathSequence:

+ + + + + pathEltOrInverse + + / + + +

+

+
pathSequence
+
         ::= pathEltOrInverse ( '/' pathEltOrInverse )*
+

+

referenced by: +

+


pathElt:

+ + + + + pathPrimary + + + pathMod + +

+

+
pathElt  ::= pathPrimary pathMod?
+

+

referenced by: +

+


pathEltOrInverse:

+ + + + + ^ + + + pathElt + +

+

+
pathEltOrInverse
+
         ::= '^'? pathElt
+

+

referenced by: +

+


pathMod:

+ + + + + ? + + + * + + + + + + +

+

+
pathMod  ::= '?'
+
           | '*'
+
           | '+'
+

+

referenced by: +

+


pathPrimary:

+ + + + + iri + + ( + + + path + + ) + + +

+

+
pathPrimary
+
         ::= iri
+
           | '(' path ')'
+

+

referenced by: +

+


iriOrLiteralOrArray:

+ + + + + iriOrLiteral + + + array + +

+

+
iriOrLiteralOrArray
+
         ::= iriOrLiteral
+
           | array
+

+

referenced by: +

+


iriOrLiteral:

+ + + + + iri + + + literal + +

+

+
iriOrLiteral
+
         ::= iri
+
           | literal
+

+

referenced by: +

+


iri:

+ + + + + IRIREF + + + prefixedName + +

+

+
iri      ::= IRIREF
+
           | prefixedName
+

+

referenced by: +

+


prefixedName:

+ + + + + PNAME_LN + + + PNAME_NS + +

+

+
prefixedName
+
         ::= PNAME_LN
+
           | PNAME_NS
+

+

referenced by: +

+


literal:

+ + + + + rdfLiteral + + + numericLiteral + + + booleanLiteral + +

+

+
literal  ::= rdfLiteral
+
           | numericLiteral
+
           | booleanLiteral
+

+

referenced by: +

+


booleanLiteral:

+ + + + + true + + + false + + +

+

+
booleanLiteral
+
         ::= 'true'
+
           | 'false'
+

+

referenced by: +

+


numericLiteral:

+ + + + + INTEGER + + + DECIMAL + + + DOUBLE + +

+

+
numericLiteral
+
         ::= INTEGER
+
           | DECIMAL
+
           | DOUBLE
+

+

referenced by: +

+


rdfLiteral:

+ + + + + string + + + LANGTAG + + ^^ + + + datatype + +

+

+
rdfLiteral
+
         ::= string ( LANGTAG | '^^' datatype )?
+

+

referenced by: +

+


datatype:

+ + + + + iri + +

+

+
datatype ::= iri
+

+

referenced by: +

+


string:

+ + + + + STRING_LITERAL_LONG1 + + + STRING_LITERAL_LONG2 + + + STRING_LITERAL1 + + + STRING_LITERAL2 + +

+

+
string   ::= STRING_LITERAL_LONG1
+
           | STRING_LITERAL_LONG2
+
           | STRING_LITERAL1
+
           | STRING_LITERAL2
+

+

referenced by: +

+


array:

+ + + + + [ + + + iriOrLiteral + + ] + + +

+

+
array    ::= '[' iriOrLiteral* ']'
+

+

referenced by: +

+


nodeParam:

+ + + + + targetNode + + + targetObjectsOf + + + targetSubjectsOf + + + deactivated + + + severity + + + message + + + class + + + datatype + + + nodeKind + + + minExclusive + + + minInclusive + + + maxExclusive + + + maxInclusive + + + minLength + + + maxLength + + + pattern + + + flags + + + languageIn + + + equals + + + disjoint + + + closed + + + ignoredProperties + + + hasValue + + + in + + +

+

+
nodeParam
+
         ::= 'targetNode'
+
           | 'targetObjectsOf'
+
           | 'targetSubjectsOf'
+
           | 'deactivated'
+
           | 'severity'
+
           | 'message'
+
           | 'class'
+
           | 'datatype'
+
           | 'nodeKind'
+
           | 'minExclusive'
+
           | 'minInclusive'
+
           | 'maxExclusive'
+
           | 'maxInclusive'
+
           | 'minLength'
+
           | 'maxLength'
+
           | 'pattern'
+
           | 'flags'
+
           | 'languageIn'
+
           | 'equals'
+
           | 'disjoint'
+
           | 'closed'
+
           | 'ignoredProperties'
+
           | 'hasValue'
+
           | 'in'
+

+

referenced by: +

+


propertyParam:

+ + + + + deactivated + + + severity + + + message + + + class + + + datatype + + + nodeKind + + + minExclusive + + + minInclusive + + + maxExclusive + + + maxInclusive + + + minLength + + + maxLength + + + pattern + + + flags + + + languageIn + + + uniqueLang + + + equals + + + disjoint + + + lessThan + + + lessThanOrEquals + + + qualifiedValueShape + + + qualifiedMinCount + + + qualifiedMaxCount + + + qualifiedValueShapesDisjoint + + + closed + + + ignoredProperties + + + hasValue + + + in + + +

+

+
propertyParam
+
         ::= 'deactivated'
+
           | 'severity'
+
           | 'message'
+
           | 'class'
+
           | 'datatype'
+
           | 'nodeKind'
+
           | 'minExclusive'
+
           | 'minInclusive'
+
           | 'maxExclusive'
+
           | 'maxInclusive'
+
           | 'minLength'
+
           | 'maxLength'
+
           | 'pattern'
+
           | 'flags'
+
           | 'languageIn'
+
           | 'uniqueLang'
+
           | 'equals'
+
           | 'disjoint'
+
           | 'lessThan'
+
           | 'lessThanOrEquals'
+
           | 'qualifiedValueShape'
+
           | 'qualifiedMinCount'
+
           | 'qualifiedMaxCount'
+
           | 'qualifiedValueShapesDisjoint'
+
           | 'closed'
+
           | 'ignoredProperties'
+
           | 'hasValue'
+
           | 'in'
+

+

referenced by: +

+


_:

+ + + + + PASS + + + COMMENT + +

+

+
_        ::= PASS
+
           | COMMENT
+
          /* ws: definition */
+

+

no references


PASS:

+ + + + + + + + [#x9] + + + [#xd] + + + [#xa] + + +

+

+
PASS     ::= [ #x9#xd#xa]+
+

+

referenced by: +

+


COMMENT:

+ + + + + # + + + [^#xd#xa] + + +

+

+
COMMENT  ::= '#' [^#xd#xa]*
+

+

referenced by: +

+


IRIREF:

+ + + + + < + + + [^=<>"{}|^`\#x0000-#x0020] + + + UCHAR + + > + + +

+

+
IRIREF   ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] | UCHAR )* '>'
+

+

referenced by: +

+


PNAME_NS:

+ + + + + PN_PREFIX + + : + + +

+

+
PNAME_NS ::= PN_PREFIX? ':'
+

+

referenced by: +

+


PNAME_LN:

+ + + + + PNAME_NS + + + PN_LOCAL + +

+

+
PNAME_LN ::= PNAME_NS PN_LOCAL
+

+

referenced by: +

+


ATPNAME_NS:

+ + + + + @ + + + PN_PREFIX + + : + + +

+

+
ATPNAME_NS
+
         ::= '@' PN_PREFIX? ':'
+

+

referenced by: +

+


ATPNAME_LN:

+ + + + + @ + + + PNAME_NS + + + PN_LOCAL + +

+

+
ATPNAME_LN
+
         ::= '@' PNAME_NS PN_LOCAL
+

+

referenced by: +

+


LANGTAG:

+ + + + + @ + + + [a-z] + + + [A-Z] + + + - + + + [a-z] + + + [A-Z] + + + [0-9] + + +

+

+
LANGTAG  ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )*
+

+

referenced by: +

+


INTEGER:

+ + + + + + + + + [#x2D] + + + [0-9] + + +

+

+
INTEGER  ::= [+#x2D]? [0-9]+
+

+

referenced by: +

+


DECIMAL:

+ + + + + + + + + [#x2D] + + + [0-9] + + + . + + + [0-9] + + +

+

+
DECIMAL  ::= [+#x2D]? [0-9]* '.' [0-9]+
+

+

referenced by: +

+


DOUBLE:

+ + + + + + + + + [#x2D] + + + [0-9] + + + . + + + . + + + [0-9] + + + [0-9] + + + EXPONENT + +

+

+
DOUBLE   ::= [+#x2D]? ( [0-9]+ '.' | '.'? [0-9] ) [0-9]* EXPONENT
+

+

referenced by: +

+


EXPONENT:

+ + + + + e + + + E + + + + + + + [#x2D] + + + [0-9] + + +

+

+
EXPONENT ::= [eE] [+#x2D]? [0-9]+
+

+

referenced by: +

+


STRING_LITERAL1:

+ + + + + ' + + + [^#x0027#x005C#x000A#x000D] + + + ECHAR + + + UCHAR + + ' + + +

+

+
STRING_LITERAL1
+
         ::= "'" ( [^#x0027#x005C#x000A#x000D] | ECHAR | UCHAR )* "'"
+

+

referenced by: +

+


STRING_LITERAL2:

+ + + + + " + + + [^#x0022#x005C#x000A#x000D] + + + ECHAR + + + UCHAR + + " + + +

+

+
STRING_LITERAL2
+
         ::= '"' ( [^#x0022#x005C#x000A#x000D] | ECHAR | UCHAR )* '"'
+

+

referenced by: +

+


STRING_LITERAL_LONG1:

+ + + + + ''' + + + ' + + + '' + + + [^'\] + + + ECHAR + + + UCHAR + + ''' + + +

+

+
STRING_LITERAL_LONG1
+
         ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
+

+

referenced by: +

+


STRING_LITERAL_LONG2:

+ + + + + """ + + + " + + + "" + + + [^"\] + + + ECHAR + + + UCHAR + + """ + + +

+

+
STRING_LITERAL_LONG2
+
         ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
+

+

referenced by: +

+


UCHAR:

+ + + + + \u + + + \U + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + +

+

+
UCHAR    ::= ( '\u' | '\U' HEX HEX HEX HEX ) HEX HEX HEX HEX
+

+

referenced by: +

+


ECHAR:

+ + + + + \ + + + t + + + b + + + n + + + r + + + f + + + \ + + + " + + + ' + + +

+

+
ECHAR    ::= '\' [tbnrf\"']
+

+

referenced by: +

+


WS:

+ + + + + [#x0020] + + + [#x0009] + + + [#x000D] + + + [#x000A] + + +

+

+
WS       ::= [#x0020#x0009#x000D#x000A]
+

+

no references


PN_CHARS_BASE:

+ + + + + [A-Z] + + + [a-z] + + + [#x00C0-#x00D6] + + + [#x00D8-#x00F6] + + + [#x00F8-#x02FF] + + + [#x0370-#x037D] + + + [#x037F-#x1FFF] + + + [#x200C-#x200D] + + + [#x2070-#x218F] + + + [#x2C00-#x2FEF] + + + [#x3001-#xD7FF] + + + [#xF900-#xFDCF] + + + [#xFDF0-#xFFFD] + + +

+

+
PN_CHARS_BASE
+
         ::= [A-Za-z#x00C0-#x00D6#x00D8-#x00F6#x00F8-#x02FF#x0370-#x037D#x037F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD]
+

+

referenced by: +

+


PN_CHARS_U:

+ + + + + PN_CHARS_BASE + + _ + + +

+

+
PN_CHARS_U
+
         ::= PN_CHARS_BASE
+
           | '_'
+

+

referenced by: +

+


PN_CHARS:

+ + + + + PN_CHARS_U + + - + + + [0-9] + + + [#x00B7] + + + [#x0300-#x036F] + + + [#x203F-#x2040] + + +

+

+
PN_CHARS ::= PN_CHARS_U
+
           | [-0-9#x00B7#x0300-#x036F#x203F-#x2040]
+

+

referenced by: +

+


PN_PREFIX:

+ + + + + PN_CHARS_BASE + + + PN_CHARS + + . + + + PN_CHARS + +

+

+
PN_PREFIX
+
         ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
+

+

referenced by: +

+


PN_LOCAL:

+ + + + + PN_CHARS_U + + : + + + [0-9] + + + PLX + + + PN_CHARS + + . + + + : + + + PLX + + + PN_CHARS + + : + + + PLX + +

+

+
PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
+

+

referenced by: +

+


PLX:

+ + + + + PERCENT + + + PN_LOCAL_ESC + +

+

+
PLX      ::= PERCENT
+
           | PN_LOCAL_ESC
+

+

referenced by: +

+


PERCENT:

+ + + + + % + + + HEX + + + HEX + +

+

+
PERCENT  ::= '%' HEX HEX
+

+

referenced by: +

+


HEX:

+ + + + + [0-9] + + + [A-F] + + + [a-f] + + +

+

+
HEX      ::= [0-9A-Fa-f]
+

+

referenced by: +

+


PN_LOCAL_ESC:

+ + + + + \ + + + _ + + + ~ + + + . + + + - + + + ! + + + $ + + + & + + + ' + + + ( + + + ) + + + * + + + + + + + , + + + ; + + + = + + + / + + + ? + + + # + + + @ + + + % + + +

+

+
PN_LOCAL_ESC
+
         ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' + | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+

+

referenced by: +

+


EOF:

+ + + + + $ + + +

+

+
EOF      ::= $
+

+

referenced by: +

+



+

+ + + + + + +
  + ... generated by RR - Railroad Diagram Generator + + + + + + + R + R +
+

+ + \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-JavaCC.ebnf b/shacl-compact-syntax/grammar/shaclc-JavaCC.ebnf new file mode 100644 index 0000000..b1cf628 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-JavaCC.ebnf @@ -0,0 +1,219 @@ +/* converted on Mon Mar 18, 2024, 18:17 (UTC+02) by javacc-to-w3c v0.67 which is Copyright (c) 2011-2024 by Gunther Rademacher */ + +Unit ::= ByteOrderMark shaclDoc EOF +ByteOrderMark + ::= BOM? +shaclDoc ::= directive* ( nodeShape | shapeClass )* +directive + ::= baseDecl + | prefixDecl + | importDecl +baseDecl ::= 'BASE' IRIREF +prefixDecl + ::= 'PREFIX' PNAME_NS IRIREF +importDecl + ::= 'IMPORTS' iri +nodeShape + ::= 'shape' iri targetClass? nodeShapeBody +shapeClass + ::= 'shapeClass' iri nodeShapeBody +targetClass + ::= '->' iri+ +nodeShapeBody + ::= '{' constraint* '}' +constraint + ::= ( nodeOr+ | propertyShape | shapeRef ) '.' +nodeOr ::= nodeNot ( '|' nodeNot )* +nodeNot ::= '!'? nodeValue +nodeValue + ::= nodeParam '=' ( iriOrLiteral | array ) +propertyShape + ::= path ( propertyCount | propertyOr )* +propertyOr + ::= propertyNot ( '|' propertyNot )* +propertyNot + ::= '!'? propertyAtom +propertyAtom + ::= propertyType + | nodeKind + | shapeRef + | propertyValue + | nodeShapeBody +propertyCount + ::= '[' propertyMinCount '..' propertyMaxCount ']' +propertyMinCount + ::= INTEGER +propertyMaxCount + ::= INTEGER + | '*' +propertyType + ::= iri +nodeKind ::= 'BlankNode' + | 'IRI' + | 'Literal' + | 'BlankNodeOrIRI' + | 'BlankNodeOrLiteral' + | 'IRIOrLiteral' +shapeRef ::= ATPNAME_LN + | ATPNAME_NS + | '@' IRIREF +propertyValue + ::= propertyParam '=' ( iriOrLiteral | array ) +nodeParam + ::= 'targetNode' + | 'targetObjectsOf' + | 'targetSubjectsOf' + | 'targetClass' + | 'deactivated' + | 'severity' + | 'message' + | 'class' + | 'datatype' + | 'nodeKind' + | 'minExclusive' + | 'minInclusive' + | 'maxExclusive' + | 'maxInclusive' + | 'minLength' + | 'maxLength' + | 'pattern' + | 'flags' + | 'languageIn' + | 'equals' + | 'disjoint' + | 'closed' + | 'ignoredProperties' + | 'hasValue' + | 'in' +propertyParam + ::= 'deactivated' + | 'severity' + | 'message' + | 'class' + | 'datatype' + | 'nodeKind' + | 'minExclusive' + | 'minInclusive' + | 'maxExclusive' + | 'maxInclusive' + | 'minLength' + | 'maxLength' + | 'pattern' + | 'flags' + | 'languageIn' + | 'uniqueLang' + | 'equals' + | 'disjoint' + | 'lessThan' + | 'lessThanOrEquals' + | 'qualifiedValueShape' + | 'qualifiedMinCount' + | 'qualifiedMaxCount' + | 'qualifiedValueShapesDisjoint' + | 'closed' + | 'ignoredProperties' + | 'hasValue' + | 'in' + | 'group' + | 'order' + | 'name' + | 'description' + | 'defaultValue' +PathUnit ::= ByteOrderMark path EOF +path ::= pathAlternative +pathAlternative + ::= pathSequence ( '|' pathSequence )* +pathSequence + ::= pathEltOrInverse ( '/' pathEltOrInverse )* +pathElt ::= pathPrimary pathMod? +pathEltOrInverse + ::= '^'? pathElt +pathMod ::= '?' + | '*' + | '+' +pathPrimary + ::= iri + | '(' path ')' +array ::= '[' iriOrLiteral* ']' +iriOrLiteral + ::= iri + | literal +literal ::= rdfLiteral + | numericLiteral + | booleanLiteral +booleanLiteral + ::= 'true' + | 'false' +numericLiteral + ::= INTEGER + | DECIMAL + | DOUBLE +rdfLiteral + ::= string ( LANGTAG | '^^' datatype )? +datatype ::= iri +string ::= STRING_LITERAL1 + | STRING_LITERAL2 + | STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 +iri ::= IRIREF + | PrefixedName +PrefixedName + ::= PNAME_LN + | PNAME_NS +IRIREF ::= IRIref + + + +SINGLE_LINE_COMMENT + ::= '#' [^#xA#xD]* #xD? #xA? +BOM ::= #xFEFF +HEX ::= [0-9A-Fa-f] +IRIref ::= '<' ( [^><"{}^\|`#x0-#x20] | UCHAR )* '>' +PNAME_NS ::= PN_PREFIX? ':' +PNAME_LN ::= PNAME_NS PN_LOCAL +ATPNAME_NS + ::= '@' PNAME_NS +ATPNAME_LN + ::= '@' PNAME_LN +ECHAR ::= '\' ( 't' | 'b' | 'n' | 'r' | 'f' | '\' | '"' | "'" ) +UCHAR ::= UCHAR4 + | UCHAR8 +UCHAR4 ::= '\' 'u' HEX HEX HEX HEX +UCHAR8 ::= '\' 'U' HEX HEX HEX HEX HEX HEX HEX HEX +STRING_LITERAL1 + ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'" +STRING_LITERAL2 + ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"' +STRING_LITERAL_LONG1 + ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" +STRING_LITERAL_LONG2 + ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' +DIGITS ::= [0-9]+ +INTEGER ::= ( '+' | '-' )? DIGITS +DECIMAL ::= ( '+' | '-' )? DIGITS? '.' DIGITS +DOUBLE ::= ( '+' | '-' )? ( [0-9]+ ( '.' [0-9]* )? | '.' [0-9]+ ) EXPONENT +EXPONENT ::= [eE] [+#x2D]? [0-9]+ +LANGTAG ::= '@' A2Z+ ( '-' A2ZN+ )* +A2Z ::= [a-zA-Z] +A2ZN ::= [a-zA-Z0-9] +SURROGATE_PAIR + ::= [#xD800-#xDBFF] [#xDC00-#xDFFF] +PN_CHARS_BASE + ::= [A-Za-z#xC0-#xD6#xD8-#xF6#xF8-#x2FF#x370-#x37D#x37F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFFFD] + | SURROGATE_PAIR +PN_CHARS_U + ::= PN_CHARS_BASE + | '_' +PN_CHARS ::= PN_CHARS_U + | [-0-9#xB7#x300-#x36F#x203F-#x2040] +PN_PREFIX + ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )? +PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )? +VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9#xB7#x300-#x36F#x203F-#x2040] )* +PN_LOCAL_ESC + ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) +PLX ::= PERCENT + | PN_LOCAL_ESC +PERCENT ::= '%' HEX HEX +UNKNOWN ::= [^ #x9#xA#xD#xC]+ +EOF ::= $ \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-JavaCC.html b/shacl-compact-syntax/grammar/shaclc-JavaCC.html new file mode 100644 index 0000000..fc7bb11 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-JavaCC.html @@ -0,0 +1,2331 @@ + + + + + + + + + + +

Unit:

+ + + + + ByteOrderMark + + + shaclDoc + + + EOF + +

+

+
Unit     ::= ByteOrderMark shaclDoc EOF
+

+

no references


ByteOrderMark:

+ + + + + BOM + +

+

+
ByteOrderMark
+
         ::= BOM?
+

+

referenced by: +

+


shaclDoc:

+ + + + + directive + + + nodeShape + + + shapeClass + +

+

+

+

referenced by: +

+


directive:

+ + + + + baseDecl + + + prefixDecl + + + importDecl + +

+

+
directive
+
         ::= baseDecl
+
           | prefixDecl
+
           | importDecl
+

+

referenced by: +

+


baseDecl:

+ + + + + BASE + + + IRIREF + +

+

+
baseDecl ::= 'BASE' IRIREF
+

+

referenced by: +

+


prefixDecl:

+ + + + + PREFIX + + + PNAME_NS + + + IRIREF + +

+

+
prefixDecl
+
         ::= 'PREFIX' PNAME_NS IRIREF
+

+

referenced by: +

+


importDecl:

+ + + + + IMPORTS + + + iri + +

+

+
importDecl
+
         ::= 'IMPORTS' iri
+

+

referenced by: +

+


nodeShape:

+ + + + + shape + + + iri + + + targetClass + + + nodeShapeBody + +

+

+
nodeShape
+
         ::= 'shape' iri targetClass? nodeShapeBody
+

+

referenced by: +

+


shapeClass:

+ + + + + shapeClass + + + iri + + + nodeShapeBody + +

+

+
shapeClass
+
         ::= 'shapeClass' iri nodeShapeBody
+

+

referenced by: +

+


targetClass:

+ + + + + -> + + + iri + +

+

+
targetClass
+
         ::= '->' iri+
+

+

referenced by: +

+


nodeShapeBody:

+ + + + + { + + + constraint + + } + + +

+

+
nodeShapeBody
+
         ::= '{' constraint* '}'
+

+

referenced by: +

+


constraint:

+ + + + + nodeOr + + + propertyShape + + + shapeRef + + . + + +

+

+
constraint
+
         ::= ( nodeOr+ | propertyShape | shapeRef ) '.'
+

+

referenced by: +

+


nodeOr:

+ + + + + nodeNot + + | + + +

+

+
nodeOr   ::= nodeNot ( '|' nodeNot )*
+

+

referenced by: +

+


nodeNot:

+ + + + + ! + + + nodeValue + +

+

+
nodeNot  ::= '!'? nodeValue
+

+

referenced by: +

+


nodeValue:

+ + + + + nodeParam + + = + + + iriOrLiteral + + + array + +

+

+
nodeValue
+
         ::= nodeParam '=' ( iriOrLiteral | array )
+

+

referenced by: +

+


propertyShape:

+ + + + + path + + + propertyCount + + + propertyOr + +

+

+
propertyShape
+
         ::= path ( propertyCount | propertyOr )*
+

+

referenced by: +

+


propertyOr:

+ + + + + propertyNot + + | + + +

+

+
propertyOr
+
         ::= propertyNot ( '|' propertyNot )*
+

+

referenced by: +

+


propertyNot:

+ + + + + ! + + + propertyAtom + +

+

+
propertyNot
+
         ::= '!'? propertyAtom
+

+

referenced by: +

+


propertyAtom:

+ + + + + propertyType + + + nodeKind + + + shapeRef + + + propertyValue + + + nodeShapeBody + +

+

+
propertyAtom
+
         ::= propertyType
+
           | nodeKind
+
           | shapeRef
+
           | propertyValue
+
           | nodeShapeBody
+

+

referenced by: +

+


propertyCount:

+ + + + + [ + + + propertyMinCount + + .. + + + propertyMaxCount + + ] + + +

+

+
propertyCount
+
         ::= '[' propertyMinCount '..' propertyMaxCount ']'
+

+

referenced by: +

+


propertyMinCount:

+ + + + + INTEGER + +

+

+
propertyMinCount
+
         ::= INTEGER
+

+

referenced by: +

+


propertyMaxCount:

+ + + + + INTEGER + + * + + +

+

+
propertyMaxCount
+
         ::= INTEGER
+
           | '*'
+

+

referenced by: +

+


propertyType:

+ + + + + iri + +

+

+
propertyType
+
         ::= iri
+

+

referenced by: +

+


nodeKind:

+ + + + + BlankNode + + + IRI + + + Literal + + + BlankNodeOrIRI + + + BlankNodeOrLiteral + + + IRIOrLiteral + + +

+

+
nodeKind ::= 'BlankNode'
+
           | 'IRI'
+
           | 'Literal'
+
           | 'BlankNodeOrIRI'
+
           | 'BlankNodeOrLiteral'
+
           | 'IRIOrLiteral'
+

+

referenced by: +

+


shapeRef:

+ + + + + ATPNAME_LN + + + ATPNAME_NS + + @ + + + IRIREF + +

+

+
shapeRef ::= ATPNAME_LN
+
           | ATPNAME_NS
+
           | '@' IRIREF
+

+

referenced by: +

+


propertyValue:

+ + + + + propertyParam + + = + + + iriOrLiteral + + + array + +

+

+
propertyValue
+
         ::= propertyParam '=' ( iriOrLiteral | array )
+

+

referenced by: +

+


nodeParam:

+ + + + + targetNode + + + targetObjectsOf + + + targetSubjectsOf + + + targetClass + + + deactivated + + + severity + + + message + + + class + + + datatype + + + nodeKind + + + minExclusive + + + minInclusive + + + maxExclusive + + + maxInclusive + + + minLength + + + maxLength + + + pattern + + + flags + + + languageIn + + + equals + + + disjoint + + + closed + + + ignoredProperties + + + hasValue + + + in + + +

+

+
nodeParam
+
         ::= 'targetNode'
+
           | 'targetObjectsOf'
+
           | 'targetSubjectsOf'
+
           | 'targetClass'
+
           | 'deactivated'
+
           | 'severity'
+
           | 'message'
+
           | 'class'
+
           | 'datatype'
+
           | 'nodeKind'
+
           | 'minExclusive'
+
           | 'minInclusive'
+
           | 'maxExclusive'
+
           | 'maxInclusive'
+
           | 'minLength'
+
           | 'maxLength'
+
           | 'pattern'
+
           | 'flags'
+
           | 'languageIn'
+
           | 'equals'
+
           | 'disjoint'
+
           | 'closed'
+
           | 'ignoredProperties'
+
           | 'hasValue'
+
           | 'in'
+

+

referenced by: +

+


propertyParam:

+ + + + + deactivated + + + severity + + + message + + + class + + + datatype + + + nodeKind + + + minExclusive + + + minInclusive + + + maxExclusive + + + maxInclusive + + + minLength + + + maxLength + + + pattern + + + flags + + + languageIn + + + uniqueLang + + + equals + + + disjoint + + + lessThan + + + lessThanOrEquals + + + qualifiedValueShape + + + qualifiedMinCount + + + qualifiedMaxCount + + + qualifiedValueShapesDisjoint + + + closed + + + ignoredProperties + + + hasValue + + + in + + + group + + + order + + + name + + + description + + + defaultValue + + +

+

+
propertyParam
+
         ::= 'deactivated'
+
           | 'severity'
+
           | 'message'
+
           | 'class'
+
           | 'datatype'
+
           | 'nodeKind'
+
           | 'minExclusive'
+
           | 'minInclusive'
+
           | 'maxExclusive'
+
           | 'maxInclusive'
+
           | 'minLength'
+
           | 'maxLength'
+
           | 'pattern'
+
           | 'flags'
+
           | 'languageIn'
+
           | 'uniqueLang'
+
           | 'equals'
+
           | 'disjoint'
+
           | 'lessThan'
+
           | 'lessThanOrEquals'
+
           | 'qualifiedValueShape'
+
           | 'qualifiedMinCount'
+
           | 'qualifiedMaxCount'
+
           | 'qualifiedValueShapesDisjoint'
+
           | 'closed'
+
           | 'ignoredProperties'
+
           | 'hasValue'
+
           | 'in'
+
           | 'group'
+
           | 'order'
+
           | 'name'
+
           | 'description'
+
           | 'defaultValue'
+

+

referenced by: +

+


PathUnit:

+ + + + + ByteOrderMark + + + path + + + EOF + +

+

+

+

no references


path:

+ + + + + pathAlternative + +

+

+
path     ::= pathAlternative
+

+

referenced by: +

+


pathAlternative:

+ + + + + pathSequence + + | + + +

+

+
pathAlternative
+
         ::= pathSequence ( '|' pathSequence )*
+

+

referenced by: +

+


pathSequence:

+ + + + + pathEltOrInverse + + / + + +

+

+
pathSequence
+
         ::= pathEltOrInverse ( '/' pathEltOrInverse )*
+

+

referenced by: +

+


pathElt:

+ + + + + pathPrimary + + + pathMod + +

+

+

+

referenced by: +

+


pathEltOrInverse:

+ + + + + ^ + + + pathElt + +

+

+
pathEltOrInverse
+
         ::= '^'? pathElt
+

+

referenced by: +

+


pathMod:

+ + + + + ? + + + * + + + + + + +

+

+
pathMod  ::= '?'
+
           | '*'
+
           | '+'
+

+

referenced by: +

+


pathPrimary:

+ + + + + iri + + ( + + + path + + ) + + +

+

+
pathPrimary
+
         ::= iri
+
           | '(' path ')'
+

+

referenced by: +

+


array:

+ + + + + [ + + + iriOrLiteral + + ] + + +

+

+
array    ::= '[' iriOrLiteral* ']'
+

+

referenced by: +

+


iriOrLiteral:

+ + + + + iri + + + literal + +

+

+
iriOrLiteral
+
         ::= iri
+
           | literal
+

+

referenced by: +

+


literal:

+ + + + + rdfLiteral + + + numericLiteral + + + booleanLiteral + +

+

+
literal  ::= rdfLiteral
+
           | numericLiteral
+
           | booleanLiteral
+

+

referenced by: +

+


booleanLiteral:

+ + + + + true + + + false + + +

+

+
booleanLiteral
+
         ::= 'true'
+
           | 'false'
+

+

referenced by: +

+


numericLiteral:

+ + + + + INTEGER + + + DECIMAL + + + DOUBLE + +

+

+
numericLiteral
+
         ::= INTEGER
+
           | DECIMAL
+
           | DOUBLE
+

+

referenced by: +

+


rdfLiteral:

+ + + + + string + + + LANGTAG + + ^^ + + + datatype + +

+

+
rdfLiteral
+
         ::= string ( LANGTAG | '^^' datatype )?
+

+

referenced by: +

+


datatype:

+ + + + + iri + +

+

+
datatype ::= iri
+

+

referenced by: +

+


string:

+ + + + + STRING_LITERAL1 + + + STRING_LITERAL2 + + + STRING_LITERAL_LONG1 + + + STRING_LITERAL_LONG2 + +

+

+
string   ::= STRING_LITERAL1
+
           | STRING_LITERAL2
+
           | STRING_LITERAL_LONG1
+
           | STRING_LITERAL_LONG2
+

+

referenced by: +

+


iri:

+ + + + + IRIREF + + + PrefixedName + +

+

+
iri      ::= IRIREF
+
           | PrefixedName
+

+

referenced by: +

+


PrefixedName:

+ + + + + PNAME_LN + + + PNAME_NS + +

+

+
PrefixedName
+
         ::= PNAME_LN
+
           | PNAME_NS
+

+

referenced by: +

+


IRIREF:

+ + + + + IRIref + +

+

+
IRIREF   ::= IRIref
+

+

referenced by: +

+


SINGLE_LINE_COMMENT:

+ + + + + # + + + [^#xA#xD] + + + [#xD] + + + [#xA] + + +

+

+
SINGLE_LINE_COMMENT
+
         ::= '#' [^#xA#xD]* #xD? #xA?
+

+

no references


BOM:

+ + + + + [#xFEFF] + + +

+

+
BOM      ::= #xFEFF
+

+

referenced by: +

+


HEX:

+ + + + + [0-9] + + + [A-F] + + + [a-f] + + +

+

+
HEX      ::= [0-9A-Fa-f]
+

+

referenced by: +

+


IRIref:

+ + + + + < + + + [^><"{}^\|`#x0-#x20] + + + UCHAR + + > + + +

+

+
IRIref   ::= '<' ( [^><"{}^\|`#x0-#x20] | UCHAR )* '>'
+

+

referenced by: +

+


PNAME_NS:

+ + + + + PN_PREFIX + + : + + +

+

+
PNAME_NS ::= PN_PREFIX? ':'
+

+

referenced by: +

+


PNAME_LN:

+ + + + + PNAME_NS + + + PN_LOCAL + +

+

+

+

referenced by: +

+


ATPNAME_NS:

+ + + + + @ + + + PNAME_NS + +

+

+
ATPNAME_NS
+
         ::= '@' PNAME_NS
+

+

referenced by: +

+


ATPNAME_LN:

+ + + + + @ + + + PNAME_LN + +

+

+
ATPNAME_LN
+
         ::= '@' PNAME_LN
+

+

referenced by: +

+


ECHAR:

+ + + + + \ + + + t + + + b + + + n + + + r + + + f + + + \ + + + " + + + ' + + +

+

+
ECHAR    ::= '\' ( 't' | 'b' | 'n' | 'r' | 'f' | '\' | '"' | "'" )
+

+

referenced by: +

+


UCHAR:

+ + + + + UCHAR4 + + + UCHAR8 + +

+

+
UCHAR    ::= UCHAR4
+
           | UCHAR8
+

+

referenced by: +

+


UCHAR4:

+ + + + + \ + + + u + + + HEX + + + HEX + + + HEX + + + HEX + +

+

+
UCHAR4   ::= '\' 'u' HEX HEX HEX HEX
+

+

referenced by: +

+


UCHAR8:

+ + + + + \ + + + U + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + +

+

+
UCHAR8   ::= '\' 'U' HEX HEX HEX HEX HEX HEX HEX HEX
+

+

referenced by: +

+


STRING_LITERAL1:

+ + + + + ' + + + [^'\#xA#xD] + + + ECHAR + + + UCHAR + + ' + + +

+

+
STRING_LITERAL1
+
         ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'"
+

+

referenced by: +

+


STRING_LITERAL2:

+ + + + + " + + + [^"\#xA#xD] + + + ECHAR + + + UCHAR + + " + + +

+

+
STRING_LITERAL2
+
         ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"'
+

+

referenced by: +

+


STRING_LITERAL_LONG1:

+ + + + + ''' + + + ' + + + '' + + + [^'\] + + + ECHAR + + + UCHAR + + ''' + + +

+

+
STRING_LITERAL_LONG1
+
         ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
+

+

referenced by: +

+


STRING_LITERAL_LONG2:

+ + + + + """ + + + " + + + "" + + + [^"\] + + + ECHAR + + + UCHAR + + """ + + +

+

+
STRING_LITERAL_LONG2
+
         ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
+

+

referenced by: +

+


DIGITS:

+ + + + + [0-9] + + +

+

+
DIGITS   ::= [0-9]+
+

+

referenced by: +

+


INTEGER:

+ + + + + + + + + - + + + DIGITS + +

+

+
INTEGER  ::= ( '+' | '-' )? DIGITS
+

+

referenced by: +

+


DECIMAL:

+ + + + + + + + + - + + + DIGITS + + . + + + DIGITS + +

+

+
DECIMAL  ::= ( '+' | '-' )? DIGITS? '.' DIGITS
+

+

referenced by: +

+


DOUBLE:

+ + + + + + + + + - + + + [0-9] + + + . + + + [0-9] + + + . + + + [0-9] + + + EXPONENT + +

+

+
DOUBLE   ::= ( '+' | '-' )? ( [0-9]+ ( '.' [0-9]* )? | '.' [0-9]+ ) EXPONENT
+

+

referenced by: +

+


EXPONENT:

+ + + + + e + + + E + + + + + + + [#x2D] + + + [0-9] + + +

+

+
EXPONENT ::= [eE] [+#x2D]? [0-9]+
+

+

referenced by: +

+


LANGTAG:

+ + + + + @ + + + A2Z + + - + + + A2ZN + +

+

+
LANGTAG  ::= '@' A2Z+ ( '-' A2ZN+ )*
+

+

referenced by: +

+


A2Z:

+ + + + + [a-z] + + + [A-Z] + + +

+

+
A2Z      ::= [a-zA-Z]
+

+

referenced by: +

+


A2ZN:

+ + + + + [a-z] + + + [A-Z] + + + [0-9] + + +

+

+
A2ZN     ::= [a-zA-Z0-9]
+

+

referenced by: +

+


SURROGATE_PAIR:

+ + + + + [#xD800-#xDBFF] + + + [#xDC00-#xDFFF] + + +

+

+
SURROGATE_PAIR
+
         ::= [#xD800-#xDBFF] [#xDC00-#xDFFF]
+

+

referenced by: +

+


PN_CHARS_BASE:

+ + + + + [A-Z] + + + [a-z] + + + [#xC0-#xD6] + + + [#xD8-#xF6] + + + [#xF8-#x2FF] + + + [#x370-#x37D] + + + [#x37F-#x1FFF] + + + [#x200C-#x200D] + + + [#x2070-#x218F] + + + [#x2C00-#x2FEF] + + + [#x3001-#xD7FF] + + + [#xF900-#xFFFD] + + + SURROGATE_PAIR + +

+

+
PN_CHARS_BASE
+
         ::= [A-Za-z#xC0-#xD6#xD8-#xF6#xF8-#x2FF#x370-#x37D#x37F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFFFD]
+
           | SURROGATE_PAIR
+

+

referenced by: +

+


PN_CHARS_U:

+ + + + + PN_CHARS_BASE + + _ + + +

+

+
PN_CHARS_U
+
         ::= PN_CHARS_BASE
+
           | '_'
+

+

referenced by: +

+


PN_CHARS:

+ + + + + PN_CHARS_U + + - + + + [0-9] + + + [#xB7] + + + [#x300-#x36F] + + + [#x203F-#x2040] + + +

+

+
PN_CHARS ::= PN_CHARS_U
+
           | [-0-9#xB7#x300-#x36F#x203F-#x2040]
+

+

referenced by: +

+


PN_PREFIX:

+ + + + + PN_CHARS_BASE + + + PN_CHARS + + . + + + PN_CHARS + +

+

+
PN_PREFIX
+
         ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
+

+

referenced by: +

+


PN_LOCAL:

+ + + + + PN_CHARS_U + + : + + + [0-9] + + + PLX + + + PN_CHARS + + . + + + : + + + PLX + + + PN_CHARS + + : + + + PLX + +

+

+
PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
+

+

referenced by: +

+


VARNAME:

+ + + + + PN_CHARS_U + + [0-9] + + + PN_CHARS_U + + [0-9] + + + [#xB7] + + + [#x300-#x36F] + + + [#x203F-#x2040] + + +

+

+
VARNAME  ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9#xB7#x300-#x36F#x203F-#x2040] )*
+

+

no references


PN_LOCAL_ESC:

+ + + + + \ + + + _ + + + ~ + + + . + + + - + + + ! + + + $ + + + & + + + ' + + + ( + + + ) + + + * + + + + + + + , + + + ; + + + = + + + / + + + ? + + + # + + + @ + + + % + + +

+

+
PN_LOCAL_ESC
+
         ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' + | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+

+

referenced by: +

+


PLX:

+ + + + + PERCENT + + + PN_LOCAL_ESC + +

+

+
PLX      ::= PERCENT
+
           | PN_LOCAL_ESC
+

+

referenced by: +

+


PERCENT:

+ + + + + % + + + HEX + + + HEX + +

+

+
PERCENT  ::= '%' HEX HEX
+

+

referenced by: +

+


UNKNOWN:

+ + + + + [^ #x9#xA#xD#xC] + + +

+

+
UNKNOWN  ::= [^ #x9#xA#xD#xC]+
+

+

no references


EOF:

+ + + + + $ + + +

+

+
EOF      ::= $
+

+

referenced by: +

+



+

+ + + + + + +
  + ... generated by RR - Railroad Diagram Generator + + + + + + + R + R +
+

+ + \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-JavaCC.jj b/shacl-compact-syntax/grammar/shaclc-JavaCC.jj new file mode 100644 index 0000000..6d76506 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-JavaCC.jj @@ -0,0 +1,652 @@ +/* + * 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. + */ + +options +{ + // \ u processed in the input stream +// JAVA_UNICODE_ESCAPE = true ; +// UNICODE_INPUT = false ; + + // \ u processed after parsing. + // strings, prefix names, IRIs + JAVA_UNICODE_ESCAPE = false ; + UNICODE_INPUT = true ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + +PARSER_BEGIN(ShaclCompactParserJJ) +/* + * 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.jena.shacl.compact.reader.parser; + +import java.util.List; +import java.util.ArrayList; +import org.apache.jena.graph.*; +import org.apache.jena.sparql.path.*; +import org.apache.jena.shacl.compact.reader.*; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + +public class ShaclCompactParserJJ extends ShaclCompactParser +{} +PARSER_END(ShaclCompactParserJJ) + +void Unit(): { } +{ + ByteOrderMark() + shaclDoc() + +} + +void ByteOrderMark() : {} +{ + ()? +} + +void shaclDoc() : {} +{ + (directive())* + (nodeShape()|shapeClass())* +} + +void directive() : {} +{ + ( baseDecl() | prefixDecl() | importDecl() ) +} + +void baseDecl() : { String iri ; } +{ + iri = IRIREF() + { rBase(iri) ; } +} + +void prefixDecl() : { Token t ; String iri ; } +{ + t = iri = IRIREF() + { String s = canonicalPrefix(t.image, t.beginLine, t.beginColumn) ; + rPrefix(s, iri); + } +} + +void importDecl() : { String iri ; } +{ + iri = iri() + { rImports(iri); } +} + +void nodeShape() : { String iri; } +{ + { startNodeShape(); } + iri = iri() + { rNodeShape(iri); } + (targetClass())? nodeShapeBody() + { finishNodeShape(); } +} + +void shapeClass() : { String iri; } +{ + { startShapeClass(); } + iri = iri() + { rShapeClass(iri); } + nodeShapeBody() + { finishShapeClass(); } +} + +void targetClass() : { String iri; } +{ + "->" (iri = iri() { rTargetClass(iri); } )+ +} + +void nodeShapeBody() : {} +{ + { startNodeShapeBody() ; } + (constraint())* + { finishNodeShapeBody() ; } +} + +void constraint() : { } +{ + { startConstraint(); } + ( (nodeOr())+ | propertyShape() +// + | shapeRef(false) +// + ) + { finishConstraint() ; } + +} + +void nodeOr() : { } +{ + { startNodeOr(); } + { rNodeOr_pre(); } nodeNot() { rNodeOr_post(); } + ( + + { rNodeOr_pre(); } nodeNot() { rNodeOr_post(); } + )* + { finishNodeOr(); } +} + +void nodeNot() : { boolean b = false; } +{ + { startNodeNot(); } + ( negation() { b = true; } )? + { beginNodeNot(b); } + nodeValue() + { finishNodeNot(b); } +} + +void negation():{} +{ + +} + +void nodeValue() : { String s; Node n; List x; } +{ + s = nodeParam() + + //value = iriOrLiteralOrArray() + ( + n = iriOrLiteral() { rNodeValue(s, n); } + | + x = array() { rNodeValue(s, x); } + ) +} + +void propertyShape() : { Path p ; } +{ + { startPropertyShape(); } + p = path() + { rPropertyShape(p); } + ( propertyCount() | propertyOr() )* + { finishPropertyShape(); } +} + +void propertyOr() : { } +{ + { startPropertyOr(); } + + { rPropertyOr_pre(); } + propertyNot() + { rPropertyOr_post(); } + + ( + { rPropertyOr_pre(); } propertyNot() { rPropertyOr_post(); } + )* + { finishPropertyOr(); } +} + +void propertyNot() : { boolean b = false; } +{ + { startPropertyNot(); } + (negation() { b = true; } )? + { beginPropertyNot(b); } + propertyAtom() + { finishPropertyNot(b); } +} + +void propertyAtom() : { } +{ + // Work on currentPropertyShape() + propertyType() | nodeKind() | shapeRef(true) | propertyValue() | + ( { startNestedPropertyAtom(); } nodeShapeBody() { finishNestedPropertyAtom(); }) +} + +void propertyCount() : { String s1, s2; } +{ + s1 = propertyMinCount() ".." s2 = propertyMaxCount() + { rPropertyCount(s1, s2); } +} + +String propertyMinCount() : { Token t; } { t = { return t.image; } } +String propertyMaxCount() : { Token t; } { ( t = | t = ) { return t.image; } } + +void propertyType() : { String iriStr; } +{ + iriStr = iri() + { rPropertyType(iriStr); } +} + +void nodeKind() : { Token t; } +{ + ( + t = "BlankNode" | + t = "IRI" | + t = "Literal" | + t = "BlankNodeOrIRI" | + t = "BlankNodeOrLiteral" | + t = "IRIOrLiteral" + ) + { rNodeKind(t.image); } +} + +void shapeRef(boolean inPropertyShape) : { Token t; String iriStr; } +{ + // consistent WS handling.? + ( t = + { iriStr = resolvePName(t.image.substring(1), t.beginLine, t.beginColumn) ; } + | t = + { iriStr = resolvePName(t.image.substring(1), t.beginLine, t.beginColumn) ; } + | iriStr= IRIREF() + ) + { rShapeRef(inPropertyShape, iriStr); } +} + +void propertyValue() : { String s; Node n; List x; } +{ + s = propertyParam() + + //value = iriOrLiteralOrArray() + ( + n = iriOrLiteral() { rParamValue(s, n); } + | + x = array() { rParamValue(s, x); } + ) +} + +// Assemble items to build with from hereon down. +// Return Java objects. + +String nodeParam() : { Token t ;} +{ + ( + t = "targetNode" | t = "targetObjectsOf" | t = "targetSubjectsOf" | +// + // Extension for symmetry! + t = "targetClass" | +// + t = "deactivated" | t = "severity" | t = "message" | + t = "class" | t = "datatype" | t = "nodeKind" | + t = "minExclusive" | t = "minInclusive" | t = "maxExclusive" | t = "maxInclusive" | + t = "minLength" | t = "maxLength" | t = "pattern" | t = "flags" | t = "languageIn" | + t = "equals" | t = "disjoint" | + t = "closed" | t = "ignoredProperties" | t = "hasValue" | t = "in" + ) + { return t.image ; } +} + +String propertyParam() : { Token t; } +{ + ( + t = "deactivated" | t = "severity" | t = "message" | + t = "class" | t = "datatype" | t = "nodeKind" | + t = "minExclusive" | t = "minInclusive" | t = "maxExclusive" | t = "maxInclusive" | + t = "minLength" | t = "maxLength" | t = "pattern" | t = "flags" | t = "languageIn" | t = "uniqueLang" | + t = "equals" | t = "disjoint" | t = "lessThan" | t = "lessThanOrEquals" | + t = "qualifiedValueShape" | t = "qualifiedMinCount" | t = "qualifiedMaxCount" | t = "qualifiedValueShapesDisjoint" | + t = "closed" | t = "ignoredProperties" | t = "hasValue" | t = "in" +// + | t = "group" | t = "order" + | t = "name" | t = "description" + | t = "defaultValue" +// + ) + { return t.image; } +} + +// Paths - subset of SPARQL Paths - no negation, no path property sets. + +Path PathUnit() : { Path p ; } +{ + ByteOrderMark() + p = path() + + { return p ; } +} + +// Weakest outermost +Path path() : { Path p ; } +{ + p = pathAlternative() { return p ; } +} + +Path pathAlternative() : { Path p1 , p2 ; } +{ + p1 = pathSequence() + ( + p2 = pathSequence() + { p1 = PathFactory.pathAlt(p1, p2) ; } + )* + { return p1 ; } +} + +Path pathSequence() : { Path p1 , p2 ; } +{ + p1 = pathEltOrInverse() + ( p2 = pathEltOrInverse() + { p1 = PathFactory.pathSeq(p1, p2) ; } + )* + { return p1; } +} + +// Path unit element, no inverse +Path pathElt() : { String str ; Node n ; Path p ; } +{ + p = pathPrimary() + ( p = pathMod(p) )? + { return p ; } +} + +// Path unit element, including inverse. +Path pathEltOrInverse() : { String str ; Node n ; Path p ; } +{ + ( p = pathElt() + | + p = pathElt() + { p = PathFactory.pathInverse(p) ; } + ) + { return p ; } +} + +Path pathMod(Path p) : { long i1 ; long i2 ; } +{ + ( { return PathFactory.pathZeroOrOne(p) ; } + | { return PathFactory.pathZeroOrMore1(p) ; } + | { return PathFactory.pathOneOrMore1(p) ; } + ) +} + +Path pathPrimary() : { String str ; Path p ; Node n ; } +{ + ( + str = iri() + { n = createURI(str, token.beginLine, token.beginColumn) ; p = PathFactory.pathLink(n) ; } + | p = path() + ) + { return p ; } +} + +// To preserve types, use ( iriOrLiteral() | array() ) directly +// void iriOrLiteralOrArray() : {} +// { +// ( +// { Node n = null; } +// n = iriOrLiteral() +// { iriOrLiteralOrArray(n); } +// | +// { List x = null; } +// x = array() +// { iriOrLiteralOrArray(x); } +// ) +// } + +List array() : { List x = new ArrayList(); Node n = null; } +{ + + ( n = iriOrLiteral() + { x.add(n); } + )* + + { return x; } +} + +// Term generation + +Node iriOrLiteral() : { Node n; String uriStr; } +{ + ( + uriStr = iri() { n = createURI(uriStr, token.beginLine, token.beginColumn); } + | n = literal() + ) + { return n ; } +} + +Node literal() : { Node n ; } +{ + ( n = rdfLiteral() | n = numericLiteral() | n = booleanLiteral() ) + { return n; } +} + +Node booleanLiteral() : {} +{ + { return XSD_TRUE ; } + | + { return XSD_FALSE ; } +} + +Node numericLiteral() : { Token t ; } +{ + t = { return createLiteralInteger(t.image, token.beginLine, token.beginColumn) ; } + | t = { return createLiteralDecimal(t.image, token.beginLine, token.beginColumn) ; } + | t = { return createLiteralDouble(t.image, token.beginLine, token.beginColumn) ; } +} + +Node rdfLiteral() : { Token t ; Token tLang; String lex = null ; } +{ + lex = string() { t = token; } + // Optional lang tag and datatype. + { String lang = null ; String dt = null ; } + ( + ( tLang = { lang = stripChars(tLang.image, 1) ; } ) + | + ( "^^" dt = datatype() ) + )? + { return createLiteral(lex, lang, dt, t.beginLine, t.beginColumn) ; } +} + +String datatype() : { String s; } +{ + s = iri() + { return s; } +} + +String string() : { Token t ; String lex ; } +{ + ( t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + ) + { + lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + return lex ; + } +} + +String iri() : { String iri = null; } +{ + iri = IRIREF() { return iri ; } +| + iri = PrefixedName() { return iri ; } +} + +String PrefixedName() : { Token t ; } +{ + ( t = + { return resolvePName(t.image, t.beginLine, t.beginColumn) ; } + | + t = + { return resolvePName(t.image, t.beginLine, t.beginColumn) ; } + ) +} + +String IRIREF() : { Token t ; } +{ + t = + { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } +} + + +SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + +SPECIAL_TOKEN : +{ } + +TOKEN: { + +} + +TOKEN [IGNORE_CASE] : +{ + // Keywords + +| +| + +| +| +| +| +} + +TOKEN: +{ + <#HEX : ["0"-"9"] | ["A"-"F"] | ["a"-"f"] > +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + +| ","<", "\"", "{", "}", "^", "\\", "|", "`","\u0000"-"\u0020"] + | + )* + ">" > + +| )? ":" > +| > + +// Better shapeRef - consistent WS. +| > +| > + +| <#QUOTE_3D: "\"\"\""> +| <#QUOTE_3S: "'''"> + +| < #ECHAR: "\\" ( "t"|"b"|"n"|"r"|"f"|"\\"|"\""|"'") > +| < #UCHAR: | > +| < #UCHAR4: "\\" "u" > +| < #UCHAR8: "\\" "U" > + +| | )* "'" > +| | )* "\"" > +| + ( ("'" | "''")? (~["'","\\"] | | ))* + > +| + ( ("\"" | "\"\"")? (~["\"","\\"] | | ))* + > + +| <#DIGITS: (["0"-"9"])+> +| |)? > +| |)? ()? "." > +| |)? + ( (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) > + +| <#EXPONENT : ["e","E"] (["+","-"])? (["0"-"9"])+ > + +| ()+("-" ()+)* > +| <#A2Z: ["a"-"z","A"-"Z"]> +| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> + +| <#SURROGATE_PAIR: ["\uD800"-"\uDBFF"] ["\uDC00"-"\uDFFF"] > + +| <#PN_CHARS_BASE: + ["A"-"Z"] | ["a"-"z"] | + ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | + ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | + ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | + ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] + // [#x10000-#xEFFFF] + | + > +| + // With underscore + <#PN_CHARS_U: | "_" > +| + <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > +| + // No leading "_", no trailing ".", can have dot inside prefix name. + <#PN_PREFIX: ((|".")* )? > +| + <#PN_LOCAL: ( | ":" | ["0"-"9"] | ) + ( ( | "." |":" | )* + ( | ":" | ) )? > +| + <#VARNAME: ( | ["0"-"9"] ) + ( | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] )* > +| + < #PN_LOCAL_ESC: "\\" + ( "_" | + "~" | "." | "-" | "!" | "$" | "&" | "'" | + "(" | ")" | "*" | "+" | "," | ";" | "=" | + "/" | "?" | "#" | "@" | "%" ) > +| + <#PLX: | > +| + <#PERCENT : "%" > +} + +// Catch-all tokens. Must be last. +// Any non-whitespace. Causes a parser exception, rather than a +// token manager error (which hides the line numbers). +TOKEN: +{ + <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > +} + + +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ diff --git a/shacl-compact-syntax/grammar/shaclc-Jison.ebnf b/shacl-compact-syntax/grammar/shaclc-Jison.ebnf new file mode 100644 index 0000000..0d7e7a7 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-Jison.ebnf @@ -0,0 +1,116 @@ +/* converted on Thu Apr 25, 2024, 16:28 (UTC) by jison-to-w3c v0.67 which is Copyright (c) 2011-2024 by Gunther Rademacher */ + +shaclDoc ::= directive* (nodeShape | shapeClass)* ttlStatement* EOF +directive + ::= baseDecl + | importsDecl + | prefixDecl +baseDecl ::= KW_BASE IRIREF +importsDecl + ::= KW_IMPORTS IRIREF +prefixDecl + ::= KW_PREFIX PNAME_NS IRIREF +nodeShapeIri + ::= iri +nodeShape + ::= KW_SHAPE nodeShapeIri targetClass? turtleAnnotation? nodeShapeBody +shapeClass + ::= KW_SHAPE_CLASS nodeShapeIri turtleAnnotation? nodeShapeBody +turtleAnnotation + ::= ';' turtleAnnotation2 +turtleAnnotation2 + ::= predicate turtleAnnotation? +predicate + ::= iri objectList +objectList + ::= object objectTail* +object ::= iriOrLiteral + | blankNodeSection + | list +list ::= '(' object* ')' +objectTail + ::= ',' object +blankNodeSection + ::= '[' turtleAnnotation2 ']' +pcSection + ::= '%' turtleAnnotation2 '%' +iriHead ::= iri +ttlStatement + ::= iriHead turtleAnnotation2 '.' + +nodeShapeBody + ::= '{' constraint* '}' +targetClass + ::= '->' iri+ + +constraint + ::= (nodeOrEmit+ | path ( propertyCount | propertyNot propertyOrComponent* )*) pcSection? '.' +orNotComponent + ::= '|' nodeNot +nodeOrEmit + ::= nodeOr +nodeOr ::= nodeNot orNotComponent* +nodeNot ::= '!'? nodeValue +targetOrParam + ::= TARGET + | PARAM +nodeValue + ::= targetOrParam '=' iriOrLiteralOrArray +propertyOrComponent + ::= '|' propertyNot +propertyNot + ::= '!'? propertyAtom +propertyAtom + ::= iri + | NODEKIND + | shapeRef + | PARAM '=' iriOrLiteralOrArray + | nodeShapeBody +propertyCount + ::= '[' propertyMinCount '..' propertyMaxCount ']' +propertyMinCount + ::= INTEGER +propertyMaxCount + ::= INTEGER + | '*' +shapeRef ::= ATPNAME_LN + | ATPNAME_NS + | '@' IRIREF +path ::= pathAlternative +additionalAlternative + ::= '|' pathSequence +pathAlternative + ::= pathSequence additionalAlternative* +additionalSequence + ::= '/' pathEltOrInverse +pathSequence + ::= pathEltOrInverse additionalSequence* +pathElt ::= pathPrimary pathMod? +pathEltOrInverse + ::= '^'? pathElt +pathMod ::= '?' + | '*' + | '+' +pathPrimary + ::= iri + | '(' pathAlternative ')' +iriOrLiteralOrArray + ::= iriOrLiteral + | '[' iriOrLiteral* ']' +iriOrLiteral + ::= iri + | literal +iri ::= IRIREF + | PNAME_LN + | PNAME_NS + | 'a' +literal ::= string ( LANGTAG | '^^' iri )? + | INTEGER + | DECIMAL + | DOUBLE + | KW_TRUE + | KW_FALSE +string ::= STRING_LITERAL1 + | STRING_LITERAL2 + | STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 diff --git a/shacl-compact-syntax/grammar/shaclc-Jison.html b/shacl-compact-syntax/grammar/shaclc-Jison.html new file mode 100644 index 0000000..eef9511 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-Jison.html @@ -0,0 +1,588 @@ + + + + + + + + +

shaclDoc:

+

+

+

no references


directive:

+

+ +
         ::= baseDecl
+
           | importsDecl
+
           | prefixDecl
+

+

referenced by: + +

+


baseDecl:

+

+

+

referenced by: + +

+


importsDecl:

+

+ +
         ::= KW_IMPORTSIRIREF
+

+

referenced by: + +

+


prefixDecl:

+

+ +
         ::= KW_PREFIXPNAME_NSIRIREF
+

+

referenced by: + +

+


nodeShapeIri:

+

+ +
         ::= iri
+

+

referenced by: + +

+


nodeShape:

+

+

+

referenced by: + +

+


shapeClass:

+

+

+

referenced by: + +

+


turtleAnnotation:

+

+ +
         ::= ';' turtleAnnotation2
+

+

referenced by: + +

+


turtleAnnotation2:

+

+ +
         ::= predicateturtleAnnotation?
+

+

referenced by: + +

+


predicate:

+

+ +
         ::= iriobjectList
+

+

referenced by: + +

+


objectList:

+

+ +
         ::= objectobjectTail*
+

+

referenced by: + +

+


object:

+

+ +
           | blankNodeSection
+
           | list
+

+

referenced by: + +

+


list:

+

+
list     ::= '(' object* ')'
+

+

referenced by: + +

+


objectTail:

+

+ +
         ::= ',' object
+

+

referenced by: + +

+


blankNodeSection:

+

+ +
         ::= '[' turtleAnnotation2 ']'
+

+

referenced by: + +

+


pcSection:

+

+ +
         ::= '%' turtleAnnotation2 '%'
+

+

referenced by: + +

+


iriHead:

+

+
iriHead  ::= iri
+

+

referenced by: + +

+


ttlStatement:

+

+ +
         ::= iriHeadturtleAnnotation2 '.'
+

+

referenced by: + +

+


nodeShapeBody:

+

+ +
         ::= '{' constraint* '}'
+

+

referenced by: + +

+


targetClass:

+

+ +
         ::= '->' iri+
+

+

referenced by: + +

+


constraint:

+

+ +
         ::= ( nodeOrEmit+ | path ( propertyCount | propertyNotpropertyOrComponent* )* ) pcSection? '.'
+

+

referenced by: + +

+


orNotComponent:

+

+ +
         ::= '|' nodeNot
+

+

referenced by: + +

+


nodeOrEmit:

+

+ +
         ::= nodeOr
+

+

referenced by: + +

+


nodeOr:

+

+

+

referenced by: + +

+


nodeNot:

+

+
nodeNot  ::= '!'? nodeValue
+

+

referenced by: + +

+


targetOrParam:

+

+ +
         ::= TARGET
+
           | PARAM
+

+

referenced by: + +

+


nodeValue:

+

+ +
         ::= targetOrParam '=' iriOrLiteralOrArray
+

+

referenced by: + +

+


propertyOrComponent:

+

+ +
         ::= '|' propertyNot
+

+

referenced by: + +

+


propertyNot:

+

+ +
         ::= '!'? propertyAtom
+

+

referenced by: + +

+


propertyAtom:

+

+ +
         ::= iri
+
           | NODEKIND
+
           | shapeRef
+
           | PARAM '=' iriOrLiteralOrArray
+
           | nodeShapeBody
+

+

referenced by: + +

+


propertyCount:

+

+ +
         ::= '[' propertyMinCount '..' propertyMaxCount ']'
+

+

referenced by: + +

+


propertyMinCount:

+

+ +
         ::= INTEGER
+

+

referenced by: + +

+


propertyMaxCount:

+

+ +
         ::= INTEGER
+
           | '*'
+

+

referenced by: + +

+


shapeRef:

+

+ +
           | ATPNAME_NS
+
           | '@' IRIREF
+

+

referenced by: + +

+


path:

+

+
path     ::= pathAlternative
+

+

referenced by: + +

+


additionalAlternative:

+

+ +
         ::= '|' pathSequence
+

+

referenced by: + +

+


pathAlternative:

+

+

+

referenced by: + +

+


additionalSequence:

+

+ +
         ::= '/' pathEltOrInverse
+

+

referenced by: + +

+


pathSequence:

+

+

+

referenced by: + +

+


pathElt:

+

+

+

referenced by: + +

+


pathEltOrInverse:

+

+ +
         ::= '^'? pathElt
+

+

referenced by: + +

+


pathMod:

+

+
pathMod  ::= '?'
+
           | '*'
+
           | '+'
+

+

referenced by: + +

+


pathPrimary:

+

+ +
         ::= iri
+
           | '(' pathAlternative ')'
+

+

referenced by: + +

+


iriOrLiteralOrArray:

+

+ +
         ::= iriOrLiteral
+
           | '[' iriOrLiteral* ']'
+

+

referenced by: + +

+


iriOrLiteral:

+

+ +
         ::= iri
+
           | literal
+

+

referenced by: + +

+


iri:

+

+
iri      ::= IRIREF
+
           | PNAME_LN
+
           | PNAME_NS
+
           | 'a'
+

+

referenced by: + +

+


literal:

+

+
literal  ::= string ( LANGTAG | '^^' iri )?
+
           | INTEGER
+
           | DECIMAL
+
           | DOUBLE
+
           | KW_TRUE
+
           | KW_FALSE
+

+

referenced by: + +

+


string:

+

+ +
           | STRING_LITERAL2
+
           | STRING_LITERAL_LONG1
+
           | STRING_LITERAL_LONG2
+

+

referenced by: + +

+


+ \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-Jison.jison b/shacl-compact-syntax/grammar/shaclc-Jison.jison new file mode 100644 index 0000000..aa11fe8 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-Jison.jison @@ -0,0 +1,594 @@ +%{ +/* + Grammar specification for a SHACL compact + syntax parser. + Several functions are from +*/ + + // Common namespaces and entities + const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', + RDF_TYPE = RDF + 'type', + RDF_FIRST = RDF + 'first', + RDF_REST = RDF + 'rest', + RDF_NIL = RDF + 'nil', + XSD = 'http://www.w3.org/2001/XMLSchema#', + XSD_INTEGER = XSD + 'integer', + XSD_DECIMAL = XSD + 'decimal', + XSD_DOUBLE = XSD + 'double', + XSD_BOOLEAN = XSD + 'boolean', + SH = 'http://www.w3.org/ns/shacl#', + OWL = 'http://www.w3.org/2002/07/owl#', + RDFS = 'http://www.w3.org/2000/01/rdf-schema#'; + + // TODO: Make sure all SPARQL supported datatypes are here + const datatypes = { + [XSD_INTEGER]: true, + [XSD_DECIMAL]: true, + [XSD + 'float']: true, + [XSD_DOUBLE]: true, + [XSD + 'string']: true, + [XSD_BOOLEAN]: true, + [XSD + 'dateTime']: true, + [XSD + 'nonPositiveInteger']: true, + [XSD + 'negativeInteger']: true, + [XSD + 'long']: true, + [XSD + 'int']: true, + [XSD + 'short']: true, + [XSD + 'byte']: true, + [XSD + 'nonNegativeInteger']: true, + [XSD + 'unsignedLong']: true, + [XSD + 'unsignedShort']: true, + [XSD + 'unsignedByte']: true, + [XSD + 'positiveInteger']: true, + [RDF + 'langString']: true + } + + function addList(elems, ttlList = false) { + let i = 0, l = elems.length; + + // TODO: Double check this behavior and see why it differes from the other l == 0 case + if (ttlList && l === 0) { + return Parser.factory.namedNode(RDF_NIL) + } + + const list = head = blank(); + + if (l === 0) { + // TODO: see if this should be here + emit(head, Parser.factory.namedNode(RDF_REST), Parser.factory.namedNode(RDF_NIL)) + } + + elems.forEach(elem => { + if (elem === undefined) { + throw new Error('b') + } + emit(head, Parser.factory.namedNode(RDF_FIRST), elem) + emit(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)) + }) + + return list; + } + + // TODO: Port over any updates to this from SPARLQL.js + // Resolves an IRI against a base path + function resolveIRI(iri) { + // Strip off possible angular brackets and resolve the IRI + return Parser.n3Parser._resolveIRI(iri[0] === '<' ? iri.substring(1, iri.length - 1) : iri) + } + + function expandPrefix(iri) { + const namePos = iri.indexOf(':'), + prefix = iri.substr(0, namePos), + expansion = Parser.prefixes[prefix]; + + if (!expansion) throw new Error('Unknown prefix: ' + prefix); + + return resolveIRI(expansion + iri.substr(namePos + 1)); + } + + // Converts the string to a number + function toInt(string) { + return parseInt(string, 10); + } + // Creates a literal with the given value and type + function createTypedLiteral(value, type) { + if (type && type.termType !== 'NamedNode'){ + type = Parser.factory.namedNode(type); + } + return Parser.factory.literal(value, type); + } + // Creates a literal with the given value and language + function createLangLiteral(value, lang) { + return Parser.factory.literal(value, lang); + } + // Creates a new blank node + function blank(name) { + if (typeof name === 'string') { // Only use name if a name is given + if (name.startsWith('e_')) return Parser.factory.blankNode(name); + return Parser.factory.blankNode('e_' + name); + } + return Parser.factory.blankNode('g_' + blankId++); + }; + var blankId = 0; + Parser._resetBlanks = function () { blankId = 0; } + // Regular expression and replacement strings to escape strings + var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g, + escapeReplacements = { '\\': '\\', "'": "'", '"': '"', + 't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' }, + fromCharCode = String.fromCharCode; + // Translates escape codes in the string into their textual equivalent + function unescapeString(string, trimLength) { + return Parser.n3Parser._lexer._unescape(string.substring(trimLength, string.length - trimLength)); + } + + function emit(s, p, o) { + if (!s.termType || !p.termType || p.value.includes(',') || !o.termType) { + throw new Error(`boo ${s.value} ${p.value} ${o.value}`) + } + Parser.onQuad(Parser.factory.quad(s, p, o)) + } + + function emitProperty(p, o) { + emit(Parser.currentPropertyNode, Parser.factory.namedNode(SH + p), o) + } + + function chainProperty(name, p, o) { + const b = blank(); + emit(b, Parser.factory.namedNode(SH + p), o); + return [name, b]; + } + + function ensureExtended(input) { + if (!Parser.extended) { + throw new Error('Encountered extended SHACLC syntax; but extended parsing is disabled') + } + return input + } +%} + +%lex + +PASS [ \t\r\n]+ -> skip +COMMENT '#' ~[\r\n]* -> skip + +IRIREF '<' (~[^=<>\"\{\}\|\^`\\\u0000-\u0020] | {UCHAR})* '>' +PNAME_NS {PN_PREFIX}? ':' +PNAME_LN {PNAME_NS} {PN_LOCAL} +ATPNAME_NS '@' {PN_PREFIX}? ':' +ATPNAME_LN '@' {PNAME_NS} {PN_LOCAL} +LANGTAG '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* +INTEGER [+-]?[0-9]+ +DECIMAL [+-]?[0-9]*'.'[0-9]+ +DOUBLE [+-]?([0-9]+ '.' [0-9]* {EXPONENT} | '.'? [0-9]+ {EXPONENT}) +EXPONENT [eE] [+-]? [0-9]+ +// TODO: Refactor these into just STRING_LITERAL ans STRING_LITERAL_LONG with an or +STRING_LITERAL1 "'"(?:(?:[^\u0027\u005C\u000A\u000D])|{ECHAR})*"'" +STRING_LITERAL2 "\""(?:(?:[^\u0022\u005C\u000A\u000D])|{ECHAR})*'"' +STRING_LITERAL_LONG1 "'''"(?:(?:"'"|"''")?(?:[^'\\]|{ECHAR}))*"'''" +STRING_LITERAL_LONG2 "\"\"\""(?:(?:"\""|'""')?(?:[^\"\\]|{ECHAR}))*'"""' +UCHAR '\\u' {HEX} {HEX} {HEX} {HEX} | '\\U' {HEX} {HEX} {HEX} {HEX} {HEX} {HEX} {HEX} {HEX} +ECHAR '\\' [tbnrf\\\"\'] +WS [\u0020\u0009\u000D\u000A] +PN_CHARS_BASE [A-Z] | [a-z] | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u02FF] | [\u0370-\u037D] | [\u037F-\u1FFF] | [\u200C-\u200D] | [\u2070-\u218F] | [\u2C00-\u2FEF] | [\u3001-\uD7FF] | [\uF900-\uFDCF] | [\uFDF0-\uFFFD] +PN_CHARS_U {PN_CHARS_BASE} | '_' +PN_CHARS {PN_CHARS_U} | '-' | [0-9] | [\u00B7] | [\u0300-\u036F] | [\u203F-\u2040] +PN_PREFIX {PN_CHARS_BASE} (({PN_CHARS} | '.')* {PN_CHARS})? +PN_LOCAL ({PN_CHARS_U} | ':' | [0-9] | {PLX}) (({PN_CHARS} | '.' | ':' | {PLX})* ({PN_CHARS} | ':' | {PLX}))? +PLX {PERCENT} | {PN_LOCAL_ESC} +PERCENT '%' {HEX} {HEX} +HEX [0-9] | [A-F] | [a-f] +PN_LOCAL_ESC '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%') + +NODEKIND 'BlankNode' | 'IRI' | 'Literal' | 'BlankNodeOrIRI' | 'BlankNodeOrLiteral' | 'IRIOrLiteral' +TARGET 'targetNode' | 'targetObjectsOf' | 'targetSubjectsOf' +PARAM 'deactivated' | 'severity' | 'message' | 'class' | 'datatype' | 'nodeKind' | 'minExclusive' | 'minInclusive' | 'maxExclusive' | 'maxInclusive' | 'minLength' | 'maxLength' | 'pattern' | 'flags' | 'languageIn' | 'uniqueLang' | 'equals' | 'disjoint' | 'lessThan' | 'lessThanOrEquals' | 'qualifiedValueShape' | 'qualifiedMinCount' | 'qualifiedMaxCount' | 'qualifiedValueShapesDisjoint' | 'closed' | 'ignoredProperties' | 'hasValue' | 'in' + +%options flex case-insensitive + +%% + +\s+|"#"[^\n\r]* /* ignore */ + +"BASE" return 'KW_BASE' +"IMPORTS" return 'KW_IMPORTS' +"PREFIX" return 'KW_PREFIX' + +"shapeClass" return 'KW_SHAPE_CLASS' +"shape" return 'KW_SHAPE' + +'true' return 'KW_TRUE' +'false' return 'KW_FALSE' + +{NODEKIND} return 'NODEKIND' +{TARGET} return 'TARGET' +{PARAM} return 'PARAM' + +{PASS} return 'PASS' +{COMMENT} return 'COMMENT' + +{IRIREF} return 'IRIREF' +{PNAME_NS} return 'PNAME_NS' +{PNAME_LN} return 'PNAME_LN' +{ATPNAME_NS} return 'ATPNAME_NS' +{ATPNAME_LN} return 'ATPNAME_LN' +{LANGTAG} return 'LANGTAG' +{INTEGER} return 'INTEGER' +{DECIMAL} return 'DECIMAL' +{DOUBLE} return 'DOUBLE' +{EXPONENT} return 'EXPONENT' +{STRING_LITERAL1} return 'STRING_LITERAL1' +{STRING_LITERAL2} return 'STRING_LITERAL2' +{STRING_LITERAL_LONG1} return 'STRING_LITERAL_LONG1' +{STRING_LITERAL_LONG2} return 'STRING_LITERAL_LONG2' + +"->" return '->' +".." return '..' + +"}" return '}' +"{" return '{' +"(" return '(' +")" return ')' +"[" return '[' +"]" return ']' + +"?" return '?' +"*" return '*' +"+" return '+' + +"|" return '|' +"^^" return '^^' +"." return '.' +"!" return '!' + +"/" return '/' +"=" return '=' +"@" return '@' +"^" return '^' +";" return ';' +"," return ',' +"%" return '%' +"a" return 'a' + +<> return 'EOF' + +%ebnf + +/lex + +%start shaclDoc + +%% + + +shaclDoc : directiveOrMore nodeShapeOrShapeClassOrMore ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | nodeShapeOrShapeClassOrMore ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | directiveOrMore ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | directiveOrMore nodeShapeOrShapeClassOrMore EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | nodeShapeOrShapeClassOrMore EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | directiveOrMore EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + | EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology')) + ; + +directiveOrMore : directive + | directive directiveOrMore ; + +nodeShapeOrShapeClassOrMore : nodeShapeOrShapeClass + | nodeShapeOrShapeClass nodeShapeOrShapeClassOrMore ; + +nodeShapeOrShapeClass : nodeShape + | shapeClass + ; + +directive : baseDecl | importsDecl | prefixDecl ; + +baseDecl : KW_BASE IRIREF + { + Parser.base = Parser.factory.namedNode($2.slice(1, -1)); + Parser.n3Parser._setBase(Parser.base.value); + } + ; + +importsDecl : KW_IMPORTS IRIREF -> emit(Parser.base, Parser.factory.namedNode(OWL + 'imports'), Parser.factory.namedNode($2.slice(1, -1))) + ; + +prefixDecl : KW_PREFIX PNAME_NS IRIREF -> Parser.prefixes[$2.substr(0, $2.length - 1)] = resolveIRI($3) + ; + +nodeShapeIri : iri + { + Parser.nodeShapeStack = false + emit(Parser.currentNodeShape = $1, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(SH + 'NodeShape')) + } + ; + +nodeShape : KW_SHAPE nodeShapeIri targetClass turtleAnnotation nodeShapeBody + | KW_SHAPE nodeShapeIri turtleAnnotation nodeShapeBody + | KW_SHAPE nodeShapeIri targetClass nodeShapeBody + | KW_SHAPE nodeShapeIri nodeShapeBody + ; + +shapeClass : KW_SHAPE_CLASS nodeShapeIri turtleAnnotation nodeShapeBody -> emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class')) + | KW_SHAPE_CLASS nodeShapeIri nodeShapeBody -> emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class')) + ; + +turtleAnnotation : ';' turtleAnnotation2 -> ensureExtended() + ; + +turtleAnnotation2 : predicate + | predicate turtleAnnotation + ; + +predicate : iri objectList -> $2.forEach(e => emit(Parser.currentNodeShape, $1, e)) + ; + +objectList : object -> [$1] + | object objectTailOrMore -> [$1, ...$2] + ; + +objectTailOrMore : objectTail + | objectTailOrMore objectTail + ; + +object : iriOrLiteral + | blankNodeSection + | list + ; + +objectOrMore : object + | objectOrMore object + ; + +list : '(' ')' -> addList([], true) + | '(' objectOrMore ')' -> addList($2, true) + ; + +objectTail : ',' object -> $2 + ; + +LB : '[' + { + Parser.tempCurrentNodeShape = Parser.currentNodeShape; + $$ = Parser.currentNodeShape = blank(); + } + ; + +RB : ']' + { + Parser.currentNodeShape = Parser.tempCurrentNodeShape; + } + ; + +blankNodeSection : LB turtleAnnotation2 RB -> $1 + ; + +LP : "%" + { + Parser.tempCurrentNodeShape = Parser.currentNodeShape; + Parser.currentNodeShape = Parser.currentPropertyNode; + } + ; + +RP : "%" + { + Parser.currentNodeShape = Parser.tempCurrentNodeShape + } + ; + +pcSection : LP turtleAnnotation2 RP + ; + +iriHead : iri + { + Parser.currentNodeShape = $1 + } + ; + +ttlStatement : iriHead turtleAnnotation2 "." + ; + +ttlSection : ttlStatement + | ttlSection ttlStatement + ; + +startNodeShape : '{' + { + if (!Parser.nodeShapeStack) { + Parser.nodeShapeStack = []; + } else { + Parser.nodeShapeStack.push(Parser.currentNodeShape); + emit( + Parser.currentPropertyNode, + Parser.factory.namedNode(SH + 'node'), + Parser.currentNodeShape = blank(), + ) + } + + $$ = Parser.currentNodeShape; + } + ; + +endNodeShape : '}' + { + if (Parser.nodeShapeStack.length > 0) { + Parser.currentNodeShape = Parser.nodeShapeStack.pop(); + } + } + ; + +constraintOrMore : constraint + | constraintOrMore constraint + ; + +nodeShapeBody : startNodeShape endNodeShape -> $1 + | startNodeShape constraintOrMore endNodeShape -> $1 + ; + +iriOrMore : iri + | iriOrMore iri + ; + +targetClass : '->' iriOrMore -> $2.forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) }) + ; + +nodeOrEmitOrMore : nodeOrEmit + | nodeOrEmitOrMore nodeOrEmit + ; + +nodeOrEmitOrMoreOrPropertyShape : nodeOrEmitOrMore + | propertyShape + ; + +constraint : nodeOrEmitOrMoreOrPropertyShape pcSection '.' + | nodeOrEmitOrMoreOrPropertyShape '.' + ; + +orNotComponent : '|' nodeNot -> $2 + ; + +nodeOrEmit : nodeOr -> emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $1[0]), $1[1]) + ; + +orNotComponentOrMore : orNotComponent + | orNotComponentOrMore orNotComponent + ; + +nodeOr : nodeNot + { + } + | nodeNot orNotComponentOrMore + { + const o = addList([$1, ...$2].map(elem => { + const x = blank(); + emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]); + return x; + })) + + $$ = ['or', o] + } + ; +nodeNot : nodeValue + | negation nodeValue -> chainProperty('not', ...$2) + ; + +targetOrParam : TARGET | PARAM ; + +nodeValue : targetOrParam '=' iriOrLiteralOrArray -> [$1, $3] + ; + +propertyShape : path + | propertyShape propertyCount + | propertyShape propertyOr + ; + +propertyOrComponent : '|' propertyNot -> $2 + ; + +propertyOr : propertyNot + | propertyOr propertyOrComponent + ; + +propertyNot : propertyAtom + | negation propertyAtom -> chainProperty('not', ...$2) + ; + +propertyAtom : iri -> [datatypes[$1.value] ? 'datatype' : 'class', $1] + | NODEKIND -> ['nodeKind', Parser.factory.namedNode(SH + $1)] + | shapeRef -> ['node', Parser.factory.namedNode($1)] + | PARAM '=' iriOrLiteralOrArray -> [$1, $3] + | nodeShapeBody -> undefined //['node', $1] + ; + +propertyCount : '[' propertyMinCount '..' propertyMaxCount ']' + ; + +propertyMinCount : INTEGER -> $1 > 0 && emitProperty('minCount', createTypedLiteral($1, XSD_INTEGER)) + ; + +propertyMaxCount : INTEGER -> emitProperty('maxCount', createTypedLiteral($1, XSD_INTEGER)) + | '*' + ; + +shapeRef : ATPNAME_LN + | ATPNAME_NS + | '@' IRIREF + ; + +negation : '!' ; + +path : pathAlternative + { + emit( + Parser.currentNodeShape, + Parser.factory.namedNode(SH + 'property'), + Parser.currentPropertyNode = blank(), + ) + + emitProperty('path', $1) + } + ; + +additionalAlternative : '|' pathSequence -> $2 + ; + +pathAlternative : pathSequence + | pathAlternative additionalAlternative + ; + +additionalSequence : '/' pathEltOrInverse -> $2 + ; + +pathSequence : pathEltOrInverse + | pathSequence additionalSequence + + ; +pathElt : pathPrimary + | pathPrimary pathMod + ; +pathEltOrInverse : pathElt + | pathInverse pathElt + ; +pathInverse : '^' ; +pathMod : '?' -> 'zeroOrOnePath' + | '*' -> 'zeroOrMorePath' + | '+' -> 'oneOrMorePath' + ; + +pathPrimary : iri + | '(' pathAlternative ')' -> $2 + ; + +iriOrLiteralOrMore : iriOrLiteral + | iriOrLiteralOrMore iriOrLiteral + ; + +iriOrLiteralOrArray : iriOrLiteral + | '[' ']' + | '[' iriOrLiteralOrMore ']' + ; + +iriOrLiteral : iri | literal ; + +iri : IRIREF + | PNAME_LN + | PNAME_NS + | 'a' + ; + +literal + : string -> createTypedLiteral($1) + | string LANGTAG -> createLangLiteral($1, lowercase($2.substr(1))) + | string '^^' iri -> createTypedLiteral($1, $3) + | INTEGER -> createTypedLiteral($1, XSD_INTEGER) + | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL) + | DOUBLE -> createTypedLiteral($1.toLowerCase(), XSD_DOUBLE) + | KW_TRUE -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN) + | KW_FALSE -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN) + ; + +string + : STRING_LITERAL1 + | STRING_LITERAL2 + | STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 + ; diff --git a/shacl-compact-syntax/grammar/shaclc-XText.ebnf b/shacl-compact-syntax/grammar/shaclc-XText.ebnf new file mode 100644 index 0000000..097a7cb --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-XText.ebnf @@ -0,0 +1,766 @@ +/* converted on Fri Mar 22, 2024, 10:24 (UTC+02) by xtext-to-w3c v0.68-SNAPSHOT which is Copyright (c) 2011-2024 by Gunther Rademacher */ + +ShaclDoc ::= 'LIBRARY' IRIREF ( 'VERSION' IRIREF )? Directive* ( NodeShape | ShapeClass | PropertyShape | RuleShape | TargetShape | FunctionShape )* +Directive + ::= BaseDecl + | ImportsDecl + | PrefixDecl +BaseDecl ::= 'BASE' IRIREF +ImportsDecl + ::= 'IMPORTS' IRIREF +PrefixDecl + ::= 'PREFIX' PNAME_NS IRIREF +ShapeClass + ::= 'shapeClass' Iri ( '.' | '{' NodeShapeBody '}' ) +NodeShape + ::= 'shape' Iri Target* ( '.' | '{' NodeShapeBody '}' ) +PropertyShape + ::= 'property' Iri ( '.' | '{' PropertyShapeBody '}' ) +RuleShape + ::= 'rule' Iri ( '.' | '{' RuleBody '}' ) +TargetShape + ::= 'target' Iri ( '.' | TargetDeclaration '{' TargetBody '}' ) +FunctionShape + ::= 'function' Iri ( '.' | FunctionDeclaration '{' FunctionBody '}' ) +Target ::= TargetClasses + | TargetNodes + | TargetTargets + | TargetSubjectsOf + | TargetObjectsOf + | TargetSelect +TargetClasses + ::= '->' Iri ( ',' Iri )* +TargetSubjectsOf + ::= '*->' Iri ( ',' Iri )* +TargetObjectsOf + ::= '->*' Iri ( ',' Iri )* +TargetSelect + ::= '->' SelectQuery +TargetNodes + ::= '->' Array +TargetTargets + ::= '->' TargetCall ( ',' TargetCall )* +TargetCall + ::= TargetRef ParameterAssignments? +RuleBody ::= ConstructQuery ( 'if' NodeShapeOrRef )? ( 'priority' INTEGER )? +TargetBody + ::= ( 'label' Str )? SelectQuery +TargetDeclaration + ::= '(' ParameterDeclaration ( ',' ParameterDeclaration )* ')' +FunctionDeclaration + ::= '(' ParameterDeclaration ( ',' ParameterDeclaration )* ')' ( 'returns' Iri )? +FunctionBody + ::= SelectQuery +ParameterDeclaration + ::= 'optional'? 'parameter'? Iri NodeKind? Iri? ( 'order' INTEGER )? +ParameterAssignment + ::= Iri IriOrLiteral +ParameterAssignments + ::= '(' ParameterAssignment ( ',' ParameterAssignment )* ')' +SparqlConstraint + ::= SelectQuery + | AskQuery +SelectQuery + ::= SelectClause DatasetClause* WhereClause SolutionModifier +DescribeQuery + ::= SKW_DESCRIBE ( VarOrIri+ | '*' ) DatasetClause* WhereClause SolutionModifier +SelectClause + ::= SKW_SELECT ( SKW_DISTINCT | SKW_REDUCED )? ( SelectItem+ | '*' ) +SelectItem + ::= Variable + | '(' Expression SKW_AS Variable ')' +AskQuery ::= SKW_ASK DatasetClause* WhereClause +DatasetClause + ::= SKW_FROM SKW_NAMED? IRIREF +WhereClause + ::= SKW_WHERE? GroupGraphPattern +SolutionModifier + ::= GroupClause? HavingClause? OrderClause? ( LimitClause OffsetClause? | OffsetClause LimitClause? )? +ConstructQuery + ::= SKW_CONSTRUCT ConstructTemplate DatasetClause* WhereClause SolutionModifier +ConstructTemplate + ::= '{' TriplesSameSubject ( '.' TriplesSameSubject? )* '}' +TriplesSameSubject + ::= VarOrTerm PropertyListNotEmpty + | TriplesNode PropertyList +TriplesSameSubjectPath + ::= VarOrTerm PropertyListPathNotEmpty + | TriplesNodePath PropertyListPath +OrderClause + ::= SKW_ORDER SKW_BY OrderCondition+ +OrderCondition + ::= ( SKW_ASC | SKW_DESC ) BrackettedExpression + | Constraint + | Variable +ValuesClause + ::= ( SKW_VALUES DataBlock )? +DataBlock + ::= DataBlockOneVar + | DataBlockFull +DataBlockOneVar + ::= Variable '{' DataBlockValue* '}' +DataBlockFull + ::= '(' Variable* ')' '{' DataBlockValues* '}' +DataBlockValue + ::= Iri + | Literal + | 'UNDEF' +DataBlockValues + ::= '(' DataBlockValue* ')' +GroupClause + ::= SKW_GROUP SKW_BY GroupCondition+ +GroupCondition + ::= BuiltInCall + | FunctionCall + | '(' Expression ( SKW_AS Variable )? ')' + | Variable +HavingClause + ::= SKW_HAVING HavingCondition +HavingCondition + ::= Constraint +Constraint + ::= BrackettedExpression + | BuiltInCall + | FunctionCall +GroupGraphPattern + ::= '{' ( SubSelect | TriplesBlock? GraphPatternPart* ) '}' +GraphPatternPart + ::= GraphPatternNotTriples '.'? TriplesBlock? +SubSelect + ::= SelectClause WhereClause SolutionModifier ValuesClause +GraphPatternNotTriples + ::= UnionGraphPattern + | OptionalGraphPattern + | MinusGraphPattern + | GraphGraphPattern + | Filter + | Bind + | InlineData +Bind ::= SKW_BIND '(' Expression SKW_AS Variable ')' +InlineData + ::= SKW_VALUES DataBlock +MinusGraphPattern + ::= SKW_MINUS GroupGraphPattern +OptionalGraphPattern + ::= SKW_OPTIONAL GroupGraphPattern +GraphGraphPattern + ::= SKW_GRAPH VarOrIri GroupGraphPattern +UnionGraphPattern + ::= GroupGraphPattern ( SKW_UNION GroupGraphPattern )* +ServiceGraphPattern + ::= SKW_SERVICE SKW_SILENT? VarOrIri GroupGraphPattern +TriplesBlock + ::= TriplesSameSubjectPath ( '.' TriplesSameSubjectPath? )* +Filter ::= SKW_FILTER Constraint +PropertyListPathNotEmpty + ::= PathObjectListPath ( ';' PathObjectList? )* +PathOrVariable + ::= Path + | Variable +PropertyListPath + ::= PropertyListPathNotEmpty? +PathObjectList + ::= PathOrVariable ObjectList +PathObjectListPath + ::= PathOrVariable ObjectListPath +PropertyListNotEmpty + ::= VerbObjectList ( ';' VerbObjectList? )* +PropertyList + ::= PropertyListNotEmpty? +VerbObjectList + ::= Verb ObjectList +Verb ::= VarOrIri + | 'a' +ObjectList + ::= Object ( ',' Object )* +ObjectListPath + ::= ObjectPath ( ',' ObjectPath )* +Object ::= GraphNode +ObjectPath + ::= GraphNodePath +Collection + ::= '(' GraphNode+ ')' +CollectionPath + ::= '(' GraphNodePath+ ')' +GraphNode + ::= VarOrTerm + | TriplesNode +GraphNodePath + ::= VarOrTerm + | TriplesNodePath +TriplesNode + ::= Collection + | BlankNodePropertyList +TriplesNodePath + ::= CollectionPath + | BlankNodePropertyListPath +BlankNodePropertyList + ::= '[' PropertyListNotEmpty ']' +BlankNodePropertyListPath + ::= '[' PropertyListPathNotEmpty ']' +VarOrTerm + ::= Variable + | GraphTerm +GraphTerm + ::= Iri + | RdfLiteral + | NumericLiteral + | BooleanLiteral + | BlankNode + | '(' ')' +BuiltInCall + ::= ( ( ( FN_STR | FN_LANG | FN_DATATYPE | FN_IRI | FN_URI | FN_RAND | FN_CEIL | FN_FLOOR | FN_ROUND | FN_STRLEN | FN_UCASE | FN_LCASE | FN_ENCODE_FOR_URI | FN_YEAR | FN_MONTH | FN_DAY | FN_HOURS | FN_MINUTES | FN_SECONDS | FN_TIMEZONE | FN_TZ | FN_MD5 | FN_SHA1 | FN_SHA256 | FN_SHA384 | FN_SHA512 | 'isIRI' | FN_ISURI | FN_ISBLANK | FN_ISLITERAL ) '(' | ( ( FN_LANGMATCHES | FN_CONTAINS | FN_STRSTARTS | FN_STRENDS | FN_STRBEFORE | FN_STRAFTER | FN_STRLANG | FN_STRDT | FN_SAMETERM ) '(' | FN_IF '(' Expression ',' | ( ( FN_SUBSTR | FN_REGEXP ) '(' | FN_REPLACE '(' Expression ',' ) ( Expression ',' )? ) Expression ',' | ( FN_CONCAT | FN_COALESCE ) '(' ( Expression ',' )* ) Expression | FN_BOUND '(' Variable | FN_BNODE '(' Expression? | ( FN_NOW | FN_UUID | FN_STRUUID ) '(' ) ')' + | ExistsFunc + | NotExistsFunc + | Aggregate +ExistsFunc + ::= SKW_EXISTS GroupGraphPattern +NotExistsFunc + ::= SKW_NOT SKW_EXISTS GroupGraphPattern +Aggregate + ::= ( FN_COUNT '(' SKW_DISTINCT? ( '*' | Expression ) | ( FN_SUM | FN_MIN | FN_MAX | FN_SAMPLE | FN_AVG ) '(' SKW_DISTINCT? Expression | FN_GROUP_CONCAT '(' SKW_DISTINCT? Expression ( ';' FN_SEPARATOR '=' Str )? ) ')' +Expression + ::= ConditionalOrExpression +ConditionalOrExpression + ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* +ConditionalAndExpression + ::= ValueLogical ( '&&' ValueLogical )* +ValueLogical + ::= RelationalExpression +RelationalExpression + ::= NumericExpression ( ( '=' | '!=' | '<' | '>' | '<=' | '>=' ) NumericExpression | SKW_NOT? SKW_IN ExpressionList )? +ExpressionList + ::= '(' Expression? ( ',' Expression )* ')' +NumericExpression + ::= AdditiveExpression +AdditiveExpression + ::= MultiplicativeExpression AdditiveTerm* +AdditiveTerm + ::= ( '+' | '-' ) MultiplicativeExpression + | NumericLiteral MultiplicativeTerm* +MultiplicativeExpression + ::= UnaryExpression MultiplicativeTerm* +MultiplicativeTerm + ::= ( '*' | '/' ) UnaryExpression +UnaryExpression + ::= ( '!' | '+' | '-' )? PrimaryExpression +PrimaryExpression + ::= BrackettedExpression + | BuiltInCall + | IriOrFunction + | Literal + | Variable +BrackettedExpression + ::= '(' Expression ')' +IriOrFunction + ::= Iri ArgList? +FunctionCall + ::= Iri ArgList +ArgList ::= '(' SKW_DISTINCT? Expression? ( ',' Expression )* ')' +VarOrIri ::= Variable + | Iri +LimitClause + ::= SKW_LIMIT INTEGER +OffsetClause + ::= SKW_OFFSET INTEGER +RuleBodyOrRef + ::= '{' RuleBody '}' + | RuleRef +NodeConstraint + ::= TypeConstraint + | HasValueConstraint + | InConstraint + | MinExclusiveConstraint + | MinInclusiveConstraint + | MaxExclusiveConstraint + | MaxInclusiveConstraint + | MinLengthConstraint + | MaxLengthConstraint + | PatternConstraint + | LessThanConstraint + | LessThanOrEqualConstraint + | NameAnnotation + | DescriptionAnnotation +PropertyConstraint + ::= HasValueConstraint + | InConstraint + | MinExclusiveConstraint + | MinInclusiveConstraint + | MaxExclusiveConstraint + | MaxInclusiveConstraint + | MinLengthConstraint + | MaxLengthConstraint + | PatternConstraint + | LessThanConstraint + | LessThanOrEqualConstraint + | NameAnnotation + | DescriptionAnnotation + | DefaultValueAnnotation +PropertyCount + ::= '[' PropertyMinCount '..' PropertyMaxCount ']' +PropertyMinCount + ::= INTEGER +PropertyMaxCount + ::= INTEGER + | '*' +NodeKind ::= 'BlankNode' + | 'IRI' + | 'Literal' + | 'BlankNodeOrIRI' + | 'BlankNodeOrLiteral' + | 'IRIOrLiteral' +PropertyShapeOrRef + ::= ShapeRef + | '{' PropertyShapeBody '}' +PropertyShapeBody + ::= 'path'? Path PropertyExpression +PropertyExpression + ::= PropertyOr +PropertyOr + ::= PropertyXOne ( KW_OR PropertyXOne )* +PropertyXOne + ::= PropertyAnd ( KW_XONE PropertyAnd )* +PropertyAnd + ::= PropertyNot ( KW_AND? PropertyNot )* +PropertyNot + ::= KW_NOT? PropertyAtom +PropertyBracketted + ::= '(' PropertyExpression ')' +PropertyAtom + ::= PropertyBracketted + | Iri + | NodeKind + | PropertyCount + | ( 'qualified' PropertyCount )? 'shape'? NodeShapeOrRef + | 'property' PropertyShapeOrRef + | PropertyConstraint + | ( 'message' | 'severity' ) Str + | 'closed' + | 'deactivated' +NodeShapeOrRef + ::= ShapeRef + | '{' NodeShapeBody '}' +NodeShapeBody + ::= NodeExpression +NodeExpression + ::= NodeOr +NodeOr ::= NodeXOne ( KW_OR NodeXOne )* +NodeXOne ::= NodeAnd ( KW_XONE NodeAnd )* +NodeAnd ::= NodeNot ( ( KW_AND | '.' ) NodeNot )* +NodeNot ::= KW_NOT? NodeAtom +NodeBracketted + ::= '(' NodeExpression ')' +NodeAtom ::= NodeBracketted + | ( 'property' | 'shape' )? ShapeRef + | PropertyShapeBody + | 'rule' RuleBodyOrRef + | NodeConstraint + | NodeKind + | SparqlConstraint + | ( 'message' | 'severity' ) Str + | 'closed' + | 'deactivated' +NameAnnotation + ::= 'name' '=' RdfLiteral +DescriptionAnnotation + ::= 'description' '=' RdfLiteral +DefaultValueAnnotation + ::= 'defaultValue' '=' IriOrLiteral +TypeConstraint + ::= ( 'class' | 'type' ) Iri +InConstraint + ::= 'in' '=' Array +HasValueConstraint + ::= 'hasValue' '=' IriOrLiteral +MinExclusiveConstraint + ::= 'minExclusive' '=' NumericLiteral +MinInclusiveConstraint + ::= 'minInclusive' '=' NumericLiteral +MaxExclusiveConstraint + ::= 'maxExclusive' '=' NumericLiteral +MaxInclusiveConstraint + ::= 'maxInclusive' '=' NumericLiteral +MinLengthConstraint + ::= 'minLength' '=' NumericLiteral +MaxLengthConstraint + ::= 'maxLength' '=' NumericLiteral +PatternConstraint + ::= 'pattern' '=' Str +LessThanConstraint + ::= '<' Iri +LessThanOrEqualConstraint + ::= '<=' Iri +FN_STR ::= 'STR' + | 'str' +FN_LANG ::= 'LANG' + | 'lang' +FN_LANGMATCHES + ::= 'LANGMATCHES' + | 'langmatches' +FN_DATATYPE + ::= 'DATATYPE' + | 'datatype' +FN_BOUND ::= 'BOUND' + | 'bound' +FN_IRI ::= 'IRI' + | 'iri' +FN_URI ::= 'URI' + | 'uri' +FN_BNODE ::= 'BNODE' + | 'bnode' +FN_RAND ::= 'RAND' + | 'rand' +FN_CEIL ::= 'CEIL' + | 'ceil' +FN_FLOOR ::= 'FLOOR' + | 'floor' +FN_ROUND ::= 'ROUND' + | 'round' +FN_CONCAT + ::= 'CONCAT' + | 'concat' +FN_SUBSTR + ::= 'SUBSTR' + | 'substr' +FN_STRLEN + ::= 'STRLEN' + | 'strlen' +FN_REPLACE + ::= 'REPLACE' + | 'replace' +FN_UCASE ::= 'UCASE' + | 'ucase' +FN_LCASE ::= 'LCASE' + | 'lcase' +FN_ENCODE_FOR_URI + ::= 'ENCODE_FOR_URI' + | 'encode_for_uri' +FN_CONTAINS + ::= 'CONTAINS' + | 'contains' +FN_STRSTARTS + ::= 'STRSTARTS' + | 'strstarts' +FN_STRENDS + ::= 'STRENDS' + | 'strends' +FN_STRBEFORE + ::= 'STRBEFORE' + | 'strbefore' +FN_STRAFTER + ::= 'STRAFTER' + | 'strafter' +FN_YEAR ::= 'YEAR' + | 'year' +FN_MONTH ::= 'MONTH' + | 'month' +FN_DAY ::= 'DAY' + | 'day' +FN_HOURS ::= 'HOURS' + | 'hours' +FN_MINUTES + ::= 'MINUTES' + | 'minutes' +FN_SECONDS + ::= 'SECONDS' + | 'seconds' +FN_TIMEZONE + ::= 'TIMEZONE' + | 'timezone' +FN_TZ ::= 'TZ' + | 'tz' +FN_NOW ::= 'NOW' + | 'now' +FN_UUID ::= 'UUID' + | 'uuid' +FN_STRUUID + ::= 'STRUUID' + | 'struuid' +FN_MD5 ::= 'MD5' + | 'md5' +FN_SHA1 ::= 'SHA1' + | 'sha1' +FN_SHA256 + ::= 'SHA256' + | 'sha256' +FN_SHA384 + ::= 'SHA384' + | 'sha384' +FN_SHA512 + ::= 'SHA512' + | 'sha512' +FN_COALESCE + ::= 'COALESCE' + | 'coalesce' +FN_IF ::= 'IF' + | 'if' +FN_STRLANG + ::= 'STRLANG' + | 'strlang' +FN_STRDT ::= 'STRDT' + | 'strdt' +FN_SAMETERM + ::= 'sameTerm' + | 'SAMETERM' + | 'sameterm' +FN_ISURI ::= 'isURI' + | 'ISURI' + | 'isuri' +FN_ISBLANK + ::= 'isBLANK' + | 'ISBLANK' + | 'isblank' +FN_ISLITERAL + ::= 'isLITERAL' + | 'ISLITERAL' + | 'isliteral' +FN_REGEXP + ::= 'REGEX' + | 'regexp' +FN_COUNT ::= 'COUNT' + | 'count' +FN_AVG ::= 'AVG' + | 'avg' +FN_MIN ::= 'MIN' + | 'min' +FN_MAX ::= 'MAX' + | 'max' +FN_GROUP_CONCAT + ::= 'GROUP_CONCAT' + | 'group_concat' +FN_SEPARATOR + ::= 'SEPARATOR' + | 'separator' +FN_SUM ::= 'SUM' + | 'sum' +FN_SAMPLE + ::= 'SAMPLE' + | 'sample' +SKW_ASK ::= 'ASK' + | 'ask' +SKW_SELECT + ::= 'SELECT' + | 'select' +SKW_GRAPH + ::= 'GRAPH' + | 'graph' +SKW_OPTIONAL + ::= 'OPTIONAL' + | 'optional' +SKW_GROUP + ::= 'GROUP' + | 'group' +SKW_BIND ::= 'BIND' + | 'bind' +SKW_HAVING + ::= 'HAVING' + | 'having' +SKW_AS ::= 'AS' + | 'as' +SKW_ORDER + ::= 'ORDER' + | 'order' +SKW_UNION + ::= 'UNION' + | 'union' +SKW_MINUS + ::= 'MINUS' + | 'minus' +SKW_VALUES + ::= 'VALUES' + | 'values' +SKW_NAMED + ::= 'NAMED' + | 'named' +SKW_FROM ::= 'FROM' + | 'from' +SKW_BY ::= 'BY' + | 'by' +SKW_LIMIT + ::= 'LIMIT' + | 'limit' +SKW_FILTER + ::= 'FILTER' + | 'filter' +SKW_ASC ::= 'ASC' + | 'asc' +SKW_DESC ::= 'DESC' + | 'desc' +SKW_EXISTS + ::= 'EXISTS' + | 'exists' +SKW_OFFSET + ::= 'OFFSET' + | 'offset' +SKW_DISTINCT + ::= 'DISTINCT' + | 'distinct' +SKW_REDUCED + ::= 'REDUCED' + | 'reduced' +SKW_CONSTRUCT + ::= 'CONSTRUCT' + | 'construct' +SKW_WHERE + ::= 'WHERE' + | 'where' +SKW_DESCRIBE + ::= 'DESCRIBE' + | 'describe' +SKW_NOT ::= 'NOT' + | 'not' +SKW_IN ::= 'IN' + | 'in' +SKW_SERVICE + ::= 'SERVICE' + | 'service' +SKW_SILENT + ::= 'SILENT' + | 'silent' +ShapeRef ::= AT_PNAME_LN + | AT_PNAME_NS + | AT_IRIREF +RuleRef ::= AT_PNAME_LN + | AT_PNAME_NS + | AT_IRIREF +TargetRef + ::= AT_PNAME_LN + | AT_PNAME_NS + | AT_IRIREF +FunctionRef + ::= AT_PNAME_LN + | AT_PNAME_NS + | AT_IRIREF +Path ::= PathAlternative +PathAlternative + ::= PathSequence ( '|' PathSequence )* +PathSequence + ::= PathEltOrInverse ( '/' PathEltOrInverse )* +PathElt ::= PathPrimary PathMod? +PathEltOrInverse + ::= '^'? PathElt +PathMod ::= '?' + | '*' + | '+' +PathPrimary + ::= Iri + | 'a' + | '!' PathNegatedPropertySet + | '(' Path ')' +PathNegatedPropertySet + ::= PathOneInPropertySet + | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')' +PathOneInPropertySet + ::= '^'? ( Iri | 'a' ) +IriOrLiteralOrArray + ::= IriOrLiteral + | Array +IriOrLiteral + ::= Iri + | Literal +Iri ::= IRIREF + | PrefixedName + | PrefixedLabel +PrefixedName + ::= PNAME_LN + | PNAME_NS +PrefixedLabel + ::= LABEL_REF1 + | LABEL_REF2 +BlankNode + ::= BLANK_NODE_LABEL + | '[' ']' +Literal ::= RdfLiteral + | NumericLiteral + | BooleanLiteral +BooleanLiteral + ::= 'true' + | 'false' +NumericLiteral + ::= INTEGER + | DECIMAL + | DOUBLE +RdfLiteral + ::= Str ( LANGTAG | DTYPETAG )? +Str ::= STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 + | STRING_LITERAL1 + | STRING_LITERAL2 +Array ::= '[' IriOrLiteral* ']' +Variable ::= VAR1 + | VAR2 +KW_AND ::= 'and' + | OP_AND +KW_OR ::= 'or' + | OP_OR +KW_XONE ::= 'xone' + | 'xor' + | OP_XONE +KW_NOT ::= 'not' + | OP_NOT + + + +OP_AND ::= [∧] +OP_OR ::= [|#x2228] +OP_NOT ::= [!#xAC] +OP_XONE ::= '><' + | [#x22BB#x2A52] +VAR1 ::= '?' VARNAME +VAR2 ::= '$' VARNAME +VARNAME ::= ( PN_CHARS_U | DIGIT ) ( PN_CHARS_U | DIGIT | [#xB7#x300-#x36F#x203F-#x2040] )* +PASS ::= [ #x9#xD#xA]+ +COMMENT ::= '#' [^#xD#xA]* +IRIREF ::= '<' ( [^<>"{}|^`\#x0-#x20#xAB#xBB] | UCHAR )* '>' +LABEL_REF1 + ::= #xAB ( .* - ( .* #xBB .* ) ) #xBB +LABEL_REF2 + ::= '<<' ( .* - ( .* '>>' .* ) ) '>>' +PNAME_NS ::= PN_PREFIX? ':' +PNAME_LN ::= PNAME_NS PN_LOCAL +AT_PNAME_NS + ::= AT PN_PREFIX? ':' +AT_PNAME_LN + ::= AT PNAME_NS PN_LOCAL +AT_IRIREF + ::= AT IRIREF +DTYPETAG ::= '^^' ( PNAME_NS PN_LOCAL | IRIREF ) +BLANK_NODE_LABEL + ::= '_:' ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | '.' )* PN_CHARS )? +LANGTAG ::= AT [A-Za-z]+ ( '-' [A-Za-z0-9]+ )* +INTEGER ::= [+#x2D]? DIGIT+ +DECIMAL ::= [+#x2D]? DIGIT* '.' DIGIT+ +DOUBLE ::= [+#x2D]? ( DIGIT+ '.' | '.'? DIGIT ) DIGIT* EXPONENT +UCASE_LABEL + ::= [A-Z_] ( [A-Z_] | DIGIT )* +EXPONENT ::= [eE] [+#x2D]? DIGIT+ +STRING_LITERAL1 + ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'" +STRING_LITERAL2 + ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"' +STRING_LITERAL_LONG1 + ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" +STRING_LITERAL_LONG2 + ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' +AT ::= '@' +DIGIT ::= [0-9] +UCHAR ::= '\' ( 'u' | 'U' HEX HEX HEX HEX ) HEX HEX HEX HEX +ECHAR ::= '\' [tbnrf\"'] +PN_CHARS_BASE + ::= [A-Za-z#xC0-#xD6#xD8-#xF6#xF8-#x2FF#x370-#x37D#x37F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD] +PN_CHARS_U + ::= PN_CHARS_BASE + | '_' +PN_CHARS ::= PN_CHARS_U + | [-#xB7#x300-#x36F#x203F-#x2040] + | DIGIT +PN_PREFIX + ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )? +PN_LOCAL ::= ( PN_CHARS_U | ':' | DIGIT | PLX ) ( ( PN_CHARS | [.:] | PLX )* ( PN_CHARS | ':' | PLX ) )? +PLX ::= PERCENT + | PN_LOCAL_ESC +PERCENT ::= '%' HEX HEX +HEX ::= DIGIT + | [A-Fa-f] +PN_LOCAL_ESC + ::= '\' [_~.!$&'()*+,;=/?@%#x2D#x23] \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-XText.html b/shacl-compact-syntax/grammar/shaclc-XText.html new file mode 100644 index 0000000..b953105 --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-XText.html @@ -0,0 +1,7798 @@ + + + + + + + + + + +

ShaclDoc:

+ + + + + LIBRARY + + + IRIREF + + VERSION + + + IRIREF + + + Directive + + + NodeShape + + + ShapeClass + + + PropertyShape + + + RuleShape + + + TargetShape + + + FunctionShape + +

+

+

+

no references


Directive:

+ + + + + BaseDecl + + + ImportsDecl + + + PrefixDecl + +

+

+ +
         ::= BaseDecl
+
           | ImportsDecl
+
           | PrefixDecl
+

+

referenced by: +

+


BaseDecl:

+ + + + + BASE + + + IRIREF + +

+

+
BaseDecl ::= 'BASE' IRIREF
+

+

referenced by: +

+


ImportsDecl:

+ + + + + IMPORTS + + + IRIREF + +

+

+ +
         ::= 'IMPORTS' IRIREF
+

+

referenced by: +

+


PrefixDecl:

+ + + + + PREFIX + + + PNAME_NS + + + IRIREF + +

+

+ +
         ::= 'PREFIX' PNAME_NS IRIREF
+

+

referenced by: +

+


ShapeClass:

+ + + + + shapeClass + + + Iri + + . + + + { + + + NodeShapeBody + + } + + +

+

+ +
         ::= 'shapeClass' Iri ( '.' | '{' NodeShapeBody '}' )
+

+

referenced by: +

+


NodeShape:

+ + + + + shape + + + Iri + + + Target + + . + + + { + + + NodeShapeBody + + } + + +

+

+ +
         ::= 'shape' Iri Target* ( '.' | '{' NodeShapeBody '}' )
+

+

referenced by: +

+


PropertyShape:

+ + + + + property + + + Iri + + . + + + { + + + PropertyShapeBody + + } + + +

+

+ +
         ::= 'property' Iri ( '.' | '{' PropertyShapeBody '}' )
+

+

referenced by: +

+


RuleShape:

+ + + + + rule + + + Iri + + . + + + { + + + RuleBody + + } + + +

+

+ +
         ::= 'rule' Iri ( '.' | '{' RuleBody '}' )
+

+

referenced by: +

+


TargetShape:

+ + + + + target + + + Iri + + . + + + TargetDeclaration + + { + + + TargetBody + + } + + +

+

+ +
         ::= 'target' Iri ( '.' | TargetDeclaration '{' TargetBody '}' )
+

+

referenced by: +

+


FunctionShape:

+ + + + + function + + + Iri + + . + + + FunctionDeclaration + + { + + + FunctionBody + + } + + +

+

+ +
         ::= 'function' Iri ( '.' | FunctionDeclaration '{' FunctionBody '}' )
+

+

referenced by: +

+


Target:

+ + + + + TargetClasses + + + TargetNodes + + + TargetTargets + + + TargetSubjectsOf + + + TargetObjectsOf + + + TargetSelect + +

+

+ +
           | TargetNodes
+
           | TargetTargets
+
           | TargetSubjectsOf
+
           | TargetObjectsOf
+
           | TargetSelect
+

+

referenced by: +

+


TargetClasses:

+ + + + + -> + + + Iri + + , + + +

+

+ +
         ::= '->' Iri ( ',' Iri )*
+

+

referenced by: +

+


TargetSubjectsOf:

+ + + + + *-> + + + Iri + + , + + +

+

+ +
         ::= '*->' Iri ( ',' Iri )*
+

+

referenced by: +

+


TargetObjectsOf:

+ + + + + ->* + + + Iri + + , + + +

+

+ +
         ::= '->*' Iri ( ',' Iri )*
+

+

referenced by: +

+


TargetSelect:

+ + + + + -> + + + SelectQuery + +

+

+ +
         ::= '->' SelectQuery
+

+

referenced by: +

+


TargetNodes:

+ + + + + -> + + + Array + +

+

+ +
         ::= '->' Array
+

+

referenced by: +

+


TargetTargets:

+ + + + + -> + + + TargetCall + + , + + +

+

+ +
         ::= '->' TargetCall ( ',' TargetCall )*
+

+

referenced by: +

+


TargetCall:

+ + + + + TargetRef + + + ParameterAssignments + +

+

+ +
         ::= TargetRef ParameterAssignments?
+

+

referenced by: +

+


RuleBody:

+ + + + + ConstructQuery + + if + + + NodeShapeOrRef + + priority + + + INTEGER + +

+

+
RuleBody ::= ConstructQuery ( 'if' NodeShapeOrRef )? ( 'priority' INTEGER )?
+

+

referenced by: +

+


TargetBody:

+ + + + + label + + + Str + + + SelectQuery + +

+

+ +
         ::= ( 'label' Str )? SelectQuery
+

+

referenced by: +

+


TargetDeclaration:

+ + + + + ( + + + ParameterDeclaration + + , + + + ) + + +

+

+ +
         ::= '(' ParameterDeclaration ( ',' ParameterDeclaration )* ')'
+

+

referenced by: +

+


FunctionDeclaration:

+ + + + + ( + + + ParameterDeclaration + + , + + + ) + + + returns + + + Iri + +

+

+ +
         ::= '(' ParameterDeclaration ( ',' ParameterDeclaration )* ')' ( 'returns' Iri )?
+

+

referenced by: +

+


FunctionBody:

+ + + + + SelectQuery + +

+

+ +
         ::= SelectQuery
+

+

referenced by: +

+


ParameterDeclaration:

+ + + + + optional + + + parameter + + + Iri + + + NodeKind + + + Iri + + order + + + INTEGER + +

+

+ +
         ::= 'optional'? 'parameter'? Iri NodeKind? Iri? ( 'order' INTEGER )?
+

+

referenced by: +

+


ParameterAssignment:

+ + + + + Iri + + + IriOrLiteral + +

+

+ +
         ::= Iri IriOrLiteral
+

+

referenced by: +

+


ParameterAssignments:

+ + + + + ( + + + ParameterAssignment + + , + + + ) + + +

+

+ +
         ::= '(' ParameterAssignment ( ',' ParameterAssignment )* ')'
+

+

referenced by: +

+


SparqlConstraint:

+ + + + + SelectQuery + + + AskQuery + +

+

+ +
         ::= SelectQuery
+
           | AskQuery
+

+

referenced by: +

+


SelectQuery:

+ + + + + SelectClause + + + DatasetClause + + + WhereClause + + + SolutionModifier + +

+

+

+

referenced by: +

+


DescribeQuery:

+ + + + + SKW_DESCRIBE + + + VarOrIri + + * + + + DatasetClause + + + WhereClause + + + SolutionModifier + +

+

+

+

no references


SelectClause:

+ + + + + SKW_SELECT + + + SKW_DISTINCT + + + SKW_REDUCED + + + SelectItem + + * + + +

+

+ +
         ::= SKW_SELECT ( SKW_DISTINCT | SKW_REDUCED )? ( SelectItem+ | '*' )
+

+

referenced by: +

+


SelectItem:

+ + + + + Variable + + ( + + + Expression + + + SKW_AS + + + Variable + + ) + + +

+

+ +
         ::= Variable
+
           | '(' Expression SKW_AS Variable ')'
+

+

referenced by: +

+


AskQuery:

+ + + + + SKW_ASK + + + DatasetClause + + + WhereClause + +

+

+

+

referenced by: +

+


DatasetClause:

+ + + + + SKW_FROM + + + SKW_NAMED + + + IRIREF + +

+

+ +
         ::= SKW_FROM SKW_NAMED? IRIREF
+

+

referenced by: +

+


WhereClause:

+ + + + + SKW_WHERE + + + GroupGraphPattern + +

+

+ +
         ::= SKW_WHERE? GroupGraphPattern
+

+

referenced by: +

+


SolutionModifier:

+ + + + + GroupClause + + + HavingClause + + + OrderClause + + + LimitClause + + + OffsetClause + + + OffsetClause + + + LimitClause + +

+

+

+

referenced by: +

+


ConstructQuery:

+ + + + + SKW_CONSTRUCT + + + ConstructTemplate + + + DatasetClause + + + WhereClause + + + SolutionModifier + +

+

+

+

referenced by: +

+


ConstructTemplate:

+ + + + + { + + + TriplesSameSubject + + . + + + TriplesSameSubject + + } + + +

+

+ +
         ::= '{' TriplesSameSubject ( '.' TriplesSameSubject? )* '}'
+

+

referenced by: +

+


TriplesSameSubject:

+ + + + + VarOrTerm + + + PropertyListNotEmpty + + + TriplesNode + + + PropertyList + +

+

+ +
         ::= VarOrTerm PropertyListNotEmpty
+
           | TriplesNode PropertyList
+

+

referenced by: +

+


TriplesSameSubjectPath:

+ + + + + VarOrTerm + + + PropertyListPathNotEmpty + + + TriplesNodePath + + + PropertyListPath + +

+

+

+

referenced by: +

+


OrderClause:

+ + + + + SKW_ORDER + + + SKW_BY + + + OrderCondition + +

+

+ +
         ::= SKW_ORDER SKW_BY OrderCondition+
+

+

referenced by: +

+


OrderCondition:

+ + + + + SKW_ASC + + + SKW_DESC + + + BrackettedExpression + + + Constraint + + + Variable + +

+

+ +
         ::= ( SKW_ASC | SKW_DESC ) BrackettedExpression
+
           | Constraint
+
           | Variable
+

+

referenced by: +

+


ValuesClause:

+ + + + + SKW_VALUES + + + DataBlock + +

+

+ +
         ::= ( SKW_VALUES DataBlock )?
+

+

referenced by: +

+


DataBlock:

+ + + + + DataBlockOneVar + + + DataBlockFull + +

+

+ +
         ::= DataBlockOneVar
+
           | DataBlockFull
+

+

referenced by: +

+


DataBlockOneVar:

+ + + + + Variable + + { + + + DataBlockValue + + } + + +

+

+ +
         ::= Variable '{' DataBlockValue* '}'
+

+

referenced by: +

+


DataBlockFull:

+ + + + + ( + + + Variable + + ) + + + { + + + DataBlockValues + + } + + +

+

+ +
         ::= '(' Variable* ')' '{' DataBlockValues* '}'
+

+

referenced by: +

+


DataBlockValue:

+ + + + + Iri + + + Literal + + UNDEF + + +

+

+ +
         ::= Iri
+
           | Literal
+
           | 'UNDEF'
+

+

referenced by: +

+


DataBlockValues:

+ + + + + ( + + + DataBlockValue + + ) + + +

+

+ +
         ::= '(' DataBlockValue* ')'
+

+

referenced by: +

+


GroupClause:

+ + + + + SKW_GROUP + + + SKW_BY + + + GroupCondition + +

+

+ +
         ::= SKW_GROUP SKW_BY GroupCondition+
+

+

referenced by: +

+


GroupCondition:

+ + + + + BuiltInCall + + + FunctionCall + + ( + + + Expression + + + SKW_AS + + + Variable + + ) + + + Variable + +

+

+ +
         ::= BuiltInCall
+
           | FunctionCall
+
           | '(' Expression ( SKW_AS Variable )? ')'
+
           | Variable
+

+

referenced by: +

+


HavingClause:

+ + + + + SKW_HAVING + + + HavingCondition + +

+

+ +
         ::= SKW_HAVING HavingCondition
+

+

referenced by: +

+


HavingCondition:

+ + + + + Constraint + +

+

+ +
         ::= Constraint
+

+

referenced by: +

+


Constraint:

+ + + + + BrackettedExpression + + + BuiltInCall + + + FunctionCall + +

+

+ +
         ::= BrackettedExpression
+
           | BuiltInCall
+
           | FunctionCall
+

+

referenced by: +

+


GroupGraphPattern:

+ + + + + { + + + TriplesBlock + + + GraphPatternPart + + + SubSelect + + } + + +

+

+ +
         ::= '{' ( SubSelect | TriplesBlock? GraphPatternPart* ) '}'
+

+

referenced by: +

+


GraphPatternPart:

+ + + + + GraphPatternNotTriples + + . + + + TriplesBlock + +

+

+ +
         ::= GraphPatternNotTriples '.'? TriplesBlock?
+

+

referenced by: +

+


SubSelect:

+ + + + + SelectClause + + + WhereClause + + + SolutionModifier + + + ValuesClause + +

+

+

+

referenced by: +

+


GraphPatternNotTriples:

+ + + + + UnionGraphPattern + + + OptionalGraphPattern + + + MinusGraphPattern + + + GraphGraphPattern + + + Filter + + + Bind + + + InlineData + +

+

+ +
         ::= UnionGraphPattern
+
           | OptionalGraphPattern
+
           | MinusGraphPattern
+
           | GraphGraphPattern
+
           | Filter
+
           | Bind
+
           | InlineData
+

+

referenced by: +

+


Bind:

+ + + + + SKW_BIND + + ( + + + Expression + + + SKW_AS + + + Variable + + ) + + +

+

+
Bind     ::= SKW_BIND '(' Expression SKW_AS Variable ')'
+

+

referenced by: +

+


InlineData:

+ + + + + SKW_VALUES + + + DataBlock + +

+

+ +
         ::= SKW_VALUES DataBlock
+

+

referenced by: +

+


MinusGraphPattern:

+ + + + + SKW_MINUS + + + GroupGraphPattern + +

+

+ +
         ::= SKW_MINUS GroupGraphPattern
+

+

referenced by: +

+


OptionalGraphPattern:

+ + + + + SKW_OPTIONAL + + + GroupGraphPattern + +

+

+

+

referenced by: +

+


GraphGraphPattern:

+ + + + + SKW_GRAPH + + + VarOrIri + + + GroupGraphPattern + +

+

+

+

referenced by: +

+


UnionGraphPattern:

+ + + + + GroupGraphPattern + + + SKW_UNION + +

+

+

+

referenced by: +

+


ServiceGraphPattern:

+ + + + + SKW_SERVICE + + + SKW_SILENT + + + VarOrIri + + + GroupGraphPattern + +

+

+

+

no references


TriplesBlock:

+ + + + + TriplesSameSubjectPath + + . + + + TriplesSameSubjectPath + +

+

+ +
         ::= TriplesSameSubjectPath ( '.' TriplesSameSubjectPath? )*
+

+

referenced by: +

+


Filter:

+ + + + + SKW_FILTER + + + Constraint + +

+

+

+

referenced by: +

+


PropertyListPathNotEmpty:

+ + + + + PathObjectListPath + + ; + + + PathObjectList + +

+

+ +
         ::= PathObjectListPath ( ';' PathObjectList? )*
+

+

referenced by: +

+


PathOrVariable:

+ + + + + Path + + + Variable + +

+

+ +
         ::= Path
+
           | Variable
+

+

referenced by: +

+


PropertyListPath:

+ + + + + PropertyListPathNotEmpty + +

+

+ +
         ::= PropertyListPathNotEmpty?
+

+

referenced by: +

+


PathObjectList:

+ + + + + PathOrVariable + + + ObjectList + +

+

+ +
         ::= PathOrVariable ObjectList
+

+

referenced by: +

+


PathObjectListPath:

+ + + + + PathOrVariable + + + ObjectListPath + +

+

+

+

referenced by: +

+


PropertyListNotEmpty:

+ + + + + VerbObjectList + + ; + + + VerbObjectList + +

+

+ +
         ::= VerbObjectList ( ';' VerbObjectList? )*
+

+

referenced by: +

+


PropertyList:

+ + + + + PropertyListNotEmpty + +

+

+ +
         ::= PropertyListNotEmpty?
+

+

referenced by: +

+


VerbObjectList:

+ + + + + Verb + + + ObjectList + +

+

+ +
         ::= Verb ObjectList
+

+

referenced by: +

+


Verb:

+ + + + + VarOrIri + + a + + +

+

+
Verb     ::= VarOrIri
+
           | 'a'
+

+

referenced by: +

+


ObjectList:

+ + + + + Object + + , + + +

+

+ +
         ::= Object ( ',' Object )*
+

+

referenced by: +

+


ObjectListPath:

+ + + + + ObjectPath + + , + + +

+

+ +
         ::= ObjectPath ( ',' ObjectPath )*
+

+

referenced by: +

+


Object:

+ + + + + GraphNode + +

+

+
Object   ::= GraphNode
+

+

referenced by: +

+


ObjectPath:

+ + + + + GraphNodePath + +

+

+ +
         ::= GraphNodePath
+

+

referenced by: +

+


Collection:

+ + + + + ( + + + GraphNode + + ) + + +

+

+ +
         ::= '(' GraphNode+ ')'
+

+

referenced by: +

+


CollectionPath:

+ + + + + ( + + + GraphNodePath + + ) + + +

+

+ +
         ::= '(' GraphNodePath+ ')'
+

+

referenced by: +

+


GraphNode:

+ + + + + VarOrTerm + + + TriplesNode + +

+

+ +
         ::= VarOrTerm
+
           | TriplesNode
+

+

referenced by: +

+


GraphNodePath:

+ + + + + VarOrTerm + + + TriplesNodePath + +

+

+ +
         ::= VarOrTerm
+
           | TriplesNodePath
+

+

referenced by: +

+


TriplesNode:

+ + + + + Collection + + + BlankNodePropertyList + +

+

+ +
         ::= Collection
+
           | BlankNodePropertyList
+

+

referenced by: +

+


TriplesNodePath:

+ + + + + CollectionPath + + + BlankNodePropertyListPath + +

+

+ +
         ::= CollectionPath
+
           | BlankNodePropertyListPath
+

+

referenced by: +

+


BlankNodePropertyList:

+ + + + + [ + + + PropertyListNotEmpty + + ] + + +

+

+ +
         ::= '[' PropertyListNotEmpty ']'
+

+

referenced by: +

+


BlankNodePropertyListPath:

+ + + + + [ + + + PropertyListPathNotEmpty + + ] + + +

+

+ +
         ::= '[' PropertyListPathNotEmpty ']'
+

+

referenced by: +

+


VarOrTerm:

+ + + + + Variable + + + GraphTerm + +

+

+ +
         ::= Variable
+
           | GraphTerm
+

+

referenced by: +

+


GraphTerm:

+ + + + + Iri + + + RdfLiteral + + + NumericLiteral + + + BooleanLiteral + + + BlankNode + + ( + + + ) + + +

+

+ +
         ::= Iri
+
           | RdfLiteral
+
           | NumericLiteral
+
           | BooleanLiteral
+
           | BlankNode
+
           | '(' ')'
+

+

referenced by: +

+


BuiltInCall:

+ + + + + FN_STR + + + FN_LANG + + + FN_DATATYPE + + + FN_IRI + + + FN_URI + + + FN_RAND + + + FN_CEIL + + + FN_FLOOR + + + FN_ROUND + + + FN_STRLEN + + + FN_UCASE + + + FN_LCASE + + + FN_ENCODE_FOR_URI + + + FN_YEAR + + + FN_MONTH + + + FN_DAY + + + FN_HOURS + + + FN_MINUTES + + + FN_SECONDS + + + FN_TIMEZONE + + + FN_TZ + + + FN_MD5 + + + FN_SHA1 + + + FN_SHA256 + + + FN_SHA384 + + + FN_SHA512 + + isIRI + + + FN_ISURI + + + FN_ISBLANK + + + FN_ISLITERAL + + ( + + + FN_LANGMATCHES + + + FN_CONTAINS + + + FN_STRSTARTS + + + FN_STRENDS + + + FN_STRBEFORE + + + FN_STRAFTER + + + FN_STRLANG + + + FN_STRDT + + + FN_SAMETERM + + ( + + + FN_IF + + ( + + + Expression + + , + + + FN_SUBSTR + + + FN_REGEXP + + ( + + + FN_REPLACE + + ( + + + Expression + + , + + + Expression + + , + + + Expression + + , + + + FN_CONCAT + + + FN_COALESCE + + ( + + + Expression + + , + + + Expression + + + FN_BOUND + + ( + + + Variable + + + FN_BNODE + + ( + + + Expression + + + FN_NOW + + + FN_UUID + + + FN_STRUUID + + ( + + + ) + + + ExistsFunc + + + NotExistsFunc + + + Aggregate + +

+

+ +
         ::= ( ( ( FN_STR | FN_LANG | FN_DATATYPE | FN_IRI | FN_URI | FN_RAND | FN_CEIL | FN_FLOOR | FN_ROUND | FN_STRLEN | FN_UCASE | FN_LCASE | FN_ENCODE_FOR_URI | FN_YEAR | FN_MONTH | FN_DAY | FN_HOURS | FN_MINUTES | FN_SECONDS | FN_TIMEZONE | FN_TZ | FN_MD5 | FN_SHA1 | FN_SHA256 | FN_SHA384 | FN_SHA512 | 'isIRI' | FN_ISURI | FN_ISBLANK | FN_ISLITERAL ) '(' | ( ( FN_LANGMATCHES | FN_CONTAINS | FN_STRSTARTS | FN_STRENDS | FN_STRBEFORE | FN_STRAFTER | FN_STRLANG | FN_STRDT | FN_SAMETERM ) '(' | FN_IF '(' Expression ',' | ( ( FN_SUBSTR | FN_REGEXP ) '(' | FN_REPLACE '(' Expression ',' ) ( Expression ',' )? ) Expression ',' | ( FN_CONCAT | FN_COALESCE ) '(' ( Expression ',' )* ) Expression | FN_BOUND '(' Variable | FN_BNODE '(' Expression? | ( FN_NOW | FN_UUID | FN_STRUUID ) '(' ) ')'
+
           | ExistsFunc
+
           | NotExistsFunc
+
           | Aggregate
+

+

referenced by: +

+


ExistsFunc:

+ + + + + SKW_EXISTS + + + GroupGraphPattern + +

+

+ +
         ::= SKW_EXISTS GroupGraphPattern
+

+

referenced by: +

+


NotExistsFunc:

+ + + + + SKW_NOT + + + SKW_EXISTS + + + GroupGraphPattern + +

+

+

+

referenced by: +

+


Aggregate:

+ + + + + FN_COUNT + + ( + + + SKW_DISTINCT + + * + + + Expression + + + FN_SUM + + + FN_MIN + + + FN_MAX + + + FN_SAMPLE + + + FN_AVG + + ( + + + SKW_DISTINCT + + + Expression + + + FN_GROUP_CONCAT + + ( + + + SKW_DISTINCT + + + Expression + + ; + + + FN_SEPARATOR + + = + + + Str + + ) + + +

+

+ +
         ::= ( FN_COUNT '(' SKW_DISTINCT? ( '*' | Expression ) | ( FN_SUM | FN_MIN | FN_MAX | FN_SAMPLE | FN_AVG ) '(' SKW_DISTINCT? Expression | FN_GROUP_CONCAT '(' SKW_DISTINCT? Expression ( ';' FN_SEPARATOR '=' Str )? ) ')'
+

+

referenced by: +

+


Expression:

+ + + + + ConditionalOrExpression + +

+

+ +
         ::= ConditionalOrExpression
+

+

referenced by: +

+


ConditionalOrExpression:

+ + + + + ConditionalAndExpression + + || + + +

+

+

+

referenced by: +

+


ConditionalAndExpression:

+ + + + + ValueLogical + + && + + +

+

+ +
         ::= ValueLogical ( '&&' ValueLogical )*
+

+

referenced by: +

+


ValueLogical:

+ + + + + RelationalExpression + +

+

+ +
         ::= RelationalExpression
+

+

referenced by: +

+


RelationalExpression:

+ + + + + NumericExpression + + = + + + != + + + < + + + > + + + <= + + + >= + + + NumericExpression + + + SKW_NOT + + + SKW_IN + + + ExpressionList + +

+

+ +
         ::= NumericExpression ( ( '=' | '!=' | '<' | '>' | '<=' | '>=' ) NumericExpression | SKW_NOT? SKW_IN ExpressionList )?
+

+

referenced by: +

+


ExpressionList:

+ + + + + ( + + + Expression + + , + + + Expression + + ) + + +

+

+ +
         ::= '(' Expression? ( ',' Expression )* ')'
+

+

referenced by: +

+


NumericExpression:

+ + + + + AdditiveExpression + +

+

+ +
         ::= AdditiveExpression
+

+

referenced by: +

+


AdditiveExpression:

+ + + + + MultiplicativeExpression + + + AdditiveTerm + +

+

+

+

referenced by: +

+


AdditiveTerm:

+ + + + + NumericLiteral + + + MultiplicativeTerm + + + + + + - + + + MultiplicativeExpression + +

+

+ +
         ::= ( '+' | '-' ) MultiplicativeExpression
+
           | NumericLiteral MultiplicativeTerm*
+

+

referenced by: +

+


MultiplicativeExpression:

+ + + + + UnaryExpression + + + MultiplicativeTerm + +

+

+

+

referenced by: +

+


MultiplicativeTerm:

+ + + + + * + + + / + + + UnaryExpression + +

+

+ +
         ::= ( '*' | '/' ) UnaryExpression
+

+

referenced by: +

+


UnaryExpression:

+ + + + + ! + + + + + + + - + + + PrimaryExpression + +

+

+ +
         ::= ( '!' | '+' | '-' )? PrimaryExpression
+

+

referenced by: +

+


PrimaryExpression:

+ + + + + BrackettedExpression + + + BuiltInCall + + + IriOrFunction + + + Literal + + + Variable + +

+

+ +
         ::= BrackettedExpression
+
           | BuiltInCall
+
           | IriOrFunction
+
           | Literal
+
           | Variable
+

+

referenced by: +

+


BrackettedExpression:

+ + + + + ( + + + Expression + + ) + + +

+

+ +
         ::= '(' Expression ')'
+

+

referenced by: +

+


IriOrFunction:

+ + + + + Iri + + + ArgList + +

+

+ +
         ::= Iri ArgList?
+

+

referenced by: +

+


FunctionCall:

+ + + + + Iri + + + ArgList + +

+

+ +
         ::= Iri ArgList
+

+

referenced by: +

+


ArgList:

+ + + + + ( + + + SKW_DISTINCT + + + Expression + + , + + + Expression + + ) + + +

+

+
ArgList  ::= '(' SKW_DISTINCT? Expression? ( ',' Expression )* ')'
+

+

referenced by: +

+


VarOrIri:

+ + + + + Variable + + + Iri + +

+

+ +
           | Iri
+

+

referenced by: +

+


LimitClause:

+ + + + + SKW_LIMIT + + + INTEGER + +

+

+ +
         ::= SKW_LIMIT INTEGER
+

+

referenced by: +

+


OffsetClause:

+ + + + + SKW_OFFSET + + + INTEGER + +

+

+ +
         ::= SKW_OFFSET INTEGER
+

+

referenced by: +

+


RuleBodyOrRef:

+ + + + + { + + + RuleBody + + } + + + RuleRef + +

+

+ +
         ::= '{' RuleBody '}'
+
           | RuleRef
+

+

referenced by: +

+


NodeConstraint:

+ + + + + TypeConstraint + + + HasValueConstraint + + + InConstraint + + + MinExclusiveConstraint + + + MinInclusiveConstraint + + + MaxExclusiveConstraint + + + MaxInclusiveConstraint + + + MinLengthConstraint + + + MaxLengthConstraint + + + PatternConstraint + + + LessThanConstraint + + + LessThanOrEqualConstraint + + + NameAnnotation + + + DescriptionAnnotation + +

+

+ +
         ::= TypeConstraint
+
           | HasValueConstraint
+
           | InConstraint
+
           | MinExclusiveConstraint
+
           | MinInclusiveConstraint
+
           | MaxExclusiveConstraint
+
           | MaxInclusiveConstraint
+
           | MinLengthConstraint
+
           | MaxLengthConstraint
+
           | PatternConstraint
+
           | LessThanConstraint
+
           | LessThanOrEqualConstraint
+
           | NameAnnotation
+
           | DescriptionAnnotation
+

+

referenced by: +

+


PropertyConstraint:

+ + + + + HasValueConstraint + + + InConstraint + + + MinExclusiveConstraint + + + MinInclusiveConstraint + + + MaxExclusiveConstraint + + + MaxInclusiveConstraint + + + MinLengthConstraint + + + MaxLengthConstraint + + + PatternConstraint + + + LessThanConstraint + + + LessThanOrEqualConstraint + + + NameAnnotation + + + DescriptionAnnotation + + + DefaultValueAnnotation + +

+

+ +
         ::= HasValueConstraint
+
           | InConstraint
+
           | MinExclusiveConstraint
+
           | MinInclusiveConstraint
+
           | MaxExclusiveConstraint
+
           | MaxInclusiveConstraint
+
           | MinLengthConstraint
+
           | MaxLengthConstraint
+
           | PatternConstraint
+
           | LessThanConstraint
+
           | LessThanOrEqualConstraint
+
           | NameAnnotation
+
           | DescriptionAnnotation
+
           | DefaultValueAnnotation
+

+

referenced by: +

+


PropertyCount:

+ + + + + [ + + + PropertyMinCount + + .. + + + PropertyMaxCount + + ] + + +

+

+ +
         ::= '[' PropertyMinCount '..' PropertyMaxCount ']'
+

+

referenced by: +

+


PropertyMinCount:

+ + + + + INTEGER + +

+

+ +
         ::= INTEGER
+

+

referenced by: +

+


PropertyMaxCount:

+ + + + + INTEGER + + * + + +

+

+ +
         ::= INTEGER
+
           | '*'
+

+

referenced by: +

+


NodeKind:

+ + + + + BlankNode + + + IRI + + + Literal + + + BlankNodeOrIRI + + + BlankNodeOrLiteral + + + IRIOrLiteral + + +

+

+
NodeKind ::= 'BlankNode'
+
           | 'IRI'
+
           | 'Literal'
+
           | 'BlankNodeOrIRI'
+
           | 'BlankNodeOrLiteral'
+
           | 'IRIOrLiteral'
+

+

referenced by: +

+


PropertyShapeOrRef:

+ + + + + ShapeRef + + { + + + PropertyShapeBody + + } + + +

+

+ +
         ::= ShapeRef
+
           | '{' PropertyShapeBody '}'
+

+

referenced by: +

+


PropertyShapeBody:

+ + + + + path + + + Path + + + PropertyExpression + +

+

+ +
         ::= 'path'? Path PropertyExpression
+

+

referenced by: +

+


PropertyExpression:

+ + + + + PropertyOr + +

+

+ +
         ::= PropertyOr
+

+

referenced by: +

+


PropertyOr:

+ + + + + PropertyXOne + + + KW_OR + +

+

+ +
         ::= PropertyXOne ( KW_OR PropertyXOne )*
+

+

referenced by: +

+


PropertyXOne:

+ + + + + PropertyAnd + + + KW_XONE + +

+

+ +
         ::= PropertyAnd ( KW_XONE PropertyAnd )*
+

+

referenced by: +

+


PropertyAnd:

+ + + + + PropertyNot + + + KW_AND + +

+

+ +
         ::= PropertyNot ( KW_AND? PropertyNot )*
+

+

referenced by: +

+


PropertyNot:

+ + + + + KW_NOT + + + PropertyAtom + +

+

+ +
         ::= KW_NOT? PropertyAtom
+

+

referenced by: +

+


PropertyBracketted:

+ + + + + ( + + + PropertyExpression + + ) + + +

+

+ +
         ::= '(' PropertyExpression ')'
+

+

referenced by: +

+


PropertyAtom:

+ + + + + PropertyBracketted + + + Iri + + + NodeKind + + + PropertyCount + + qualified + + + PropertyCount + + shape + + + NodeShapeOrRef + + property + + + PropertyShapeOrRef + + + PropertyConstraint + + message + + + severity + + + Str + + closed + + + deactivated + + +

+

+ +
         ::= PropertyBracketted
+
           | Iri
+
           | NodeKind
+
           | PropertyCount
+
           | ( 'qualified' PropertyCount )? 'shape'? NodeShapeOrRef
+
           | 'property' PropertyShapeOrRef
+
           | PropertyConstraint
+
           | ( 'message' | 'severity' ) Str
+
           | 'closed'
+
           | 'deactivated'
+

+

referenced by: +

+


NodeShapeOrRef:

+ + + + + ShapeRef + + { + + + NodeShapeBody + + } + + +

+

+ +
         ::= ShapeRef
+
           | '{' NodeShapeBody '}'
+

+

referenced by: +

+


NodeShapeBody:

+ + + + + NodeExpression + +

+

+ +
         ::= NodeExpression
+

+

referenced by: +

+


NodeExpression:

+ + + + + NodeOr + +

+

+ +
         ::= NodeOr
+

+

referenced by: +

+


NodeOr:

+ + + + + NodeXOne + + + KW_OR + +

+

+
+

+

referenced by: +

+


NodeXOne:

+ + + + + NodeAnd + + + KW_XONE + +

+

+

+

referenced by: +

+


NodeAnd:

+ + + + + NodeNot + + + KW_AND + + . + + +

+

+
NodeAnd  ::= NodeNot ( ( KW_AND | '.' ) NodeNot )*
+

+

referenced by: +

+


NodeNot:

+ + + + + KW_NOT + + + NodeAtom + +

+

+

+

referenced by: +

+


NodeBracketted:

+ + + + + ( + + + NodeExpression + + ) + + +

+

+ +
         ::= '(' NodeExpression ')'
+

+

referenced by: +

+


NodeAtom:

+ + + + + NodeBracketted + + property + + + shape + + + ShapeRef + + + PropertyShapeBody + + rule + + + RuleBodyOrRef + + + NodeConstraint + + + NodeKind + + + SparqlConstraint + + message + + + severity + + + Str + + closed + + + deactivated + + +

+

+ +
           | ( 'property' | 'shape' )? ShapeRef
+
           | PropertyShapeBody
+
           | 'rule' RuleBodyOrRef
+
           | NodeConstraint
+
           | NodeKind
+
           | SparqlConstraint
+
           | ( 'message' | 'severity' ) Str
+
           | 'closed'
+
           | 'deactivated'
+

+

referenced by: +

+


NameAnnotation:

+ + + + + name + + + = + + + RdfLiteral + +

+

+ +
         ::= 'name' '=' RdfLiteral
+

+

referenced by: +

+


DescriptionAnnotation:

+ + + + + description + + + = + + + RdfLiteral + +

+

+ +
         ::= 'description' '=' RdfLiteral
+

+

referenced by: +

+


DefaultValueAnnotation:

+ + + + + defaultValue + + + = + + + IriOrLiteral + +

+

+ +
         ::= 'defaultValue' '=' IriOrLiteral
+

+

referenced by: +

+


TypeConstraint:

+ + + + + class + + + type + + + Iri + +

+

+ +
         ::= ( 'class' | 'type' ) Iri
+

+

referenced by: +

+


InConstraint:

+ + + + + in + + + = + + + Array + +

+

+ +
         ::= 'in' '=' Array
+

+

referenced by: +

+


HasValueConstraint:

+ + + + + hasValue + + + = + + + IriOrLiteral + +

+

+ +
         ::= 'hasValue' '=' IriOrLiteral
+

+

referenced by: +

+


MinExclusiveConstraint:

+ + + + + minExclusive + + + = + + + NumericLiteral + +

+

+ +
         ::= 'minExclusive' '=' NumericLiteral
+

+

referenced by: +

+


MinInclusiveConstraint:

+ + + + + minInclusive + + + = + + + NumericLiteral + +

+

+ +
         ::= 'minInclusive' '=' NumericLiteral
+

+

referenced by: +

+


MaxExclusiveConstraint:

+ + + + + maxExclusive + + + = + + + NumericLiteral + +

+

+ +
         ::= 'maxExclusive' '=' NumericLiteral
+

+

referenced by: +

+


MaxInclusiveConstraint:

+ + + + + maxInclusive + + + = + + + NumericLiteral + +

+

+ +
         ::= 'maxInclusive' '=' NumericLiteral
+

+

referenced by: +

+


MinLengthConstraint:

+ + + + + minLength + + + = + + + NumericLiteral + +

+

+ +
         ::= 'minLength' '=' NumericLiteral
+

+

referenced by: +

+


MaxLengthConstraint:

+ + + + + maxLength + + + = + + + NumericLiteral + +

+

+ +
         ::= 'maxLength' '=' NumericLiteral
+

+

referenced by: +

+


PatternConstraint:

+ + + + + pattern + + + = + + + Str + +

+

+ +
         ::= 'pattern' '=' Str
+

+

referenced by: +

+


LessThanConstraint:

+ + + + + < + + + Iri + +

+

+ +
         ::= '<' Iri
+

+

referenced by: +

+


LessThanOrEqualConstraint:

+ + + + + <= + + + Iri + +

+

+ +
         ::= '<=' Iri
+

+

referenced by: +

+


FN_STR:

+ + + + + STR + + + str + + +

+

+
FN_STR   ::= 'STR'
+
           | 'str'
+

+

referenced by: +

+


FN_LANG:

+ + + + + LANG + + + lang + + +

+

+
FN_LANG  ::= 'LANG'
+
           | 'lang'
+

+

referenced by: +

+


FN_LANGMATCHES:

+ + + + + LANGMATCHES + + + langmatches + + +

+

+ +
         ::= 'LANGMATCHES'
+
           | 'langmatches'
+

+

referenced by: +

+


FN_DATATYPE:

+ + + + + DATATYPE + + + datatype + + +

+

+ +
         ::= 'DATATYPE'
+
           | 'datatype'
+

+

referenced by: +

+


FN_BOUND:

+ + + + + BOUND + + + bound + + +

+

+
FN_BOUND ::= 'BOUND'
+
           | 'bound'
+

+

referenced by: +

+


FN_IRI:

+ + + + + IRI + + + iri + + +

+

+
FN_IRI   ::= 'IRI'
+
           | 'iri'
+

+

referenced by: +

+


FN_URI:

+ + + + + URI + + + uri + + +

+

+
FN_URI   ::= 'URI'
+
           | 'uri'
+

+

referenced by: +

+


FN_BNODE:

+ + + + + BNODE + + + bnode + + +

+

+
FN_BNODE ::= 'BNODE'
+
           | 'bnode'
+

+

referenced by: +

+


FN_RAND:

+ + + + + RAND + + + rand + + +

+

+
FN_RAND  ::= 'RAND'
+
           | 'rand'
+

+

referenced by: +

+


FN_CEIL:

+ + + + + CEIL + + + ceil + + +

+

+
FN_CEIL  ::= 'CEIL'
+
           | 'ceil'
+

+

referenced by: +

+


FN_FLOOR:

+ + + + + FLOOR + + + floor + + +

+

+
FN_FLOOR ::= 'FLOOR'
+
           | 'floor'
+

+

referenced by: +

+


FN_ROUND:

+ + + + + ROUND + + + round + + +

+

+
FN_ROUND ::= 'ROUND'
+
           | 'round'
+

+

referenced by: +

+


FN_CONCAT:

+ + + + + CONCAT + + + concat + + +

+

+ +
         ::= 'CONCAT'
+
           | 'concat'
+

+

referenced by: +

+


FN_SUBSTR:

+ + + + + SUBSTR + + + substr + + +

+

+ +
         ::= 'SUBSTR'
+
           | 'substr'
+

+

referenced by: +

+


FN_STRLEN:

+ + + + + STRLEN + + + strlen + + +

+

+ +
         ::= 'STRLEN'
+
           | 'strlen'
+

+

referenced by: +

+


FN_REPLACE:

+ + + + + REPLACE + + + replace + + +

+

+ +
         ::= 'REPLACE'
+
           | 'replace'
+

+

referenced by: +

+


FN_UCASE:

+ + + + + UCASE + + + ucase + + +

+

+
FN_UCASE ::= 'UCASE'
+
           | 'ucase'
+

+

referenced by: +

+


FN_LCASE:

+ + + + + LCASE + + + lcase + + +

+

+
FN_LCASE ::= 'LCASE'
+
           | 'lcase'
+

+

referenced by: +

+


FN_ENCODE_FOR_URI:

+ + + + + ENCODE_FOR_URI + + + encode_for_uri + + +

+

+ +
         ::= 'ENCODE_FOR_URI'
+
           | 'encode_for_uri'
+

+

referenced by: +

+


FN_CONTAINS:

+ + + + + CONTAINS + + + contains + + +

+

+ +
         ::= 'CONTAINS'
+
           | 'contains'
+

+

referenced by: +

+


FN_STRSTARTS:

+ + + + + STRSTARTS + + + strstarts + + +

+

+ +
         ::= 'STRSTARTS'
+
           | 'strstarts'
+

+

referenced by: +

+


FN_STRENDS:

+ + + + + STRENDS + + + strends + + +

+

+ +
         ::= 'STRENDS'
+
           | 'strends'
+

+

referenced by: +

+


FN_STRBEFORE:

+ + + + + STRBEFORE + + + strbefore + + +

+

+ +
         ::= 'STRBEFORE'
+
           | 'strbefore'
+

+

referenced by: +

+


FN_STRAFTER:

+ + + + + STRAFTER + + + strafter + + +

+

+ +
         ::= 'STRAFTER'
+
           | 'strafter'
+

+

referenced by: +

+


FN_YEAR:

+ + + + + YEAR + + + year + + +

+

+
FN_YEAR  ::= 'YEAR'
+
           | 'year'
+

+

referenced by: +

+


FN_MONTH:

+ + + + + MONTH + + + month + + +

+

+
FN_MONTH ::= 'MONTH'
+
           | 'month'
+

+

referenced by: +

+


FN_DAY:

+ + + + + DAY + + + day + + +

+

+
FN_DAY   ::= 'DAY'
+
           | 'day'
+

+

referenced by: +

+


FN_HOURS:

+ + + + + HOURS + + + hours + + +

+

+
FN_HOURS ::= 'HOURS'
+
           | 'hours'
+

+

referenced by: +

+


FN_MINUTES:

+ + + + + MINUTES + + + minutes + + +

+

+ +
         ::= 'MINUTES'
+
           | 'minutes'
+

+

referenced by: +

+


FN_SECONDS:

+ + + + + SECONDS + + + seconds + + +

+

+ +
         ::= 'SECONDS'
+
           | 'seconds'
+

+

referenced by: +

+


FN_TIMEZONE:

+ + + + + TIMEZONE + + + timezone + + +

+

+ +
         ::= 'TIMEZONE'
+
           | 'timezone'
+

+

referenced by: +

+


FN_TZ:

+ + + + + TZ + + + tz + + +

+

+
FN_TZ    ::= 'TZ'
+
           | 'tz'
+

+

referenced by: +

+


FN_NOW:

+ + + + + NOW + + + now + + +

+

+
FN_NOW   ::= 'NOW'
+
           | 'now'
+

+

referenced by: +

+


FN_UUID:

+ + + + + UUID + + + uuid + + +

+

+
FN_UUID  ::= 'UUID'
+
           | 'uuid'
+

+

referenced by: +

+


FN_STRUUID:

+ + + + + STRUUID + + + struuid + + +

+

+ +
         ::= 'STRUUID'
+
           | 'struuid'
+

+

referenced by: +

+


FN_MD5:

+ + + + + MD5 + + + md5 + + +

+

+
FN_MD5   ::= 'MD5'
+
           | 'md5'
+

+

referenced by: +

+


FN_SHA1:

+ + + + + SHA1 + + + sha1 + + +

+

+
FN_SHA1  ::= 'SHA1'
+
           | 'sha1'
+

+

referenced by: +

+


FN_SHA256:

+ + + + + SHA256 + + + sha256 + + +

+

+ +
         ::= 'SHA256'
+
           | 'sha256'
+

+

referenced by: +

+


FN_SHA384:

+ + + + + SHA384 + + + sha384 + + +

+

+ +
         ::= 'SHA384'
+
           | 'sha384'
+

+

referenced by: +

+


FN_SHA512:

+ + + + + SHA512 + + + sha512 + + +

+

+ +
         ::= 'SHA512'
+
           | 'sha512'
+

+

referenced by: +

+


FN_COALESCE:

+ + + + + COALESCE + + + coalesce + + +

+

+ +
         ::= 'COALESCE'
+
           | 'coalesce'
+

+

referenced by: +

+


FN_IF:

+ + + + + IF + + + if + + +

+

+
FN_IF    ::= 'IF'
+
           | 'if'
+

+

referenced by: +

+


FN_STRLANG:

+ + + + + STRLANG + + + strlang + + +

+

+ +
         ::= 'STRLANG'
+
           | 'strlang'
+

+

referenced by: +

+


FN_STRDT:

+ + + + + STRDT + + + strdt + + +

+

+
FN_STRDT ::= 'STRDT'
+
           | 'strdt'
+

+

referenced by: +

+


FN_SAMETERM:

+ + + + + sameTerm + + + SAMETERM + + + sameterm + + +

+

+ +
         ::= 'sameTerm'
+
           | 'SAMETERM'
+
           | 'sameterm'
+

+

referenced by: +

+


FN_ISURI:

+ + + + + isURI + + + ISURI + + + isuri + + +

+

+
FN_ISURI ::= 'isURI'
+
           | 'ISURI'
+
           | 'isuri'
+

+

referenced by: +

+


FN_ISBLANK:

+ + + + + isBLANK + + + ISBLANK + + + isblank + + +

+

+ +
         ::= 'isBLANK'
+
           | 'ISBLANK'
+
           | 'isblank'
+

+

referenced by: +

+


FN_ISLITERAL:

+ + + + + isLITERAL + + + ISLITERAL + + + isliteral + + +

+

+ +
         ::= 'isLITERAL'
+
           | 'ISLITERAL'
+
           | 'isliteral'
+

+

referenced by: +

+


FN_REGEXP:

+ + + + + REGEX + + + regexp + + +

+

+ +
         ::= 'REGEX'
+
           | 'regexp'
+

+

referenced by: +

+


FN_COUNT:

+ + + + + COUNT + + + count + + +

+

+
FN_COUNT ::= 'COUNT'
+
           | 'count'
+

+

referenced by: +

+


FN_AVG:

+ + + + + AVG + + + avg + + +

+

+
FN_AVG   ::= 'AVG'
+
           | 'avg'
+

+

referenced by: +

+


FN_MIN:

+ + + + + MIN + + + min + + +

+

+
FN_MIN   ::= 'MIN'
+
           | 'min'
+

+

referenced by: +

+


FN_MAX:

+ + + + + MAX + + + max + + +

+

+
FN_MAX   ::= 'MAX'
+
           | 'max'
+

+

referenced by: +

+


FN_GROUP_CONCAT:

+ + + + + GROUP_CONCAT + + + group_concat + + +

+

+ +
         ::= 'GROUP_CONCAT'
+
           | 'group_concat'
+

+

referenced by: +

+


FN_SEPARATOR:

+ + + + + SEPARATOR + + + separator + + +

+

+ +
         ::= 'SEPARATOR'
+
           | 'separator'
+

+

referenced by: +

+


FN_SUM:

+ + + + + SUM + + + sum + + +

+

+
FN_SUM   ::= 'SUM'
+
           | 'sum'
+

+

referenced by: +

+


FN_SAMPLE:

+ + + + + SAMPLE + + + sample + + +

+

+ +
         ::= 'SAMPLE'
+
           | 'sample'
+

+

referenced by: +

+


SKW_ASK:

+ + + + + ASK + + + ask + + +

+

+
SKW_ASK  ::= 'ASK'
+
           | 'ask'
+

+

referenced by: +

+


SKW_SELECT:

+ + + + + SELECT + + + select + + +

+

+ +
         ::= 'SELECT'
+
           | 'select'
+

+

referenced by: +

+


SKW_GRAPH:

+ + + + + GRAPH + + + graph + + +

+

+ +
         ::= 'GRAPH'
+
           | 'graph'
+

+

referenced by: +

+


SKW_OPTIONAL:

+ + + + + OPTIONAL + + + optional + + +

+

+ +
         ::= 'OPTIONAL'
+
           | 'optional'
+

+

referenced by: +

+


SKW_GROUP:

+ + + + + GROUP + + + group + + +

+

+ +
         ::= 'GROUP'
+
           | 'group'
+

+

referenced by: +

+


SKW_BIND:

+ + + + + BIND + + + bind + + +

+

+
SKW_BIND ::= 'BIND'
+
           | 'bind'
+

+

referenced by: +

+


SKW_HAVING:

+ + + + + HAVING + + + having + + +

+

+ +
         ::= 'HAVING'
+
           | 'having'
+

+

referenced by: +

+


SKW_AS:

+ + + + + AS + + + as + + +

+

+
SKW_AS   ::= 'AS'
+
           | 'as'
+

+

referenced by: +

+


SKW_ORDER:

+ + + + + ORDER + + + order + + +

+

+ +
         ::= 'ORDER'
+
           | 'order'
+

+

referenced by: +

+


SKW_UNION:

+ + + + + UNION + + + union + + +

+

+ +
         ::= 'UNION'
+
           | 'union'
+

+

referenced by: +

+


SKW_MINUS:

+ + + + + MINUS + + + minus + + +

+

+ +
         ::= 'MINUS'
+
           | 'minus'
+

+

referenced by: +

+


SKW_VALUES:

+ + + + + VALUES + + + values + + +

+

+ +
         ::= 'VALUES'
+
           | 'values'
+

+

referenced by: +

+


SKW_NAMED:

+ + + + + NAMED + + + named + + +

+

+ +
         ::= 'NAMED'
+
           | 'named'
+

+

referenced by: +

+


SKW_FROM:

+ + + + + FROM + + + from + + +

+

+
SKW_FROM ::= 'FROM'
+
           | 'from'
+

+

referenced by: +

+


SKW_BY:

+ + + + + BY + + + by + + +

+

+
SKW_BY   ::= 'BY'
+
           | 'by'
+

+

referenced by: +

+


SKW_LIMIT:

+ + + + + LIMIT + + + limit + + +

+

+ +
         ::= 'LIMIT'
+
           | 'limit'
+

+

referenced by: +

+


SKW_FILTER:

+ + + + + FILTER + + + filter + + +

+

+ +
         ::= 'FILTER'
+
           | 'filter'
+

+

referenced by: +

+


SKW_ASC:

+ + + + + ASC + + + asc + + +

+

+
SKW_ASC  ::= 'ASC'
+
           | 'asc'
+

+

referenced by: +

+


SKW_DESC:

+ + + + + DESC + + + desc + + +

+

+
SKW_DESC ::= 'DESC'
+
           | 'desc'
+

+

referenced by: +

+


SKW_EXISTS:

+ + + + + EXISTS + + + exists + + +

+

+ +
         ::= 'EXISTS'
+
           | 'exists'
+

+

referenced by: +

+


SKW_OFFSET:

+ + + + + OFFSET + + + offset + + +

+

+ +
         ::= 'OFFSET'
+
           | 'offset'
+

+

referenced by: +

+


SKW_DISTINCT:

+ + + + + DISTINCT + + + distinct + + +

+

+ +
         ::= 'DISTINCT'
+
           | 'distinct'
+

+

referenced by: +

+


SKW_REDUCED:

+ + + + + REDUCED + + + reduced + + +

+

+ +
         ::= 'REDUCED'
+
           | 'reduced'
+

+

referenced by: +

+


SKW_CONSTRUCT:

+ + + + + CONSTRUCT + + + construct + + +

+

+ +
         ::= 'CONSTRUCT'
+
           | 'construct'
+

+

referenced by: +

+


SKW_WHERE:

+ + + + + WHERE + + + where + + +

+

+ +
         ::= 'WHERE'
+
           | 'where'
+

+

referenced by: +

+


SKW_DESCRIBE:

+ + + + + DESCRIBE + + + describe + + +

+

+ +
         ::= 'DESCRIBE'
+
           | 'describe'
+

+

referenced by: +

+


SKW_NOT:

+ + + + + NOT + + + not + + +

+

+
SKW_NOT  ::= 'NOT'
+
           | 'not'
+

+

referenced by: +

+


SKW_IN:

+ + + + + IN + + + in + + +

+

+
SKW_IN   ::= 'IN'
+
           | 'in'
+

+

referenced by: +

+


SKW_SERVICE:

+ + + + + SERVICE + + + service + + +

+

+ +
         ::= 'SERVICE'
+
           | 'service'
+

+

referenced by: +

+


SKW_SILENT:

+ + + + + SILENT + + + silent + + +

+

+ +
         ::= 'SILENT'
+
           | 'silent'
+

+

referenced by: +

+


ShapeRef:

+ + + + + AT_PNAME_LN + + + AT_PNAME_NS + + + AT_IRIREF + +

+

+ +
           | AT_PNAME_NS
+
           | AT_IRIREF
+

+

referenced by: +

+


RuleRef:

+ + + + + AT_PNAME_LN + + + AT_PNAME_NS + + + AT_IRIREF + +

+

+ +
           | AT_PNAME_NS
+
           | AT_IRIREF
+

+

referenced by: +

+


TargetRef:

+ + + + + AT_PNAME_LN + + + AT_PNAME_NS + + + AT_IRIREF + +

+

+ +
         ::= AT_PNAME_LN
+
           | AT_PNAME_NS
+
           | AT_IRIREF
+

+

referenced by: +

+


FunctionRef:

+ + + + + AT_PNAME_LN + + + AT_PNAME_NS + + + AT_IRIREF + +

+

+ +
         ::= AT_PNAME_LN
+
           | AT_PNAME_NS
+
           | AT_IRIREF
+

+

no references


Path:

+ + + + + PathAlternative + +

+

+
Path     ::= PathAlternative
+

+

referenced by: +

+


PathAlternative:

+ + + + + PathSequence + + | + + +

+

+ +
         ::= PathSequence ( '|' PathSequence )*
+

+

referenced by: +

+


PathSequence:

+ + + + + PathEltOrInverse + + / + + +

+

+ +
         ::= PathEltOrInverse ( '/' PathEltOrInverse )*
+

+

referenced by: +

+


PathElt:

+ + + + + PathPrimary + + + PathMod + +

+

+

+

referenced by: +

+


PathEltOrInverse:

+ + + + + ^ + + + PathElt + +

+

+ +
         ::= '^'? PathElt
+

+

referenced by: +

+


PathMod:

+ + + + + ? + + + * + + + + + + +

+

+
PathMod  ::= '?'
+
           | '*'
+
           | '+'
+

+

referenced by: +

+


PathPrimary:

+ + + + + Iri + + a + + + ! + + + PathNegatedPropertySet + + ( + + + Path + + ) + + +

+

+ +
         ::= Iri
+
           | 'a'
+
           | '!' PathNegatedPropertySet
+
           | '(' Path ')'
+

+

referenced by: +

+


PathNegatedPropertySet:

+ + + + + PathOneInPropertySet + + ( + + + PathOneInPropertySet + + | + + + ) + + +

+

+ +
         ::= PathOneInPropertySet
+
           | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')'
+

+

referenced by: +

+


PathOneInPropertySet:

+ + + + + ^ + + + Iri + + a + + +

+

+ +
         ::= '^'? ( Iri | 'a' )
+

+

referenced by: +

+


IriOrLiteralOrArray:

+ + + + + IriOrLiteral + + + Array + +

+

+ +
         ::= IriOrLiteral
+
           | Array
+

+

no references


IriOrLiteral:

+ + + + + Iri + + + Literal + +

+

+ +
         ::= Iri
+
           | Literal
+

+

referenced by: +

+


Iri:

+ + + + + IRIREF + + + PrefixedName + + + PrefixedLabel + +

+

+
Iri      ::= IRIREF
+
           | PrefixedName
+
           | PrefixedLabel
+

+

referenced by: +

+


PrefixedName:

+ + + + + PNAME_LN + + + PNAME_NS + +

+

+ +
         ::= PNAME_LN
+
           | PNAME_NS
+

+

referenced by: +

+


PrefixedLabel:

+ + + + + LABEL_REF1 + + + LABEL_REF2 + +

+

+ +
         ::= LABEL_REF1
+
           | LABEL_REF2
+

+

referenced by: +

+


BlankNode:

+ + + + + BLANK_NODE_LABEL + + [ + + + ] + + +

+

+ +
         ::= BLANK_NODE_LABEL
+
           | '[' ']'
+

+

referenced by: +

+


Literal:

+ + + + + RdfLiteral + + + NumericLiteral + + + BooleanLiteral + +

+

+ +
           | NumericLiteral
+
           | BooleanLiteral
+

+

referenced by: +

+


BooleanLiteral:

+ + + + + true + + + false + + +

+

+ +
         ::= 'true'
+
           | 'false'
+

+

referenced by: +

+


NumericLiteral:

+ + + + + INTEGER + + + DECIMAL + + + DOUBLE + +

+

+ +
         ::= INTEGER
+
           | DECIMAL
+
           | DOUBLE
+

+

referenced by: +

+


RdfLiteral:

+ + + + + Str + + + LANGTAG + + + DTYPETAG + +

+

+ +
         ::= Str ( LANGTAG | DTYPETAG )?
+

+

referenced by: +

+


Str:

+ + + + + STRING_LITERAL_LONG1 + + + STRING_LITERAL_LONG2 + + + STRING_LITERAL1 + + + STRING_LITERAL2 + +

+

+
Str      ::= STRING_LITERAL_LONG1
+
           | STRING_LITERAL_LONG2
+
           | STRING_LITERAL1
+
           | STRING_LITERAL2
+

+

referenced by: +

+


Array:

+ + + + + [ + + + IriOrLiteral + + ] + + +

+

+
Array    ::= '[' IriOrLiteral* ']'
+

+

referenced by: +

+


Variable:

+ + + + + VAR1 + + + VAR2 + +

+

+ +
           | VAR2
+

+

referenced by: +

+


KW_AND:

+ + + + + and + + + OP_AND + +

+

+
KW_AND   ::= 'and'
+
           | OP_AND
+

+

referenced by: +

+


KW_OR:

+ + + + + or + + + OP_OR + +

+

+
KW_OR    ::= 'or'
+
           | OP_OR
+

+

referenced by: +

+


KW_XONE:

+ + + + + xone + + + xor + + + OP_XONE + +

+

+
KW_XONE  ::= 'xone'
+
           | 'xor'
+
           | OP_XONE
+

+

referenced by: +

+


KW_NOT:

+ + + + + not + + + OP_NOT + +

+

+
KW_NOT   ::= 'not'
+
           | OP_NOT
+

+

referenced by: +

+


OP_AND:

+ + + + + & + + + [#x2227] + + +

+

+
OP_AND   ::= [&#x2227]
+

+

referenced by: +

+


OP_OR:

+ + + + + | + + + [#x2228] + + +

+

+
OP_OR    ::= [|#x2228]
+

+

referenced by: +

+


OP_NOT:

+ + + + + ! + + + [#xAC] + + +

+

+
OP_NOT   ::= [!#xAC]
+

+

referenced by: +

+


OP_XONE:

+ + + + + >< + + + [#x22BB] + + + [#x2A52] + + +

+

+
OP_XONE  ::= '><'
+
           | [#x22BB#x2A52]
+

+

referenced by: +

+


VAR1:

+ + + + + ? + + + VARNAME + +

+

+
VAR1     ::= '?' VARNAME
+

+

referenced by: +

+


VAR2:

+ + + + + $ + + + VARNAME + +

+

+
VAR2     ::= '$' VARNAME
+

+

referenced by: +

+


VARNAME:

+ + + + + PN_CHARS_U + + + DIGIT + + + PN_CHARS_U + + + DIGIT + + [#xB7] + + + [#x300-#x36F] + + + [#x203F-#x2040] + + +

+

+
VARNAME  ::= ( PN_CHARS_U | DIGIT ) ( PN_CHARS_U | DIGIT | [#xB7#x300-#x36F#x203F-#x2040] )*
+

+

referenced by: +

+


PASS:

+ + + + + + + + [#x9] + + + [#xD] + + + [#xA] + + +

+

+
PASS     ::= [ #x9#xD#xA]+
+

+

no references


COMMENT:

+ + + + + # + + + [^#xD#xA] + + +

+

+
COMMENT  ::= '#' [^#xD#xA]*
+

+

no references


IRIREF:

+ + + + + < + + + [^<>"{}|^`\#x0-#x20#xAB#xBB] + + + UCHAR + + > + + +

+

+
IRIREF   ::= '<' ( [^<>"{}|^`\#x0-#x20#xAB#xBB] | UCHAR )* '>'
+

+

referenced by: +

+


LABEL_REF1:

+ + + + + [#xAB] + + + .* - ( .* #xBB .* ) + + + [#xBB] + + +

+

+ +
         ::= #xAB ( .* - ( .* #xBB .* ) ) #xBB
+

+

referenced by: +

+


LABEL_REF2:

+ + + + + << + + + .* - ( .* '>>' .* ) + + + >> + + +

+

+ +
         ::= '<<' ( .* - ( .* '>>' .* ) ) '>>'
+

+

referenced by: +

+


PNAME_NS:

+ + + + + PN_PREFIX + + : + + +

+

+
+

+

referenced by: +

+


PNAME_LN:

+ + + + + PNAME_NS + + + PN_LOCAL + +

+

+

+

referenced by: +

+


AT_PNAME_NS:

+ + + + + @ + + + PN_PREFIX + + : + + +

+

+ +
         ::= '@' PN_PREFIX? ':'
+

+

referenced by: +

+


AT_PNAME_LN:

+ + + + + @ + + + PNAME_NS + + + PN_LOCAL + +

+

+ +
         ::= '@' PNAME_NS PN_LOCAL
+

+

referenced by: +

+


AT_IRIREF:

+ + + + + @ + + + IRIREF + +

+

+ +
         ::= '@' IRIREF
+

+

referenced by: +

+


DTYPETAG:

+ + + + + ^^ + + + PNAME_NS + + + PN_LOCAL + + + IRIREF + +

+

+
+

+

referenced by: +

+


BLANK_NODE_LABEL:

+ + + + + _: + + + PN_CHARS_U + + [0-9] + + + PN_CHARS + + . + + + PN_CHARS + +

+

+ +
         ::= '_:' ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | '.' )* PN_CHARS )?
+

+

referenced by: +

+


LANGTAG:

+ + + + + @ + + + [A-Z] + + + [a-z] + + + - + + + [A-Z] + + + [a-z] + + + [0-9] + + +

+

+
LANGTAG  ::= '@' [A-Za-z]+ ( '-' [A-Za-z0-9]+ )*
+

+

referenced by: +

+


INTEGER:

+ + + + + + + + + [#x2D] + + + DIGIT + +

+

+
INTEGER  ::= [+#x2D]? DIGIT+
+

+

referenced by: +

+


DECIMAL:

+ + + + + + + + + [#x2D] + + + DIGIT + + . + + + DIGIT + +

+

+
DECIMAL  ::= [+#x2D]? DIGIT* '.' DIGIT+
+

+

referenced by: +

+


DOUBLE:

+ + + + + + + + + [#x2D] + + + DIGIT + + . + + + . + + + DIGIT + + + DIGIT + + + EXPONENT + +

+

+
DOUBLE   ::= [+#x2D]? ( DIGIT+ '.' | '.'? DIGIT ) DIGIT* EXPONENT
+

+

referenced by: +

+


UCASE_LABEL:

+ + + + + [A-Z] + + + _ + + + [A-Z] + + + _ + + + DIGIT + +

+

+ +
         ::= [A-Z_] ( [A-Z_] | DIGIT )*
+

+

no references


EXPONENT:

+ + + + + e + + + E + + + + + + + [#x2D] + + + DIGIT + +

+

+
EXPONENT ::= [eE] [+#x2D]? DIGIT+
+

+

referenced by: +

+


STRING_LITERAL1:

+ + + + + ' + + + [^'\#xA#xD] + + + ECHAR + + + UCHAR + + ' + + +

+

+ +
         ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'"
+

+

referenced by: +

+


STRING_LITERAL2:

+ + + + + " + + + [^"\#xA#xD] + + + ECHAR + + + UCHAR + + " + + +

+

+ +
         ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"'
+

+

referenced by: +

+


STRING_LITERAL_LONG1:

+ + + + + ''' + + + ' + + + '' + + + [^'\] + + + ECHAR + + + UCHAR + + ''' + + +

+

+ +
         ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
+

+

referenced by: +

+


STRING_LITERAL_LONG2:

+ + + + + """ + + + " + + + "" + + + [^"\] + + + ECHAR + + + UCHAR + + """ + + +

+

+ +
         ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
+

+

referenced by: +

+


DIGIT:

+ + + + + [0-9] + + +

+

+
DIGIT    ::= [0-9]
+

+

referenced by: +

+


UCHAR:

+ + + + + \ + + + u + + + U + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + + + HEX + +

+

+
UCHAR    ::= '\' ( 'u' | 'U' HEX HEX HEX HEX ) HEX HEX HEX HEX
+

+

referenced by: +

+


ECHAR:

+ + + + + \ + + + t + + + b + + + n + + + r + + + f + + + \ + + + " + + + ' + + +

+

+
ECHAR    ::= '\' [tbnrf\"']
+

+

referenced by: +

+


PN_CHARS_BASE:

+ + + + + [A-Z] + + + [a-z] + + + [#xC0-#xD6] + + + [#xD8-#xF6] + + + [#xF8-#x2FF] + + + [#x370-#x37D] + + + [#x37F-#x1FFF] + + + [#x200C-#x200D] + + + [#x2070-#x218F] + + + [#x2C00-#x2FEF] + + + [#x3001-#xD7FF] + + + [#xF900-#xFDCF] + + + [#xFDF0-#xFFFD] + + +

+

+ +
         ::= [A-Za-z#xC0-#xD6#xD8-#xF6#xF8-#x2FF#x370-#x37D#x37F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD]
+

+

referenced by: +

+


PN_CHARS_U:

+ + + + + PN_CHARS_BASE + + _ + + +

+

+ +
         ::= PN_CHARS_BASE
+
           | '_'
+

+

referenced by: +

+


PN_CHARS:

+ + + + + PN_CHARS_U + + - + + + [#xB7] + + + [#x300-#x36F] + + + [#x203F-#x2040] + + + DIGIT + +

+

+ +
           | [-#xB7#x300-#x36F#x203F-#x2040]
+
           | DIGIT
+

+

referenced by: +

+


PN_PREFIX:

+ + + + + PN_CHARS_BASE + + + PN_CHARS + + . + + + PN_CHARS + +

+

+ +
         ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
+

+

referenced by: +

+


PN_LOCAL:

+ + + + + PN_CHARS_U + + : + + + DIGIT + + + PLX + + + PN_CHARS + + . + + + : + + + PLX + + + PN_CHARS + + : + + + PLX + +

+

+
PN_LOCAL ::= ( PN_CHARS_U | ':' | DIGIT | PLX ) ( ( PN_CHARS | [.:] | PLX )* ( PN_CHARS | ':' | PLX ) )?
+

+

referenced by: +

+


PLX:

+ + + + + PERCENT + + + PN_LOCAL_ESC + +

+

+
PLX      ::= PERCENT
+
           | PN_LOCAL_ESC
+

+

referenced by: +

+


PERCENT:

+ + + + + % + + + HEX + + + HEX + +

+

+
PERCENT  ::= '%' HEX HEX
+

+

referenced by: +

+


HEX:

+ + + + + DIGIT + + [A-F] + + + [a-f] + + +

+

+
HEX      ::= DIGIT
+
           | [A-Fa-f]
+

+

referenced by: +

+


PN_LOCAL_ESC:

+ + + + + \ + + + _ + + + ~ + + + . + + + ! + + + $ + + + & + + + ' + + + ( + + + ) + + + * + + + + + + + , + + + ; + + + = + + + / + + + ? + + + @ + + + % + + + [#x2D] + + + [#x23] + + +

+

+ +
         ::= '\' [_~.!$&'()*+,;=/?@%#x2D#x23]
+

+

referenced by: +

+



+

+ + + + + + +
  + ... generated by RR - Railroad Diagram Generator + + + + + + + R + R +
+

+ + \ No newline at end of file diff --git a/shacl-compact-syntax/grammar/shaclc-XText.xtext b/shacl-compact-syntax/grammar/shaclc-XText.xtext new file mode 100644 index 0000000..025f62a --- /dev/null +++ b/shacl-compact-syntax/grammar/shaclc-XText.xtext @@ -0,0 +1,1284 @@ +grammar com.osthus.shapes.shaclc.SHACLC hidden(PASS, COMMENT) + +import "http://www.eclipse.org/emf/2002/Ecore" as ecore +generate sHACLC "http://www.osthus.com/shapes/shaclc/SHACLC" + +ShaclDoc: + KW_LIBRARY iri=IRIREF + (KW_VERSION versionIri=IRIREF)? + directives+=Directive* + shapes+=(NodeShape | ShapeClass | PropertyShape | RuleShape | TargetShape | FunctionShape)*; + +Directive: + baseDecl=BaseDecl | importsDecl=ImportsDecl | prefixDecl=PrefixDecl; + +BaseDecl: + KW_BASE iri=IRIREF; + +ImportsDecl: + KW_IMPORTS iri=IRIREF; + +PrefixDecl: + KW_PREFIX prefix=PNAME_NS iri=IRIREF; + +ShapeClass: + KW_SHAPE_CLASS iri=Iri ("." | "{" body=NodeShapeBody "}"); + +NodeShape: + KW_SHAPE iri=Iri (targets+=Target)* ("." | "{" body=NodeShapeBody "}"); + +PropertyShape: + KW_PROPERTY iri=Iri ("." | "{" body=PropertyShapeBody "}"); + + +RuleShape: + KW_RULE iri=Iri ("." | "{" body=RuleBody "}"); + +TargetShape: + KW_TARGET iri=Iri ("." | decl=TargetDeclaration "{" body=TargetBody "}" ); + +FunctionShape: + KW_FUNCTION iri=Iri ("." | decl=FunctionDeclaration "{" body=FunctionBody "}"); + +Target: + TargetClasses + | TargetNodes + | TargetTargets + | TargetSubjectsOf + | TargetObjectsOf + | TargetSelect; + +TargetClasses: + OP_TARGETS classes+=Iri (',' classes+=Iri)*; + +TargetSubjectsOf: + OP_TARGETS_SUBJECTS properties+=Iri (',' properties+=Iri)*; + +TargetObjectsOf: + OP_TARGETS_OBJECTS properties+=Iri (',' properties+=Iri)*; + +TargetSelect: + OP_TARGETS select=SelectQuery; + +TargetNodes: + OP_TARGETS nodes=Array; + +TargetTargets: + OP_TARGETS targets+=TargetCall (',' targets+=TargetCall)*; + +TargetCall: + target=TargetRef parameters=ParameterAssignments?; + + +RuleBody: + {RuleBody} + sparql=ConstructQuery + (KW_CONDITION condition=NodeShapeOrRef)? + (KW_PRIORITY order=INTEGER)? + ; + +TargetBody: + (KW_LABEL lbl=Str)? + select=SelectQuery + ; + +TargetDeclaration: '(' formalParameters+=ParameterDeclaration (',' formalParameters+=ParameterDeclaration)* ')'; + +FunctionDeclaration: '(' formalParameters+=ParameterDeclaration (',' formalParameters+=ParameterDeclaration)* ')' + (KW_RETURNS returnType=Iri)?; + +FunctionBody: + select=SelectQuery + ; + +ParameterDeclaration: + optional?=KW_OPTIONAL? KW_PARAMETER? + param=Iri + valueKind=NodeKind? + valueType=Iri? + (KW_ORDER order=INTEGER)?; + +ParameterAssignment: + param=Iri value=IriOrLiteral; + +ParameterAssignments: + '(' assignments+=ParameterAssignment (',' assignments+=ParameterAssignment)* ')'; + +SparqlConstraint: + select=SelectQuery | ask=AskQuery; + +SelectQuery: + select=SelectClause datasets+=DatasetClause* where=WhereClause modifier=SolutionModifier; + +DescribeQuery: + SKW_DESCRIBE (varOrIris+=VarOrIri+ | all?='*') datasets+=DatasetClause* where=WhereClause modifier=SolutionModifier; + +SelectClause: + SKW_SELECT (distinct?=SKW_DISTINCT | reduced?=SKW_REDUCED)? + (selects+=SelectItem+ + | all?='*'); + +SelectItem: + variable=Variable + | '(' expr=Expression SKW_AS variable=Variable ')'; + +AskQuery: + SKW_ASK datasets+=DatasetClause* where=WhereClause; + +DatasetClause: + SKW_FROM (graph=IRIREF | named?=SKW_NAMED graph=IRIREF); + +WhereClause: + SKW_WHERE? pattern=GroupGraphPattern; + +SolutionModifier: + {SolutionModifier} groupBy=GroupClause? having=HavingClause? orderBy=OrderClause? ((limit=LimitClause + offset=OffsetClause?) | (offset=OffsetClause limit=LimitClause?))?; + +ConstructQuery: + SKW_CONSTRUCT construct=ConstructTemplate datasets+=DatasetClause* where=WhereClause modifier=SolutionModifier; + +ConstructTemplate: + {ConstructTemplate} '{' triples+=TriplesSameSubject ('.' triples+=TriplesSameSubject?)* '}'; + +TriplesSameSubject: + varOrTerm=VarOrTerm pListNotEmpty=PropertyListNotEmpty + | node=TriplesNode pList=PropertyList; + +TriplesSameSubjectPath: + varOrTerm=VarOrTerm pListNotEmpty=PropertyListPathNotEmpty + | node=TriplesNodePath pList=PropertyListPath; + +OrderClause: + SKW_ORDER SKW_BY conditions+=OrderCondition+; + +OrderCondition: + ((asc?=SKW_ASC | desc?=SKW_DESC) expr=BrackettedExpression) + | (constraint=Constraint | variable=Variable); + +ValuesClause: + {ValuesClause} (SKW_VALUES data=DataBlock)?; + +DataBlock: + DataBlockOneVar + | DataBlockFull; + +DataBlockOneVar: + variable=Variable '{' values+=DataBlockValue* '}'; + +DataBlockFull: + {DataBlockFull} '(' variables+=Variable* ')' '{' dataBlockValues+=DataBlockValues* '}'; + +DataBlockValue: + iri=Iri | literal=Literal | undef?='UNDEF'; + +DataBlockValues: + {DataBlockValues} ('(' values+=DataBlockValue* ')'); + +GroupClause: + SKW_GROUP SKW_BY conditions+=GroupCondition+; + +GroupCondition: + biCall=BuiltInCall + | fnCall=FunctionCall + | '(' expr=Expression (SKW_AS variable=Variable)? ')' + | variable=Variable; + +HavingClause: + SKW_HAVING conditions+=HavingCondition; + +HavingCondition: + constraint=Constraint; + +Constraint: + expr=BrackettedExpression | biCall=BuiltInCall | fnCall=FunctionCall; + +GroupGraphPattern: + {GroupGraphPattern} '{' (subSelect=SubSelect | triples=TriplesBlock? parts+=GraphPatternPart*) '}'; + +GraphPatternPart: + notTriples=GraphPatternNotTriples '.'? triples=TriplesBlock?; + +SubSelect: + select=SelectClause where=WhereClause modifier=SolutionModifier values=ValuesClause; + +GraphPatternNotTriples: + union=UnionGraphPattern + | optional=OptionalGraphPattern + | minus=MinusGraphPattern + | graph=GraphGraphPattern + // | service=ServiceGraphPattern + | filter=Filter + | bind=Bind + | inlineData=InlineData; + +Bind: + SKW_BIND '(' expr=Expression SKW_AS variable=Variable ')'; + +InlineData: + SKW_VALUES data=DataBlock; + +MinusGraphPattern: + SKW_MINUS pattern=GroupGraphPattern; + +OptionalGraphPattern: + SKW_OPTIONAL pattern=GroupGraphPattern; + +GraphGraphPattern: + SKW_GRAPH varOrIri=VarOrIri pattern=GroupGraphPattern; + +UnionGraphPattern: + pattern+=GroupGraphPattern (SKW_UNION pattern+=GroupGraphPattern)*; + +ServiceGraphPattern: + SKW_SERVICE silent?=SKW_SILENT? varOrIri=VarOrIri pattern=GroupGraphPattern; + +TriplesBlock: + triples+=TriplesSameSubjectPath ('.' triples+=TriplesSameSubjectPath?)*; + +Filter: + SKW_FILTER constraint=Constraint; + +PropertyListPathNotEmpty: + poListPath=PathObjectListPath (';' poList+=PathObjectList?)*; + +PathOrVariable: + path=Path | variable=Variable; + +PropertyListPath: + {PropertyListPath} + notEmpty=PropertyListPathNotEmpty?; + +PathObjectList: + pathOrVar=PathOrVariable objList=ObjectList; + +PathObjectListPath: + pathOrVar=PathOrVariable objListPath=ObjectListPath; + +PropertyListNotEmpty: + voList+=VerbObjectList (';' voList+=VerbObjectList?)*; + +PropertyList: + {PropertyList} + notEmpty=PropertyListNotEmpty?; + +VerbObjectList: + verb=Verb objList=ObjectList; + +Verb: + varOrIri=VarOrIri + | rdftype?='a'; + +ObjectList: + objects+=Object (',' objects+=Object)*; + +ObjectListPath: + objects+=ObjectPath (',' objects+=ObjectPath)*; + +Object: + node=GraphNode; + +ObjectPath: + node=GraphNodePath; + +Collection: + '(' nodes+=GraphNode+ ')'; + +CollectionPath: + '(' nodes+=GraphNodePath+ ')'; + +GraphNode: + varOrTerm=VarOrTerm + | node=TriplesNode; + +GraphNodePath: + varOrTerm=VarOrTerm + | node=TriplesNodePath; + +TriplesNode: + coll=Collection + | bnodePList=BlankNodePropertyList; + +TriplesNodePath: + coll=CollectionPath + | bnodePList=BlankNodePropertyListPath; + +BlankNodePropertyList: + '[' pList=PropertyListNotEmpty ']'; + +BlankNodePropertyListPath: + '[' pList=PropertyListPathNotEmpty ']'; + +VarOrTerm: + variable=Variable + | term=GraphTerm; + +GraphTerm: + iri=Iri + | literal=RdfLiteral + | literal=NumericLiteral + | literal=BooleanLiteral + | bnode=BlankNode + | nil?='(' ')'; + +BuiltInCall: + fn=FN_STR '(' expr+=Expression ')' + | fn=FN_LANG '(' expr+=Expression ')' + | fn=FN_LANGMATCHES '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_DATATYPE '(' expr+=Expression ')' + | fn=FN_BOUND '(' variable=Variable ')' + | fn=FN_IRI '(' expr+=Expression ')' + | fn=FN_URI '(' expr+=Expression ')' + | fn=FN_BNODE '(' expr+=Expression? ')' + | fn=FN_RAND '(' expr+=Expression ')' + | fn=FN_CEIL '(' expr+=Expression ')' + | fn=FN_FLOOR '(' expr+=Expression ')' + | fn=FN_ROUND '(' expr+=Expression ')' + | fn=FN_CONCAT '(' expr+=Expression (',' expr+=Expression)* ')' + | fn=FN_SUBSTR '(' expr+=Expression ',' expr+=Expression (',' expr+=Expression)? ')' + | fn=FN_STRLEN '(' expr+=Expression ')' + | fn=FN_REPLACE '(' expr+=Expression ',' expr+=Expression ',' expr+=Expression (',' expr+=Expression)? ')' + | fn=FN_UCASE '(' expr+=Expression ')' + | fn=FN_LCASE '(' expr+=Expression ')' + | fn=FN_ENCODE_FOR_URI '(' expr+=Expression ')' + | fn=FN_CONTAINS '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRSTARTS '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRENDS '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRBEFORE '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRAFTER '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_YEAR '(' expr+=Expression ')' + | fn=FN_MONTH '(' expr+=Expression ')' + | fn=FN_DAY '(' expr+=Expression ')' + | fn=FN_HOURS '(' expr+=Expression ')' + | fn=FN_MINUTES '(' expr+=Expression ')' + | fn=FN_SECONDS '(' expr+=Expression ')' + | fn=FN_TIMEZONE '(' expr+=Expression ')' + | fn=FN_TZ '(' expr+=Expression ')' + | fn=FN_NOW '(' ')' + | fn=FN_UUID '(' ')' + | fn=FN_STRUUID '(' ')' + | fn=FN_MD5 '(' expr+=Expression ')' + | fn=FN_SHA1 '(' expr+=Expression ')' + | fn=FN_SHA256 '(' expr+=Expression ')' + | fn=FN_SHA384 '(' expr+=Expression ')' + | fn=FN_SHA512 '(' expr+=Expression ')' + | fn=FN_COALESCE '(' expr+=Expression (',' expr+=Expression)* ')' + | fn=FN_IF '(' expr+=Expression ',' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRLANG '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_STRDT '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_SAMETERM '(' expr+=Expression ',' expr+=Expression ')' + | fn=FN_ISIRI '(' expr+=Expression ')' + | fn=FN_ISURI '(' expr+=Expression ')' + | fn=FN_ISBLANK '(' expr+=Expression ')' + | fn=FN_ISLITERAL '(' expr+=Expression ')' + | fn=FN_REGEXP '(' expr+=Expression ',' expr+=Expression (',' expr+=Expression)? ')' + | exist=ExistsFunc + | notExist=NotExistsFunc + | aggregate=Aggregate; + +ExistsFunc: + SKW_EXISTS pattern=GroupGraphPattern; + +NotExistsFunc: + SKW_NOT SKW_EXISTS pattern=GroupGraphPattern; + +Aggregate: + fn=FN_COUNT '(' distinct?=SKW_DISTINCT? (all?='*' | expr=Expression) ')' + | fn=FN_SUM '(' distinct?=SKW_DISTINCT? expr=Expression ')' + | fn=FN_MIN '(' distinct?=SKW_DISTINCT? expr=Expression ')' + | fn=FN_MAX '(' distinct?=SKW_DISTINCT? expr=Expression ')' + | fn=FN_SAMPLE '(' distinct?=SKW_DISTINCT? expr=Expression ')' + | fn=FN_AVG '(' distinct?=SKW_DISTINCT? expr=Expression ')' + | fn=FN_GROUP_CONCAT '(' distinct?=SKW_DISTINCT? expr=Expression (';' FN_SEPARATOR '=' sep=Str)? ')'; + +Expression: + expr=ConditionalOrExpression; + +ConditionalOrExpression: + expr+=ConditionalAndExpression ('||' expr+=ConditionalAndExpression)*; + +ConditionalAndExpression: + expr+=ValueLogical ('&&' expr+=ValueLogical)*; + +ValueLogical: + expr=RelationalExpression; + +RelationalExpression: + expr+=NumericExpression + (op='=' expr+=NumericExpression + | op='!=' expr+=NumericExpression + | op='<' expr+=NumericExpression + | op='>' expr+=NumericExpression + | op='<=' expr+=NumericExpression + | op='>=' expr+=NumericExpression + | notIn?=SKW_NOT SKW_IN exprList=ExpressionList + | in?=SKW_IN exprList=ExpressionList)?; + +ExpressionList: + {ExpressionList} '(' expr+=Expression? (',' expr+=Expression)* ')'; + +NumericExpression: + expr=AdditiveExpression; + +AdditiveExpression: + expr=MultiplicativeExpression terms+=AdditiveTerm*; + +AdditiveTerm: + op='+' expr=MultiplicativeExpression + | op='-' expr=MultiplicativeExpression + | num=NumericLiteral terms+=MultiplicativeTerm*; + +MultiplicativeExpression: + expr=UnaryExpression terms+=MultiplicativeTerm*; + +MultiplicativeTerm: + op+='*' expr=UnaryExpression + | op+='/' expr=UnaryExpression; + +UnaryExpression: + op='!' expr=PrimaryExpression + | op='+' expr=PrimaryExpression + | op='-' expr=PrimaryExpression + | expr=PrimaryExpression; + +PrimaryExpression: + expr=BrackettedExpression + | biCall=BuiltInCall + | iriOrFunction=IriOrFunction + | literal=Literal + | variable=Variable; + +BrackettedExpression: + '(' expr=Expression ')'; + +IriOrFunction: + iri=Iri argList=ArgList?; + +FunctionCall: + iri=Iri argList=ArgList; + +ArgList: + {ArgList} '(' distinct?=SKW_DISTINCT? args+=Expression? (',' args+=Expression)* ')'; + +VarOrIri: + variable=Variable + | iri=Iri; + +LimitClause: + SKW_LIMIT value=INTEGER; + +OffsetClause: + SKW_OFFSET value=INTEGER; + +RuleBodyOrRef: + "{" body=RuleBody "}" + | ref=RuleRef; + +NodeConstraint: + TypeConstraint + | HasValueConstraint + | InConstraint + | MinExclusiveConstraint + | MinInclusiveConstraint + | MaxExclusiveConstraint + | MaxInclusiveConstraint + | MinLengthConstraint + | MaxLengthConstraint + | PatternConstraint + | LessThanConstraint + | LessThanOrEqualConstraint + | NameAnnotation + | DescriptionAnnotation + ; + + + +PropertyConstraint: + HasValueConstraint + | InConstraint + | MinExclusiveConstraint + | MinInclusiveConstraint + | MaxExclusiveConstraint + | MaxInclusiveConstraint + | MinLengthConstraint + | MaxLengthConstraint + | PatternConstraint + | LessThanConstraint + | LessThanOrEqualConstraint + | NameAnnotation + | DescriptionAnnotation + | DefaultValueAnnotation + ; + + + + +PropertyCount: + '[' min=PropertyMinCount OP_RANGE max=PropertyMaxCount ']'; + +PropertyMinCount: + INTEGER; + +PropertyMaxCount: + (INTEGER | '*'); + + +NodeKind: + 'BlankNode' | 'IRI' | 'Literal' | 'BlankNodeOrIRI' | 'BlankNodeOrLiteral' | 'IRIOrLiteral'; + + +PropertyShapeOrRef: ref=ShapeRef + | "{" body=PropertyShapeBody "}" + ; + +PropertyShapeBody : => (KW_PATH? path=Path) expr=PropertyExpression; +PropertyExpression: expr=PropertyOr; +PropertyOr: list+=PropertyXOne (=> KW_OR list+=PropertyXOne)*; +PropertyXOne: list+=PropertyAnd (=> KW_XONE list+=PropertyAnd)*; +PropertyAnd: list+=PropertyNot (=> (KW_AND list+=PropertyNot) + |list+=PropertyNot)*; +PropertyNot: negation?=(KW_NOT)? => atom=PropertyAtom; +PropertyBracketted: "(" =>expr=PropertyExpression ")"; +PropertyAtom: + =>expr=PropertyBracketted + | =>type=Iri + | =>nodeKind=NodeKind + | =>count=PropertyCount + | =>(qualified?=KW_QUALIFIED qualifiedCount=PropertyCount)? (KW_SHAPE)? shape=NodeShapeOrRef + | =>KW_PROPERTY propertyShape=PropertyShapeOrRef + | =>propertyConstraint=PropertyConstraint + | =>KW_MESSAGE message=Str + | =>KW_SEVERITY severity=Str + | =>closed?=KW_CLOSED + | =>deactivated?=KW_DEACTIVATED + ; + +NodeShapeOrRef: + ref=ShapeRef + | "{" body= NodeShapeBody "}" + ; + +NodeShapeBody : expr=NodeExpression; +NodeExpression: expr=NodeOr; +NodeOr: list+=NodeXOne (=> KW_OR list+=NodeXOne)*; +NodeXOne: list+=NodeAnd (=> KW_XONE list+=NodeAnd)*; +NodeAnd: list+=NodeNot (=> (KW_AND | '.') list+=NodeNot)*; +NodeNot: negation?=KW_NOT? atom=NodeAtom; +NodeBracketted: "(" expr=NodeExpression ")"; +NodeAtom: + expr=NodeBracketted + | KW_PROPERTY propertyShapeRef=ShapeRef + | KW_SHAPE? shapeRef=ShapeRef + | propertyShape=PropertyShapeBody + | KW_RULE rule=RuleBodyOrRef + | nodeConstraint=NodeConstraint + | nodeKind=NodeKind + | sparql=SparqlConstraint + | KW_MESSAGE message=Str + | KW_SEVERITY severity=Str + | closed?=KW_CLOSED + | deactivated?=KW_DEACTIVATED + ; + + +/* key/value constraints */ + + + +NameAnnotation: + param=KW_NAME '=' value=RdfLiteral +; + +DescriptionAnnotation: + param=KW_DESCRIPTION '=' value=RdfLiteral +; + +DefaultValueAnnotation: + param=KW_DEFAULT_VALUE '=' value=IriOrLiteral +; + +TypeConstraint: + param=(KW_CLASS|KW_TYPE) value=Iri + ; + +InConstraint: + param=KW_IN '=' value=Array; + +HasValueConstraint: + param=KW_HAS_VALUE '=' value=IriOrLiteral; + +MinExclusiveConstraint: + param=KW_MIN_EXCLUSIVE '=' value=NumericLiteral; + +MinInclusiveConstraint: + param=KW_MIN_INCLUSIVE '=' value=NumericLiteral; + +MaxExclusiveConstraint: + param=KW_MAX_EXCLUSIVE '=' value=NumericLiteral; + +MaxInclusiveConstraint: + param=KW_MAX_INCLUSIVE '=' value=NumericLiteral; + +MinLengthConstraint: + param=KW_MIN_LENGTH '=' value=NumericLiteral; + +MaxLengthConstraint: + param=KW_MAX_LENGTH '=' value=NumericLiteral; + +PatternConstraint: + param=KW_PATTERN '=' value=Str; + +LessThanConstraint: + param=KW_LESS_THAN predicate=Iri; + +LessThanOrEqualConstraint: + param=KW_LESS_THAN_OR_EQUAL predicate=Iri; + +FN_STR: + 'STR' | 'str'; + +FN_LANG: + 'LANG' | 'lang'; + +FN_LANGMATCHES: + 'LANGMATCHES' | 'langmatches'; + +FN_DATATYPE: + 'DATATYPE' | 'datatype'; + +FN_BOUND: + 'BOUND' | 'bound'; + +FN_IRI: + 'IRI' | 'iri'; + +FN_URI: + 'URI' | 'uri'; + +FN_BNODE: + 'BNODE' | 'bnode'; + +FN_RAND: + 'RAND' | 'rand'; + +FN_CEIL: + 'CEIL' | 'ceil'; + +FN_FLOOR: + 'FLOOR' | 'floor'; + +FN_ROUND: + 'ROUND' | 'round'; + +FN_CONCAT: + 'CONCAT' | 'concat'; + +FN_SUBSTR: + 'SUBSTR' | 'substr'; + +FN_STRLEN: + 'STRLEN' | 'strlen'; + +FN_REPLACE: + 'REPLACE' | 'replace'; + +FN_UCASE: + 'UCASE' | 'ucase'; + +FN_LCASE: + 'LCASE' | 'lcase'; + +FN_ENCODE_FOR_URI: + 'ENCODE_FOR_URI' | 'encode_for_uri'; + +FN_CONTAINS: + 'CONTAINS' | 'contains'; + +FN_STRSTARTS: + 'STRSTARTS' | 'strstarts'; + +FN_STRENDS: + 'STRENDS' | 'strends'; + +FN_STRBEFORE: + 'STRBEFORE' | 'strbefore'; + +FN_STRAFTER: + 'STRAFTER' | 'strafter'; + +FN_YEAR: + 'YEAR' | 'year'; + +FN_MONTH: + 'MONTH' | 'month'; + +FN_DAY: + 'DAY' | 'day'; + +FN_HOURS: + 'HOURS' | 'hours'; + +FN_MINUTES: + 'MINUTES' | 'minutes'; + +FN_SECONDS: + 'SECONDS' | 'seconds'; + +FN_TIMEZONE: + 'TIMEZONE' | 'timezone'; + +FN_TZ: + 'TZ' | 'tz'; + +FN_NOW: + 'NOW' | 'now'; + +FN_UUID: + 'UUID' | 'uuid'; + +FN_STRUUID: + 'STRUUID' | 'struuid'; + +FN_MD5: + 'MD5' | 'md5'; + +FN_SHA1: + 'SHA1' | 'sha1'; + +FN_SHA256: + 'SHA256' | 'sha256'; + +FN_SHA384: + 'SHA384' | 'sha384'; + +FN_SHA512: + 'SHA512' | 'sha512'; + +FN_COALESCE: + 'COALESCE' | 'coalesce'; + +FN_IF: + 'IF' | 'if'; + +FN_STRLANG: + 'STRLANG' | 'strlang'; + +FN_STRDT: + 'STRDT' | 'strdt'; + +FN_SAMETERM: + 'sameTerm' | 'SAMETERM' | 'sameterm'; + +FN_ISIRI: + 'isIRI'; + +FN_ISURI: + 'isURI' | 'ISURI' | 'isuri'; + +FN_ISBLANK: + 'isBLANK' | 'ISBLANK' | 'isblank'; + +FN_ISLITERAL: + 'isLITERAL' | 'ISLITERAL' | 'isliteral'; + +FN_REGEXP: + 'REGEX' | 'regexp'; + +FN_COUNT: + 'COUNT' | 'count'; + +FN_AVG: + 'AVG' | 'avg'; + +FN_MIN: + 'MIN' | 'min'; + +FN_MAX: + 'MAX' | 'max'; + +FN_GROUP_CONCAT: + 'GROUP_CONCAT' | 'group_concat'; + +FN_SEPARATOR: + 'SEPARATOR' | 'separator'; + +FN_SUM: + 'SUM' | 'sum'; + +FN_SAMPLE: + 'SAMPLE' | 'sample'; + +SKW_ASK: + 'ASK' | 'ask'; + +SKW_SELECT: + 'SELECT' | 'select'; + +SKW_GRAPH: + 'GRAPH' | 'graph'; + +SKW_OPTIONAL: + 'OPTIONAL' | 'optional'; + +SKW_GROUP: + 'GROUP' | 'group'; + +SKW_BIND: + 'BIND' | 'bind'; + +SKW_HAVING: + 'HAVING' | 'having'; + +SKW_AS: + 'AS' | 'as'; + +SKW_ORDER: + 'ORDER' | 'order'; + +SKW_UNION: + 'UNION' | 'union'; + +SKW_MINUS: + 'MINUS' | 'minus'; + +SKW_VALUES: + 'VALUES' | 'values'; + +SKW_NAMED: + 'NAMED' | 'named'; + +SKW_FROM: + 'FROM' | 'from'; + +SKW_BY: + 'BY' | 'by'; + +SKW_LIMIT: + 'LIMIT' | 'limit'; + +SKW_FILTER: + 'FILTER' | 'filter'; + +SKW_ASC: + 'ASC' | 'asc'; + +SKW_DESC: + 'DESC' | 'desc'; + +SKW_EXISTS: + 'EXISTS' | 'exists'; + +SKW_OFFSET: + 'OFFSET' | 'offset'; + +SKW_DISTINCT: + 'DISTINCT' | 'distinct'; + +SKW_REDUCED: + 'REDUCED' | 'reduced'; + +SKW_CONSTRUCT: + 'CONSTRUCT' | 'construct'; + +SKW_WHERE: + 'WHERE' | 'where'; + +SKW_DESCRIBE: + 'DESCRIBE' | 'describe'; + +SKW_NOT: + 'NOT' | 'not'; + +SKW_IN: + 'IN' | 'in'; + +SKW_SERVICE: + 'SERVICE' | 'service'; + +SKW_SILENT: + 'SILENT' | 'silent'; + +KW_DEACTIVATED: + 'deactivated'; + +KW_IN: + 'in'; + +KW_HAS_VALUE: + 'hasValue'; + +KW_MIN_EXCLUSIVE: + 'minExclusive'; + +KW_MIN_INCLUSIVE: + 'minInclusive'; + +KW_MAX_EXCLUSIVE: + 'maxExclusive'; + +KW_MAX_INCLUSIVE: + 'maxInclusive'; + +KW_MIN_LENGTH: + 'minLength'; + +KW_MAX_LENGTH: + 'maxLength'; + +KW_PATTERN: + 'pattern'; + +KW_LESS_THAN: + '<'; + +KW_LESS_THAN_OR_EQUAL: + '<='; + +KW_QUALIFIED: + 'qualified'; + +KW_CLOSED: + 'closed'; + +KW_PATH: 'path'; + +KW_MESSAGE: + 'message'; + +KW_NAME: + 'name'; + +KW_GROUP: + 'group'; + +KW_DESCRIPTION: + 'description'; + + +KW_SEVERITY: + 'severity'; + +KW_ORDER: + 'order'; + +KW_PRIORITY: + 'priority'; + + +KW_RULE: + 'rule'; + +KW_CLASS: + 'class'; + +KW_PROPERTY: + 'property'; + + +KW_CONDITION: + 'if'; + +KW_VALIDATOR: + 'validator'; + +KW_TARGET: + 'target'; + +KW_RETURNS: + 'returns'; + +KW_FUNCTION: + 'function'; + +KW_RESULT: + 'result'; + +KW_PARAMETER: + 'parameter'; + +KW_TYPE: + 'type'; + +KW_LABEL: + 'label'; + +KW_DEFAULT_VALUE: + 'defaultValue'; + +KW_OPTIONAL: + 'optional'; + + +ShapeRef: + AT_PNAME_LN | AT_PNAME_NS | AT_IRIREF; + +RuleRef: + AT_PNAME_LN | AT_PNAME_NS | AT_IRIREF; + +TargetRef: + AT_PNAME_LN | AT_PNAME_NS | AT_IRIREF; + +FunctionRef: + AT_PNAME_LN | AT_PNAME_NS | AT_IRIREF; + +Path: + PathAlternative; + +PathAlternative: + list+=PathSequence (=> '|' list+=PathSequence)*; + +PathSequence: + list+=PathEltOrInverse (=> '/' list+=PathEltOrInverse)*; + +PathElt: + primary=PathPrimary pathMod=PathMod?; + +PathEltOrInverse: + inverse?=PathInverse? element=PathElt; + +PathInverse: + '^'; + +PathMod: + '?' | '*' | '+'; + +PathPrimary: + iri=Iri + | rdftype?='a' + | '!' negatedSet=PathNegatedPropertySet + | => '(' path=Path ')'; + +PathNegatedPropertySet: + negated+=PathOneInPropertySet + | {PathNegatedPropertySet} '(' (negated+=PathOneInPropertySet (=> '|' negated+=PathOneInPropertySet)*)? ')'; + +PathOneInPropertySet: + inverse?=PathInverse? (iri=Iri | rdftype?='a'); + +IriOrLiteralOrArray: + {IriOrLiteralOrArray} iriOrLiteral=IriOrLiteral | array=Array; + +IriOrLiteral: + {IriOrLiteral} iri=Iri | literal=Literal; + +Iri: + iri=IRIREF | pname=PrefixedName | label=PrefixedLabel; + +PrefixedName: + PNAME_LN | PNAME_NS; + +PrefixedLabel: + LABEL_REF1 | LABEL_REF2; + +BlankNode: + BLANK_NODE_LABEL + | '[' ']'; + +Literal: + RdfLiteral + | NumericLiteral + | BooleanLiteral; + +BooleanLiteral: + value=KW_TRUE | value=KW_FALSE; + +NumericLiteral: + value=INTEGER | value=DECIMAL | value=DOUBLE; + +RdfLiteral: + value=Str (lang=LANGTAG | dtype=DTYPETAG)?; + +Str: + STRING_LITERAL_LONG1 + | STRING_LITERAL_LONG2 + | STRING_LITERAL1 + | STRING_LITERAL2; + +Array: + {Array} '[' list+=IriOrLiteral* ']'; + +Variable: + VAR1 | VAR2; + + // Keywords +KW_LIBRARY: + 'LIBRARY'; + +KW_VERSION: + 'VERSION'; + +KW_BASE: + 'BASE'; + +KW_IMPORTS: + 'IMPORTS'; + +KW_PREFIX: + 'PREFIX'; + +KW_SHAPE_CLASS: + 'shapeClass'; + +KW_SHAPE: + 'shape'; + +KW_TRUE: + 'true'; + +KW_FALSE: + 'false'; + +KW_AND: + 'and' | OP_AND; + +KW_OR: + 'or' | OP_OR; + +KW_XONE: + 'xone' | 'xor' | OP_XONE; + +KW_NOT: + 'not' | OP_NOT ; + + // Terminals +terminal OP_AND: + '&' | '\u2227'; + +terminal OP_OR: + '|' | '\u2228'; + +terminal OP_NOT: + '!' | '\u00AC'; + +terminal OP_XONE: + '><' | '\u22BB' | '\u2A52'; + +terminal OP_RANGE: + '..'; + +terminal OP_TARGETS: + '->'; + +terminal OP_TARGETS_SUBJECTS: + '*->'; + +terminal OP_TARGETS_OBJECTS: + '->*'; + +terminal VAR1: + '?' VARNAME; + +terminal VAR2: + '$' VARNAME; + +terminal VARNAME: + (PN_CHARS_U | DIGIT) (PN_CHARS_U | DIGIT | '\u00B7' | ('\u0300'..'\u036F') | ('\u203F'..'\u2040'))*; + +terminal PASS: + (' ' | '\t' | '\r' | '\n')+; + +terminal COMMENT: + '#' (!('\r' | '\n'))*; + +terminal IRIREF: + '<' (!('\u0000'..'\u0020' | '\u00ab' | '\u00bb' | '<' | '>' | '\"' | '{' | '}' | '|' | '^' | '`' | '\\') | UCHAR)* + '>'; /* #x00=NULL #01-#x1F=control codes #x20=space */ +terminal LABEL_REF1: + '\u00ab'->'\u00bb'; + +terminal LABEL_REF2: + '<<'->'>>'; + +terminal PNAME_NS: + PN_PREFIX? ':'; + +terminal PNAME_LN: + PNAME_NS PN_LOCAL; + +terminal AT_PNAME_NS: + AT PN_PREFIX? ':'; + +terminal AT_PNAME_LN: + AT PNAME_NS PN_LOCAL; + +terminal AT_IRIREF: + AT IRIREF; + +terminal DTYPETAG: + '^^' (PNAME_NS PN_LOCAL | IRIREF); + +terminal BLANK_NODE_LABEL: + '_:' (PN_CHARS_U | ('0'..'9')) ((PN_CHARS | '.')* PN_CHARS)?; + +terminal LANGTAG: + AT ('A'..'Z' | 'a'..'z')+ ('-' ('A'..'Z' | 'a'..'z' | '0'..'9')+)*; + +terminal INTEGER: + ('+' | '-')? DIGIT+; + +terminal DECIMAL: + ('+' | '-')? DIGIT* '.' DIGIT+; + +terminal DOUBLE: + ('+' | '-')? (DIGIT+ '.' DIGIT* EXPONENT | '.'? DIGIT+ EXPONENT); + +terminal UCASE_LABEL: + ('A'..'Z' | '_') ('A'..'Z' | '_' | DIGIT)*; + +terminal fragment EXPONENT: + ('e' | 'E') ('+' | '-')? DIGIT+; + +terminal STRING_LITERAL1: + '\'' (!('\u0027' | '\u005C' | '\u000A' | '\u000D') | ECHAR | UCHAR)* '\''; +/* #x27=' #x5C=\ #xA=new line #xD=carriage return */ +terminal STRING_LITERAL2: + '"' (!('\u0022' | '\u005C' | '\u000A' | '\u000D') | ECHAR | UCHAR)* '"'; +/* #x22=" #x5C=\ #xA=new line #xD=carriage return */ +terminal STRING_LITERAL_LONG1: + '\'\'\'' (('\'' | '\'\'')? (!('\'' | ('\\')) | ECHAR | UCHAR))* '\'\'\''; + +terminal STRING_LITERAL_LONG2: + '"""' (('"' | '""')? (!('\"' | ('\\')) | ECHAR | UCHAR))* '"""'; + +terminal fragment AT: + '@'; + +terminal fragment DIGIT: + '0'..'9'; + +terminal fragment UCHAR: + ('\\' 'u' HEX HEX HEX HEX) | ('\\' 'U' HEX HEX HEX HEX HEX HEX HEX HEX); + +terminal fragment ECHAR: + '\\' ('t' | 'b' | 'n' | 'r' | 'f' | '\\' | '\"' | '\''); + +terminal fragment PN_CHARS_BASE: + ('A'..'Z') | ('a'..'z') | ('\u00C0'..'\u00D6') | ('\u00D8'..'\u00F6') | ('\u00F8'..'\u02FF') | ('\u0370'..'\u037D') + | ('\u037F'..'\u1FFF') | ('\u200C'..'\u200D') | ('\u2070'..'\u218F') | ('\u2C00'..'\u2FEF') | ('\u3001'..'\uD7FF') + | ('\uF900'..'\uFDCF') | ('\uFDF0'..'\uFFFD'); + +terminal fragment PN_CHARS_U: + PN_CHARS_BASE | '_'; + +terminal fragment PN_CHARS: + PN_CHARS_U | '-' | DIGIT | '\u00B7' | ('\u0300'..'\u036F') | ('\u203F'..'\u2040'); + +terminal fragment PN_PREFIX: + PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?; + +terminal fragment PN_LOCAL: + (PN_CHARS_U | ':' | DIGIT | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?; + +terminal fragment PLX: + PERCENT | PN_LOCAL_ESC; + +terminal fragment PERCENT: + '%' HEX HEX; + +terminal fragment HEX: + DIGIT | ('A'..'F') | ('a'..'f'); + +terminal fragment PN_LOCAL_ESC: + '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' + | ';' | '=' | '/' | '?' | '#' | '@' | '%'); +