From d506be02aa58b0d7eb34834127f8d2717fdaad59 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Tue, 19 Mar 2024 10:40:18 +0200
Subject: [PATCH 1/8] initial results
---
shacl-compact-syntax/grammar/Makefile | 33 +
shacl-compact-syntax/grammar/README.md | 20 +
.../grammar/shaclc-ANTLR.ebnf | 203 ++
.../{SHACLC.g4 => grammar/shaclc-ANTLR.g4} | 0
.../grammar/shaclc-ANTLR.html | 2142 +++++++++++++++
shacl-compact-syntax/grammar/shaclc-ANTLR.md | 1037 ++++++++
.../grammar/shaclc-JavaCC.ebnf | 219 ++
.../grammar/shaclc-JavaCC.html | 2331 +++++++++++++++++
shacl-compact-syntax/grammar/shaclc-JavaCC.jj | 652 +++++
shacl-compact-syntax/grammar/shaclc-JavaCC.md | 1151 ++++++++
.../grammar/shaclc-Jison-orig.jison | 564 ++++
.../grammar/shaclc-Jison.jison | 564 ++++
.../grammar/shaclc-XText.xtext | 1284 +++++++++
13 files changed, 10200 insertions(+)
create mode 100644 shacl-compact-syntax/grammar/Makefile
create mode 100644 shacl-compact-syntax/grammar/README.md
create mode 100644 shacl-compact-syntax/grammar/shaclc-ANTLR.ebnf
rename shacl-compact-syntax/{SHACLC.g4 => grammar/shaclc-ANTLR.g4} (100%)
create mode 100644 shacl-compact-syntax/grammar/shaclc-ANTLR.html
create mode 100644 shacl-compact-syntax/grammar/shaclc-ANTLR.md
create mode 100644 shacl-compact-syntax/grammar/shaclc-JavaCC.ebnf
create mode 100644 shacl-compact-syntax/grammar/shaclc-JavaCC.html
create mode 100644 shacl-compact-syntax/grammar/shaclc-JavaCC.jj
create mode 100644 shacl-compact-syntax/grammar/shaclc-JavaCC.md
create mode 100644 shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
create mode 100644 shacl-compact-syntax/grammar/shaclc-Jison.jison
create mode 100644 shacl-compact-syntax/grammar/shaclc-XText.xtext
diff --git a/shacl-compact-syntax/grammar/Makefile b/shacl-compact-syntax/grammar/Makefile
new file mode 100644
index 0000000..ffcfd71
--- /dev/null
+++ b/shacl-compact-syntax/grammar/Makefile
@@ -0,0 +1,33 @@
+# 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
+
+all: $(HTML) $(MD)
+
+%.html: %.ebnf
+ $(rr) $^ > $@
+
+%.md: %.ebnf
+ $(rr) -md $^ > $@
+
+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..14d74a1
--- /dev/null
+++ b/shacl-compact-syntax/grammar/README.md
@@ -0,0 +1,20 @@
+# Unifying SHACLC Grammars
+(Task: https://github.com/w3c/shacl/issues/37#issuecomment-1997655429 )
+
+As a first task of the SHACL Compact Syntax sub-WG, we look at proposed SHACLC 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:
+- Unicode escapes in XText: https://github.com/GuntherRademacher/ebnf-convert/issues/8
+- Two problems in Jison: https://github.com/w3c/shacl/issues/48
+
+Initial results:
+- shacl-ANTLR.g4 -> shacl-ANTLR.ebnf
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:
+
+
+ no references
directive:
+
+
+ referenced by:
+
+
baseDecl:
+
+
+ referenced by:
+
+
importsDecl:
+
+
+ referenced by:
+
+
prefixDecl:
+
+
+ referenced by:
+
+
shapeClass:
+
+
+ referenced by:
+
+
nodeShape:
+
+
+ referenced by:
+
+
nodeShapeBody:
+
+
+ referenced by:
+
+
targetClass:
+
+
+ referenced by:
+
+
constraint:
+
+
+ referenced by:
+
+
nodeOr:
+
+
+ referenced by:
+
+
nodeNot:
+
+
+ referenced by:
+
+
nodeValue:
+
+
+ referenced by:
+
+
propertyShape:
+
+
+ referenced by:
+
+
propertyOr:
+
+
+ referenced by:
+
+
propertyNot:
+
+
+ referenced by:
+
+
propertyAtom:
+
+
+ referenced by:
+
+
propertyCount:
+
+
+ referenced by:
+
+
propertyMinCount:
+
+
+ referenced by:
+
+
propertyMaxCount:
+
+
+ referenced by:
+
+
propertyType:
+
+
+ referenced by:
+
+
nodeKind:
+
+
+ | 'IRI'
+ | 'Literal'
+ | 'BlankNodeOrIRI'
+ | 'BlankNodeOrLiteral'
+ | 'IRIOrLiteral'
+
+ referenced by:
+
+
shapeRef:
+
+
+ referenced by:
+
+
propertyValue:
+
+
+ referenced by:
+
+
path:
+
+
+ referenced by:
+
+
pathAlternative:
+
+
+ referenced by:
+
+
pathSequence:
+
+
+ referenced by:
+
+
pathElt:
+
+
+ referenced by:
+
+
pathEltOrInverse:
+
+
+ referenced by:
+
+
pathMod:
+
+
+ referenced by:
+
+
pathPrimary:
+
+
+ referenced by:
+
+
iriOrLiteralOrArray:
+
+
+ referenced by:
+
+
iriOrLiteral:
+
+
+ referenced by:
+
+
iri:
+
+
+ referenced by:
+
+
prefixedName:
+
+
+ referenced by:
+
+
literal:
+
+
+ referenced by:
+
+
booleanLiteral:
+
+
+ ::= 'true'
+ | 'false'
+
+ referenced by:
+
+
numericLiteral:
+
+
+ referenced by:
+
+
rdfLiteral:
+
+
+ referenced by:
+
+
datatype:
+
+
+ referenced by:
+
+
string:
+
+
+ referenced by:
+
+
array:
+
+
+ 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'
+
+ 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'
+
+ referenced by:
+
+
_:
+
+
+
+ /* ws: definition */
+
+ no references
PASS:
+
+
+ referenced by:
+
+
COMMENT:
+
+
+ referenced by:
+
+
IRIREF:
+
+ IRIREF ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] |
UCHAR )* '>'
+
+ referenced by:
+
+
PNAME_NS:
+
+
+ referenced by:
+
+
PNAME_LN:
+
+
+ referenced by:
+
+
ATPNAME_NS:
+
+
+ referenced by:
+
+
ATPNAME_LN:
+
+
+ referenced by:
+
+
LANGTAG:
+
+ LANGTAG ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )*
+
+ referenced by:
+
+
INTEGER:
+
+
+ referenced by:
+
+
DECIMAL:
+
+ DECIMAL ::= [+#x2D]? [0-9]* '.' [0-9]+
+
+ referenced by:
+
+
DOUBLE:
+
+
+ referenced by:
+
+
EXPONENT:
+
+
+ referenced by:
+
+
STRING_LITERAL1:
+
+
+ ::= "'" ( [^#x0027#x005C#x000A#x000D] |
ECHAR |
UCHAR )* "'"
+
+ referenced by:
+
+
STRING_LITERAL2:
+
+
+ ::= '"' ( [^#x0022#x005C#x000A#x000D] |
ECHAR |
UCHAR )* '"'
+
+ referenced by:
+
+
STRING_LITERAL_LONG1:
+
+
+ ::= "'''" ( ( "'" | "''" )? ( [^'\] |
ECHAR |
UCHAR ) )* "'''"
+
+ referenced by:
+
+
STRING_LITERAL_LONG2:
+
+
+ ::= '"""' ( ( '"' | '""' )? ( [^"\] |
ECHAR |
UCHAR ) )* '"""'
+
+ referenced by:
+
+
UCHAR:
+
+
+ referenced by:
+
+
ECHAR:
+
+
+ referenced by:
+
+
WS:
+
+ WS ::= [#x0020#x0009#x000D#x000A]
+
+ no references
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:
+
+
+ referenced by:
+
+
PN_CHARS:
+
+
+ | [-0-9#x00B7#x0300-#x036F#x203F-#x2040]
+
+ referenced by:
+
+
PN_PREFIX:
+
+
+ referenced by:
+
+
PN_LOCAL:
+
+
+ referenced by:
+
+
PLX:
+
+
+ referenced by:
+
+
PERCENT:
+
+
+ referenced by:
+
+
HEX:
+
+
+ referenced by:
+
+
PN_LOCAL_ESC:
+
+
+ ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*'
+ | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+
+ referenced by:
+
+
EOF:
+
+
+ referenced by:
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/shacl-compact-syntax/grammar/shaclc-ANTLR.md b/shacl-compact-syntax/grammar/shaclc-ANTLR.md
new file mode 100644
index 0000000..d0a9481
--- /dev/null
+++ b/shacl-compact-syntax/grammar/shaclc-ANTLR.md
@@ -0,0 +1,1037 @@
+**shaclDoc:**
+
+
+
+```
+shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF
+```
+
+**directive:**
+
+
+
+```
+directive
+ ::= baseDecl
+ | importsDecl
+ | prefixDecl
+```
+
+referenced by:
+
+* shaclDoc
+
+**baseDecl:**
+
+
+
+```
+baseDecl ::= 'BASE' IRIREF
+```
+
+referenced by:
+
+* directive
+
+**importsDecl:**
+
+
+
+```
+importsDecl
+ ::= 'IMPORTS' IRIREF
+```
+
+referenced by:
+
+* directive
+
+**prefixDecl:**
+
+
+
+```
+prefixDecl
+ ::= 'PREFIX' PNAME_NS IRIREF
+```
+
+referenced by:
+
+* directive
+
+**shapeClass:**
+
+
+
+```
+shapeClass
+ ::= 'shapeClass' iri nodeShapeBody
+```
+
+referenced by:
+
+* shaclDoc
+
+**nodeShape:**
+
+
+
+```
+nodeShape
+ ::= 'shape' iri targetClass? nodeShapeBody
+```
+
+referenced by:
+
+* shaclDoc
+
+**nodeShapeBody:**
+
+
+
+```
+nodeShapeBody
+ ::= '{' constraint* '}'
+```
+
+referenced by:
+
+* nodeShape
+* propertyAtom
+* shapeClass
+
+**targetClass:**
+
+
+
+```
+targetClass
+ ::= '->' iri+
+```
+
+referenced by:
+
+* nodeShape
+
+**constraint:**
+
+
+
+```
+constraint
+ ::= ( nodeOr+ | propertyShape ) '.'
+```
+
+referenced by:
+
+* nodeShapeBody
+
+**nodeOr:**
+
+
+
+```
+nodeOr ::= nodeNot ( '|' nodeNot )*
+```
+
+referenced by:
+
+* constraint
+
+**nodeNot:**
+
+
+
+```
+nodeNot ::= '!'? nodeValue
+```
+
+referenced by:
+
+* nodeOr
+
+**nodeValue:**
+
+
+
+```
+nodeValue
+ ::= nodeParam '=' iriOrLiteralOrArray
+```
+
+referenced by:
+
+* nodeNot
+
+**propertyShape:**
+
+
+
+```
+propertyShape
+ ::= path ( propertyCount | propertyOr )*
+```
+
+referenced by:
+
+* constraint
+
+**propertyOr:**
+
+
+
+```
+propertyOr
+ ::= propertyNot ( '|' propertyNot )*
+```
+
+referenced by:
+
+* propertyShape
+
+**propertyNot:**
+
+
+
+```
+propertyNot
+ ::= '!'? propertyAtom
+```
+
+referenced by:
+
+* propertyOr
+
+**propertyAtom:**
+
+
+
+```
+propertyAtom
+ ::= propertyType
+ | nodeKind
+ | shapeRef
+ | propertyValue
+ | nodeShapeBody
+```
+
+referenced by:
+
+* propertyNot
+
+**propertyCount:**
+
+
+
+```
+propertyCount
+ ::= '[' propertyMinCount '..' propertyMaxCount ']'
+```
+
+referenced by:
+
+* propertyShape
+
+**propertyMinCount:**
+
+
+
+```
+propertyMinCount
+ ::= INTEGER
+```
+
+referenced by:
+
+* propertyCount
+
+**propertyMaxCount:**
+
+
+
+```
+propertyMaxCount
+ ::= INTEGER
+ | '*'
+```
+
+referenced by:
+
+* propertyCount
+
+**propertyType:**
+
+
+
+```
+propertyType
+ ::= iri
+```
+
+referenced by:
+
+* propertyAtom
+
+**nodeKind:**
+
+
+
+```
+nodeKind ::= 'BlankNode'
+ | 'IRI'
+ | 'Literal'
+ | 'BlankNodeOrIRI'
+ | 'BlankNodeOrLiteral'
+ | 'IRIOrLiteral'
+```
+
+referenced by:
+
+* propertyAtom
+
+**shapeRef:**
+
+
+
+```
+shapeRef ::= ATPNAME_LN
+ | ATPNAME_NS
+ | '@' IRIREF
+```
+
+referenced by:
+
+* propertyAtom
+
+**propertyValue:**
+
+
+
+```
+propertyValue
+ ::= propertyParam '=' iriOrLiteralOrArray
+```
+
+referenced by:
+
+* propertyAtom
+
+**path:**
+
+
+
+```
+path ::= pathAlternative
+```
+
+referenced by:
+
+* pathPrimary
+* propertyShape
+
+**pathAlternative:**
+
+
+
+```
+pathAlternative
+ ::= pathSequence ( '|' pathSequence )*
+```
+
+referenced by:
+
+* path
+
+**pathSequence:**
+
+
+
+```
+pathSequence
+ ::= pathEltOrInverse ( '/' pathEltOrInverse )*
+```
+
+referenced by:
+
+* pathAlternative
+
+**pathElt:**
+
+
+
+```
+pathElt ::= pathPrimary pathMod?
+```
+
+referenced by:
+
+* pathEltOrInverse
+
+**pathEltOrInverse:**
+
+
+
+```
+pathEltOrInverse
+ ::= '^'? pathElt
+```
+
+referenced by:
+
+* pathSequence
+
+**pathMod:**
+
+
+
+```
+pathMod ::= '?'
+ | '*'
+ | '+'
+```
+
+referenced by:
+
+* pathElt
+
+**pathPrimary:**
+
+
+
+```
+pathPrimary
+ ::= iri
+ | '(' path ')'
+```
+
+referenced by:
+
+* pathElt
+
+**iriOrLiteralOrArray:**
+
+
+
+```
+iriOrLiteralOrArray
+ ::= iriOrLiteral
+ | array
+```
+
+referenced by:
+
+* nodeValue
+* propertyValue
+
+**iriOrLiteral:**
+
+
+
+```
+iriOrLiteral
+ ::= iri
+ | literal
+```
+
+referenced by:
+
+* array
+* iriOrLiteralOrArray
+
+**iri:**
+
+
+
+```
+iri ::= IRIREF
+ | prefixedName
+```
+
+referenced by:
+
+* datatype
+* iriOrLiteral
+* nodeShape
+* pathPrimary
+* propertyType
+* shapeClass
+* targetClass
+
+**prefixedName:**
+
+
+
+```
+prefixedName
+ ::= PNAME_LN
+ | PNAME_NS
+```
+
+referenced by:
+
+* iri
+
+**literal:**
+
+
+
+```
+literal ::= rdfLiteral
+ | numericLiteral
+ | booleanLiteral
+```
+
+referenced by:
+
+* iriOrLiteral
+
+**booleanLiteral:**
+
+
+
+```
+booleanLiteral
+ ::= 'true'
+ | 'false'
+```
+
+referenced by:
+
+* literal
+
+**numericLiteral:**
+
+
+
+```
+numericLiteral
+ ::= INTEGER
+ | DECIMAL
+ | DOUBLE
+```
+
+referenced by:
+
+* literal
+
+**rdfLiteral:**
+
+
+
+```
+rdfLiteral
+ ::= string ( LANGTAG | '^^' datatype )?
+```
+
+referenced by:
+
+* literal
+
+**datatype:**
+
+
+
+```
+datatype ::= iri
+```
+
+referenced by:
+
+* rdfLiteral
+
+**string:**
+
+
+
+```
+string ::= STRING_LITERAL_LONG1
+ | STRING_LITERAL_LONG2
+ | STRING_LITERAL1
+ | STRING_LITERAL2
+```
+
+referenced by:
+
+* rdfLiteral
+
+**array:**
+
+
+
+```
+array ::= '[' iriOrLiteral* ']'
+```
+
+referenced by:
+
+* iriOrLiteralOrArray
+
+**nodeParam:**
+
+
+
+```
+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:
+
+* nodeValue
+
+**propertyParam:**
+
+
+
+```
+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:
+
+* propertyValue
+
+**_:**
+
+
+
+```
+_ ::= PASS
+ | COMMENT
+ /* ws: definition */
+```
+
+**PASS:**
+
+
+
+```
+PASS ::= [ #x9#xd#xa]+
+```
+
+referenced by:
+
+* _
+
+**COMMENT:**
+
+
+
+```
+COMMENT ::= '#' [^#xd#xa]*
+```
+
+referenced by:
+
+* _
+
+**IRIREF:**
+
+
+
+```
+IRIREF ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] | UCHAR )* '>'
+```
+
+referenced by:
+
+* baseDecl
+* importsDecl
+* iri
+* prefixDecl
+* shapeRef
+
+**PNAME_NS:**
+
+
+
+```
+PNAME_NS ::= PN_PREFIX? ':'
+```
+
+referenced by:
+
+* ATPNAME_LN
+* PNAME_LN
+* prefixDecl
+* prefixedName
+
+**PNAME_LN:**
+
+
+
+```
+PNAME_LN ::= PNAME_NS PN_LOCAL
+```
+
+referenced by:
+
+* prefixedName
+
+**ATPNAME_NS:**
+
+
+
+```
+ATPNAME_NS
+ ::= '@' PN_PREFIX? ':'
+```
+
+referenced by:
+
+* shapeRef
+
+**ATPNAME_LN:**
+
+
+
+```
+ATPNAME_LN
+ ::= '@' PNAME_NS PN_LOCAL
+```
+
+referenced by:
+
+* shapeRef
+
+**LANGTAG:**
+
+
+
+```
+LANGTAG ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )*
+```
+
+referenced by:
+
+* rdfLiteral
+
+**INTEGER:**
+
+
+
+```
+INTEGER ::= [+#x2D]? [0-9]+
+```
+
+referenced by:
+
+* numericLiteral
+* propertyMaxCount
+* propertyMinCount
+
+**DECIMAL:**
+
+
+
+```
+DECIMAL ::= [+#x2D]? [0-9]* '.' [0-9]+
+```
+
+referenced by:
+
+* numericLiteral
+
+**DOUBLE:**
+
+
+
+```
+DOUBLE ::= [+#x2D]? ( [0-9]+ '.' | '.'? [0-9] ) [0-9]* EXPONENT
+```
+
+referenced by:
+
+* numericLiteral
+
+**EXPONENT:**
+
+
+
+```
+EXPONENT ::= [eE] [+#x2D]? [0-9]+
+```
+
+referenced by:
+
+* DOUBLE
+
+**STRING_LITERAL1:**
+
+
+
+```
+STRING_LITERAL1
+ ::= "'" ( [^#x0027#x005C#x000A#x000D] | ECHAR | UCHAR )* "'"
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL2:**
+
+
+
+```
+STRING_LITERAL2
+ ::= '"' ( [^#x0022#x005C#x000A#x000D] | ECHAR | UCHAR )* '"'
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL_LONG1:**
+
+
+
+```
+STRING_LITERAL_LONG1
+ ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL_LONG2:**
+
+
+
+```
+STRING_LITERAL_LONG2
+ ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
+```
+
+referenced by:
+
+* string
+
+**UCHAR:**
+
+
+
+```
+UCHAR ::= ( '\u' | '\U' HEX HEX HEX HEX ) HEX HEX HEX HEX
+```
+
+referenced by:
+
+* IRIREF
+* STRING_LITERAL1
+* STRING_LITERAL2
+* STRING_LITERAL_LONG1
+* STRING_LITERAL_LONG2
+
+**ECHAR:**
+
+
+
+```
+ECHAR ::= '\' [tbnrf\"']
+```
+
+referenced by:
+
+* STRING_LITERAL1
+* STRING_LITERAL2
+* STRING_LITERAL_LONG1
+* STRING_LITERAL_LONG2
+
+**WS:**
+
+
+
+```
+WS ::= [#x0020#x0009#x000D#x000A]
+```
+
+**PN_CHARS_BASE:**
+
+
+
+```
+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_PREFIX
+
+**PN_CHARS_U:**
+
+
+
+```
+PN_CHARS_U
+ ::= PN_CHARS_BASE
+ | '_'
+```
+
+referenced by:
+
+* PN_CHARS
+* PN_LOCAL
+
+**PN_CHARS:**
+
+
+
+```
+PN_CHARS ::= PN_CHARS_U
+ | [-0-9#x00B7#x0300-#x036F#x203F-#x2040]
+```
+
+referenced by:
+
+* PN_LOCAL
+* PN_PREFIX
+
+**PN_PREFIX:**
+
+
+
+```
+PN_PREFIX
+ ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
+```
+
+referenced by:
+
+* ATPNAME_NS
+* PNAME_NS
+
+**PN_LOCAL:**
+
+
+
+```
+PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
+```
+
+referenced by:
+
+* ATPNAME_LN
+* PNAME_LN
+
+**PLX:**
+
+
+
+```
+PLX ::= PERCENT
+ | PN_LOCAL_ESC
+```
+
+referenced by:
+
+* PN_LOCAL
+
+**PERCENT:**
+
+
+
+```
+PERCENT ::= '%' HEX HEX
+```
+
+referenced by:
+
+* PLX
+
+**HEX:**
+
+
+
+```
+HEX ::= [0-9A-Fa-f]
+```
+
+referenced by:
+
+* PERCENT
+* UCHAR
+
+**PN_LOCAL_ESC:**
+
+
+
+```
+PN_LOCAL_ESC
+ ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+```
+
+referenced by:
+
+* PLX
+
+**EOF:**
+
+
+
+```
+EOF ::= $
+```
+
+referenced by:
+
+* shaclDoc
+
+##
+ generated by [RR - Railroad Diagram Generator][RR]
+
+[RR]: https://www.bottlecaps.de/rr/ui
\ 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:
+
+
+ no references
ByteOrderMark:
+
+
+ referenced by:
+
+
shaclDoc:
+
+
+ referenced by:
+
+
directive:
+
+
+ referenced by:
+
+
baseDecl:
+
+
+ referenced by:
+
+
prefixDecl:
+
+
+ referenced by:
+
+
importDecl:
+
+
+ referenced by:
+
+
nodeShape:
+
+
+ referenced by:
+
+
shapeClass:
+
+
+ referenced by:
+
+
targetClass:
+
+
+ referenced by:
+
+
nodeShapeBody:
+
+
+ referenced by:
+
+
constraint:
+
+
+ referenced by:
+
+
nodeOr:
+
+
+ referenced by:
+
+
nodeNot:
+
+
+ referenced by:
+
+
nodeValue:
+
+
+ referenced by:
+
+
propertyShape:
+
+
+ referenced by:
+
+
propertyOr:
+
+
+ referenced by:
+
+
propertyNot:
+
+
+ referenced by:
+
+
propertyAtom:
+
+
+ referenced by:
+
+
propertyCount:
+
+
+ referenced by:
+
+
propertyMinCount:
+
+
+ referenced by:
+
+
propertyMaxCount:
+
+
+ referenced by:
+
+
propertyType:
+
+
+ referenced by:
+
+
nodeKind:
+
+
+ | 'IRI'
+ | 'Literal'
+ | 'BlankNodeOrIRI'
+ | 'BlankNodeOrLiteral'
+ | 'IRIOrLiteral'
+
+ referenced by:
+
+
shapeRef:
+
+
+ referenced by:
+
+
propertyValue:
+
+
+ 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'
+
+ 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'
+
+ referenced by:
+
+
PathUnit:
+
+
+ no references
path:
+
+
+ referenced by:
+
+
pathAlternative:
+
+
+ referenced by:
+
+
pathSequence:
+
+
+ referenced by:
+
+
pathElt:
+
+
+ referenced by:
+
+
pathEltOrInverse:
+
+
+ referenced by:
+
+
pathMod:
+
+
+ referenced by:
+
+
pathPrimary:
+
+
+ referenced by:
+
+
array:
+
+
+ referenced by:
+
+
iriOrLiteral:
+
+
+ referenced by:
+
+
literal:
+
+
+ referenced by:
+
+
booleanLiteral:
+
+
+ ::= 'true'
+ | 'false'
+
+ referenced by:
+
+
numericLiteral:
+
+
+ referenced by:
+
+
rdfLiteral:
+
+
+ referenced by:
+
+
datatype:
+
+
+ referenced by:
+
+
string:
+
+
+ referenced by:
+
+
iri:
+
+
+ referenced by:
+
+
PrefixedName:
+
+
+ referenced by:
+
+
IRIREF:
+
+
+ referenced by:
+
+
SINGLE_LINE_COMMENT:
+
+
+ ::= '#' [^#xA#xD]* #xD? #xA?
+
+ no references
BOM:
+
+
+ referenced by:
+
+
HEX:
+
+
+ referenced by:
+
+
IRIref:
+
+
+ referenced by:
+
+
PNAME_NS:
+
+
+ referenced by:
+
+
PNAME_LN:
+
+
+ referenced by:
+
+
ATPNAME_NS:
+
+
+ referenced by:
+
+
ATPNAME_LN:
+
+
+ referenced by:
+
+
ECHAR:
+
+ ECHAR ::= '\' ( 't' | 'b' | 'n' | 'r' | 'f' | '\' | '"' | "'" )
+
+ referenced by:
+
+
UCHAR:
+
+
+ referenced by:
+
+
UCHAR4:
+
+
+ referenced by:
+
+
UCHAR8:
+
+
+ referenced by:
+
+
STRING_LITERAL1:
+
+
+ referenced by:
+
+
STRING_LITERAL2:
+
+
+ referenced by:
+
+
STRING_LITERAL_LONG1:
+
+
+ ::= "'''" ( ( "'" | "''" )? ( [^'\] |
ECHAR |
UCHAR ) )* "'''"
+
+ referenced by:
+
+
STRING_LITERAL_LONG2:
+
+
+ ::= '"""' ( ( '"' | '""' )? ( [^"\] |
ECHAR |
UCHAR ) )* '"""'
+
+ referenced by:
+
+
DIGITS:
+
+
+ referenced by:
+
+
INTEGER:
+
+
+ referenced by:
+
+
DECIMAL:
+
+
+ referenced by:
+
+
DOUBLE:
+
+ DOUBLE ::= ( '+' | '-' )? ( [0-9]+ ( '.' [0-9]* )? | '.' [0-9]+ )
EXPONENT
+
+ referenced by:
+
+
EXPONENT:
+
+
+ referenced by:
+
+
LANGTAG:
+
+
+ referenced by:
+
+
A2Z:
+
+
+ referenced by:
+
+
A2ZN:
+
+
+ referenced by:
+
+
SURROGATE_PAIR:
+
+
+ ::= [#xD800-#xDBFF] [#xDC00-#xDFFF]
+
+ referenced by:
+
+
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]
+
+
+ referenced by:
+
+
PN_CHARS_U:
+
+
+ referenced by:
+
+
PN_CHARS:
+
+
+ | [-0-9#xB7#x300-#x36F#x203F-#x2040]
+
+ referenced by:
+
+
PN_PREFIX:
+
+
+ referenced by:
+
+
PN_LOCAL:
+
+
+ referenced by:
+
+
VARNAME:
+
+
+ no references
PN_LOCAL_ESC:
+
+
+ ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*'
+ | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+
+ referenced by:
+
+
PLX:
+
+
+ referenced by:
+
+
PERCENT:
+
+
+ referenced by:
+
+
UNKNOWN:
+
+
+ no references
EOF:
+
+
+ referenced by:
+
+
+
+
+
+
+
\ 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-JavaCC.md b/shacl-compact-syntax/grammar/shaclc-JavaCC.md
new file mode 100644
index 0000000..2f9379a
--- /dev/null
+++ b/shacl-compact-syntax/grammar/shaclc-JavaCC.md
@@ -0,0 +1,1151 @@
+**Unit:**
+
+
+
+```
+Unit ::= ByteOrderMark shaclDoc EOF
+```
+
+**ByteOrderMark:**
+
+
+
+```
+ByteOrderMark
+ ::= BOM?
+```
+
+referenced by:
+
+* PathUnit
+* Unit
+
+**shaclDoc:**
+
+
+
+```
+shaclDoc ::= directive* ( nodeShape | shapeClass )*
+```
+
+referenced by:
+
+* Unit
+
+**directive:**
+
+
+
+```
+directive
+ ::= baseDecl
+ | prefixDecl
+ | importDecl
+```
+
+referenced by:
+
+* shaclDoc
+
+**baseDecl:**
+
+
+
+```
+baseDecl ::= 'BASE' IRIREF
+```
+
+referenced by:
+
+* directive
+
+**prefixDecl:**
+
+
+
+```
+prefixDecl
+ ::= 'PREFIX' PNAME_NS IRIREF
+```
+
+referenced by:
+
+* directive
+
+**importDecl:**
+
+
+
+```
+importDecl
+ ::= 'IMPORTS' iri
+```
+
+referenced by:
+
+* directive
+
+**nodeShape:**
+
+
+
+```
+nodeShape
+ ::= 'shape' iri targetClass? nodeShapeBody
+```
+
+referenced by:
+
+* shaclDoc
+
+**shapeClass:**
+
+
+
+```
+shapeClass
+ ::= 'shapeClass' iri nodeShapeBody
+```
+
+referenced by:
+
+* shaclDoc
+
+**targetClass:**
+
+
+
+```
+targetClass
+ ::= '->' iri+
+```
+
+referenced by:
+
+* nodeShape
+
+**nodeShapeBody:**
+
+
+
+```
+nodeShapeBody
+ ::= '{' constraint* '}'
+```
+
+referenced by:
+
+* nodeShape
+* propertyAtom
+* shapeClass
+
+**constraint:**
+
+
+
+```
+constraint
+ ::= ( nodeOr+ | propertyShape | shapeRef ) '.'
+```
+
+referenced by:
+
+* nodeShapeBody
+
+**nodeOr:**
+
+
+
+```
+nodeOr ::= nodeNot ( '|' nodeNot )*
+```
+
+referenced by:
+
+* constraint
+
+**nodeNot:**
+
+
+
+```
+nodeNot ::= '!'? nodeValue
+```
+
+referenced by:
+
+* nodeOr
+
+**nodeValue:**
+
+
+
+```
+nodeValue
+ ::= nodeParam '=' ( iriOrLiteral | array )
+```
+
+referenced by:
+
+* nodeNot
+
+**propertyShape:**
+
+
+
+```
+propertyShape
+ ::= path ( propertyCount | propertyOr )*
+```
+
+referenced by:
+
+* constraint
+
+**propertyOr:**
+
+
+
+```
+propertyOr
+ ::= propertyNot ( '|' propertyNot )*
+```
+
+referenced by:
+
+* propertyShape
+
+**propertyNot:**
+
+
+
+```
+propertyNot
+ ::= '!'? propertyAtom
+```
+
+referenced by:
+
+* propertyOr
+
+**propertyAtom:**
+
+
+
+```
+propertyAtom
+ ::= propertyType
+ | nodeKind
+ | shapeRef
+ | propertyValue
+ | nodeShapeBody
+```
+
+referenced by:
+
+* propertyNot
+
+**propertyCount:**
+
+
+
+```
+propertyCount
+ ::= '[' propertyMinCount '..' propertyMaxCount ']'
+```
+
+referenced by:
+
+* propertyShape
+
+**propertyMinCount:**
+
+
+
+```
+propertyMinCount
+ ::= INTEGER
+```
+
+referenced by:
+
+* propertyCount
+
+**propertyMaxCount:**
+
+
+
+```
+propertyMaxCount
+ ::= INTEGER
+ | '*'
+```
+
+referenced by:
+
+* propertyCount
+
+**propertyType:**
+
+
+
+```
+propertyType
+ ::= iri
+```
+
+referenced by:
+
+* propertyAtom
+
+**nodeKind:**
+
+
+
+```
+nodeKind ::= 'BlankNode'
+ | 'IRI'
+ | 'Literal'
+ | 'BlankNodeOrIRI'
+ | 'BlankNodeOrLiteral'
+ | 'IRIOrLiteral'
+```
+
+referenced by:
+
+* propertyAtom
+
+**shapeRef:**
+
+
+
+```
+shapeRef ::= ATPNAME_LN
+ | ATPNAME_NS
+ | '@' IRIREF
+```
+
+referenced by:
+
+* constraint
+* propertyAtom
+
+**propertyValue:**
+
+
+
+```
+propertyValue
+ ::= propertyParam '=' ( iriOrLiteral | array )
+```
+
+referenced by:
+
+* propertyAtom
+
+**nodeParam:**
+
+
+
+```
+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:
+
+* nodeValue
+
+**propertyParam:**
+
+
+
+```
+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:
+
+* propertyValue
+
+**PathUnit:**
+
+
+
+```
+PathUnit ::= ByteOrderMark path EOF
+```
+
+**path:**
+
+
+
+```
+path ::= pathAlternative
+```
+
+referenced by:
+
+* PathUnit
+* pathPrimary
+* propertyShape
+
+**pathAlternative:**
+
+
+
+```
+pathAlternative
+ ::= pathSequence ( '|' pathSequence )*
+```
+
+referenced by:
+
+* path
+
+**pathSequence:**
+
+
+
+```
+pathSequence
+ ::= pathEltOrInverse ( '/' pathEltOrInverse )*
+```
+
+referenced by:
+
+* pathAlternative
+
+**pathElt:**
+
+
+
+```
+pathElt ::= pathPrimary pathMod?
+```
+
+referenced by:
+
+* pathEltOrInverse
+
+**pathEltOrInverse:**
+
+
+
+```
+pathEltOrInverse
+ ::= '^'? pathElt
+```
+
+referenced by:
+
+* pathSequence
+
+**pathMod:**
+
+
+
+```
+pathMod ::= '?'
+ | '*'
+ | '+'
+```
+
+referenced by:
+
+* pathElt
+
+**pathPrimary:**
+
+
+
+```
+pathPrimary
+ ::= iri
+ | '(' path ')'
+```
+
+referenced by:
+
+* pathElt
+
+**array:**
+
+
+
+```
+array ::= '[' iriOrLiteral* ']'
+```
+
+referenced by:
+
+* nodeValue
+* propertyValue
+
+**iriOrLiteral:**
+
+
+
+```
+iriOrLiteral
+ ::= iri
+ | literal
+```
+
+referenced by:
+
+* array
+* nodeValue
+* propertyValue
+
+**literal:**
+
+
+
+```
+literal ::= rdfLiteral
+ | numericLiteral
+ | booleanLiteral
+```
+
+referenced by:
+
+* iriOrLiteral
+
+**booleanLiteral:**
+
+
+
+```
+booleanLiteral
+ ::= 'true'
+ | 'false'
+```
+
+referenced by:
+
+* literal
+
+**numericLiteral:**
+
+
+
+```
+numericLiteral
+ ::= INTEGER
+ | DECIMAL
+ | DOUBLE
+```
+
+referenced by:
+
+* literal
+
+**rdfLiteral:**
+
+
+
+```
+rdfLiteral
+ ::= string ( LANGTAG | '^^' datatype )?
+```
+
+referenced by:
+
+* literal
+
+**datatype:**
+
+
+
+```
+datatype ::= iri
+```
+
+referenced by:
+
+* rdfLiteral
+
+**string:**
+
+
+
+```
+string ::= STRING_LITERAL1
+ | STRING_LITERAL2
+ | STRING_LITERAL_LONG1
+ | STRING_LITERAL_LONG2
+```
+
+referenced by:
+
+* rdfLiteral
+
+**iri:**
+
+
+
+```
+iri ::= IRIREF
+ | PrefixedName
+```
+
+referenced by:
+
+* datatype
+* importDecl
+* iriOrLiteral
+* nodeShape
+* pathPrimary
+* propertyType
+* shapeClass
+* targetClass
+
+**PrefixedName:**
+
+
+
+```
+PrefixedName
+ ::= PNAME_LN
+ | PNAME_NS
+```
+
+referenced by:
+
+* iri
+
+**IRIREF:**
+
+
+
+```
+IRIREF ::= IRIref
+```
+
+referenced by:
+
+* baseDecl
+* iri
+* prefixDecl
+* shapeRef
+
+**SINGLE_LINE_COMMENT:**
+
+
+
+```
+SINGLE_LINE_COMMENT
+ ::= '#' [^#xA#xD]* #xD? #xA?
+```
+
+**BOM:**
+
+
+
+```
+BOM ::= #xFEFF
+```
+
+referenced by:
+
+* ByteOrderMark
+
+**HEX:**
+
+
+
+```
+HEX ::= [0-9A-Fa-f]
+```
+
+referenced by:
+
+* PERCENT
+* UCHAR4
+* UCHAR8
+
+**IRIref:**
+
+
+
+```
+IRIref ::= '<' ( [^><"{}^\|`#x0-#x20] | UCHAR )* '>'
+```
+
+referenced by:
+
+* IRIREF
+
+**PNAME_NS:**
+
+
+
+```
+PNAME_NS ::= PN_PREFIX? ':'
+```
+
+referenced by:
+
+* ATPNAME_NS
+* PNAME_LN
+* PrefixedName
+* prefixDecl
+
+**PNAME_LN:**
+
+
+
+```
+PNAME_LN ::= PNAME_NS PN_LOCAL
+```
+
+referenced by:
+
+* ATPNAME_LN
+* PrefixedName
+
+**ATPNAME_NS:**
+
+
+
+```
+ATPNAME_NS
+ ::= '@' PNAME_NS
+```
+
+referenced by:
+
+* shapeRef
+
+**ATPNAME_LN:**
+
+
+
+```
+ATPNAME_LN
+ ::= '@' PNAME_LN
+```
+
+referenced by:
+
+* shapeRef
+
+**ECHAR:**
+
+
+
+```
+ECHAR ::= '\' ( 't' | 'b' | 'n' | 'r' | 'f' | '\' | '"' | "'" )
+```
+
+referenced by:
+
+* STRING_LITERAL1
+* STRING_LITERAL2
+* STRING_LITERAL_LONG1
+* STRING_LITERAL_LONG2
+
+**UCHAR:**
+
+
+
+```
+UCHAR ::= UCHAR4
+ | UCHAR8
+```
+
+referenced by:
+
+* IRIref
+* STRING_LITERAL1
+* STRING_LITERAL2
+* STRING_LITERAL_LONG1
+* STRING_LITERAL_LONG2
+
+**UCHAR4:**
+
+
+
+```
+UCHAR4 ::= '\' 'u' HEX HEX HEX HEX
+```
+
+referenced by:
+
+* UCHAR
+
+**UCHAR8:**
+
+
+
+```
+UCHAR8 ::= '\' 'U' HEX HEX HEX HEX HEX HEX HEX HEX
+```
+
+referenced by:
+
+* UCHAR
+
+**STRING_LITERAL1:**
+
+
+
+```
+STRING_LITERAL1
+ ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'"
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL2:**
+
+
+
+```
+STRING_LITERAL2
+ ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"'
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL_LONG1:**
+
+
+
+```
+STRING_LITERAL_LONG1
+ ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
+```
+
+referenced by:
+
+* string
+
+**STRING_LITERAL_LONG2:**
+
+
+
+```
+STRING_LITERAL_LONG2
+ ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
+```
+
+referenced by:
+
+* string
+
+**DIGITS:**
+
+
+
+```
+DIGITS ::= [0-9]+
+```
+
+referenced by:
+
+* DECIMAL
+* INTEGER
+
+**INTEGER:**
+
+
+
+```
+INTEGER ::= ( '+' | '-' )? DIGITS
+```
+
+referenced by:
+
+* numericLiteral
+* propertyMaxCount
+* propertyMinCount
+
+**DECIMAL:**
+
+
+
+```
+DECIMAL ::= ( '+' | '-' )? DIGITS? '.' DIGITS
+```
+
+referenced by:
+
+* numericLiteral
+
+**DOUBLE:**
+
+
+
+```
+DOUBLE ::= ( '+' | '-' )? ( [0-9]+ ( '.' [0-9]* )? | '.' [0-9]+ ) EXPONENT
+```
+
+referenced by:
+
+* numericLiteral
+
+**EXPONENT:**
+
+
+
+```
+EXPONENT ::= [eE] [+#x2D]? [0-9]+
+```
+
+referenced by:
+
+* DOUBLE
+
+**LANGTAG:**
+
+
+
+```
+LANGTAG ::= '@' A2Z+ ( '-' A2ZN+ )*
+```
+
+referenced by:
+
+* rdfLiteral
+
+**A2Z:**
+
+
+
+```
+A2Z ::= [a-zA-Z]
+```
+
+referenced by:
+
+* LANGTAG
+
+**A2ZN:**
+
+
+
+```
+A2ZN ::= [a-zA-Z0-9]
+```
+
+referenced by:
+
+* LANGTAG
+
+**SURROGATE_PAIR:**
+
+
+
+```
+SURROGATE_PAIR
+ ::= [#xD800-#xDBFF] [#xDC00-#xDFFF]
+```
+
+referenced by:
+
+* PN_CHARS_BASE
+
+**PN_CHARS_BASE:**
+
+
+
+```
+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_PREFIX
+
+**PN_CHARS_U:**
+
+
+
+```
+PN_CHARS_U
+ ::= PN_CHARS_BASE
+ | '_'
+```
+
+referenced by:
+
+* PN_CHARS
+* PN_LOCAL
+* VARNAME
+
+**PN_CHARS:**
+
+
+
+```
+PN_CHARS ::= PN_CHARS_U
+ | [-0-9#xB7#x300-#x36F#x203F-#x2040]
+```
+
+referenced by:
+
+* PN_LOCAL
+* PN_PREFIX
+
+**PN_PREFIX:**
+
+
+
+```
+PN_PREFIX
+ ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
+```
+
+referenced by:
+
+* PNAME_NS
+
+**PN_LOCAL:**
+
+
+
+```
+PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
+```
+
+referenced by:
+
+* PNAME_LN
+
+**VARNAME:**
+
+
+
+```
+VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9#xB7#x300-#x36F#x203F-#x2040] )*
+```
+
+**PN_LOCAL_ESC:**
+
+
+
+```
+PN_LOCAL_ESC
+ ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+```
+
+referenced by:
+
+* PLX
+
+**PLX:**
+
+
+
+```
+PLX ::= PERCENT
+ | PN_LOCAL_ESC
+```
+
+referenced by:
+
+* PN_LOCAL
+
+**PERCENT:**
+
+
+
+```
+PERCENT ::= '%' HEX HEX
+```
+
+referenced by:
+
+* PLX
+
+**UNKNOWN:**
+
+
+
+```
+UNKNOWN ::= [^ #x9#xA#xD#xC]+
+```
+
+**EOF:**
+
+
+
+```
+EOF ::= $
+```
+
+referenced by:
+
+* PathUnit
+* Unit
+
+##
+ generated by [RR - Railroad Diagram Generator][RR]
+
+[RR]: https://www.bottlecaps.de/rr/ui
\ No newline at end of file
diff --git a/shacl-compact-syntax/grammar/shaclc-Jison-orig.jison b/shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
new file mode 100644
index 0000000..f1b27eb
--- /dev/null
+++ b/shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
@@ -0,0 +1,564 @@
+%{
+/*
+ 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'
+
+/lex
+
+%ebnf
+
+%start shaclDoc
+
+%%
+
+// TODO: Work out why this occurs multiple times when the empty file is called with other things (the base from the previous file is somehow getting leaked thorugh)
+shaclDoc : directive* (nodeShape|shapeClass)* ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology'))
+ ;
+
+directive : baseDecl | importsDecl | prefixDecl ;
+ // TODO: Remove the duplicate declaration of base
+baseDecl : KW_BASE IRIREF
+ {
+ Parser.base = Parser.factory.namedNode($2.slice(1, -1));
+ Parser.n3Parser._setBase(Parser.base.value);
+ }
+ ;
+
+ // TODO: See if this should be resolveIRI($2)
+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
+ ;
+
+shapeClass : KW_SHAPE_CLASS nodeShapeIri turtleAnnotation? nodeShapeBody -> emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class'))
+ ;
+
+turtleAnnotation : ';' turtleAnnotation2 -> ensureExtended()
+ ;
+
+turtleAnnotation2 : predicate turtleAnnotation?
+ ;
+
+predicate : iri objectList -> $2.forEach(e => emit(Parser.currentNodeShape, $1, e))
+ ;
+
+objectList : object objectTail* -> [$1, ...$2]
+ ;
+
+object : iriOrLiteral
+ | blankNodeSection
+ | list
+ ;
+
+list : '(' object* ')' -> 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*
+ ;
+
+startNodeShape : '{'
+ {
+ if (!Parser.nodeShapeStack) {
+ Parser.nodeShapeStack = [];
+ } else {
+ Parser.nodeShapeStack.push(Parser.currentNodeShape);
+ emit(
+ // In the grammar a path signals the start of a new property declaration
+ Parser.currentPropertyNode,
+ Parser.factory.namedNode(SH + 'node'),
+ Parser.currentNodeShape = blank(),
+ )
+ }
+
+ $$ = Parser.currentNodeShape;
+ }
+ ;
+
+endNodeShape : '}'
+ {
+ if (Parser.nodeShapeStack.length > 0) {
+ Parser.currentNodeShape = Parser.nodeShapeStack.pop();
+ }
+ }
+ ;
+
+nodeShapeBody : startNodeShape constraint* endNodeShape -> $1
+ ;
+
+targetClass : '->' iri+ -> $2.forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) })
+ ;
+
+constraint : ( nodeOrEmit+ | propertyShape ) pcSection? '.'
+ ;
+
+orNotComponent : '|' nodeNot -> $2
+ ;
+
+nodeOrEmit : nodeOr -> emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $1[0]), $1[1])
+ ;
+
+nodeOr : nodeNot
+ {
+ // console.log('ndoe not')
+ }
+ | nodeNot orNotComponent+
+ {
+ 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)
+ ;
+nodeValue : (TARGET | PARAM) '=' iriOrLiteralOrArray -> [$1, $3]
+ ;
+
+propertyShape : path ( propertyCount | propertyOr )*
+ ;
+
+propertyOrComponent : '|' propertyNot -> $2
+ ;
+
+// Top level property emission
+propertyOr : propertyNot -> $1 && emitProperty(...$1)
+ | propertyNot propertyOrComponent+
+ {
+ $$ = emitProperty(
+ 'or',
+ addList([$1, ...$2].map(elem => {
+ const x = blank();
+ emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
+ return x;
+ }))
+ )
+ }
+ ;
+
+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]
+ // TODO: Fix this workaround (the node *should* be emitted this way)
+ | 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))
+ | '*'
+ ;
+
+ // TODO: Check this
+shapeRef : (ATPNAME_LN | ATPNAME_NS) -> expandPrefix($1.slice(1))
+ | '@' IRIREF -> resolveIRI($2)
+ ;
+
+negation : '!' ;
+
+path : pathAlternative
+ {
+ emit(
+ // In the grammar a path signals the start of a new property declaration
+ Parser.currentNodeShape,
+ Parser.factory.namedNode(SH + 'property'),
+ Parser.currentPropertyNode = blank(),
+ )
+
+ emitProperty('path', $1)
+ }
+ ;
+
+additionalAlternative : '|' pathSequence -> $2
+ ;
+
+pathAlternative : pathSequence
+ | pathSequence additionalAlternative+
+ {
+ const n = blank();
+ emit(
+ n,
+ Parser.factory.namedNode(SH + 'alternativePath'),
+ addList([$1, ...$2])
+ )
+ $$ = n
+ }
+ ;
+
+additionalSequence : '/' pathEltOrInverse -> $2
+ ;
+
+pathSequence : pathEltOrInverse
+ | pathEltOrInverse additionalSequence+ -> addList([$1, ...$2])
+
+ ;
+pathElt : pathPrimary
+ | pathPrimary pathMod
+ {
+ emit($$ = blank(), Parser.factory.namedNode(SH + $2), $1)
+ }
+ ;
+pathEltOrInverse : pathElt
+ | pathInverse pathElt
+ {
+ emit($$ = blank(), Parser.factory.namedNode(SH + 'inversePath'), $2)
+ }
+ ;
+pathInverse : '^' ;
+pathMod : '?' -> 'zeroOrOnePath'
+ | '*' -> 'zeroOrMorePath'
+ | '+' -> 'oneOrMorePath'
+ ;
+
+pathPrimary : iri
+ // TODO: Check this (I don' think there needs to be any other special logic for the brackets here)
+ // Note that this is pathAlternative rather than just path as path is a special trigger to emit
+ // the root quad
+ | '(' pathAlternative ')' -> $2
+ ;
+
+iriOrLiteralOrArray : iriOrLiteral
+ | '[' iriOrLiteral* ']' -> addList($2)
+ ;
+
+iriOrLiteral : iri | literal ;
+
+iri : IRIREF -> Parser.factory.namedNode(resolveIRI($1))
+ // TODO: Double check expand prefix works on both
+ | (PNAME_LN | PNAME_NS) -> Parser.factory.namedNode(expandPrefix($1))
+ | 'a' -> ensureExtended(Parser.factory.namedNode(RDF_TYPE))
+ ;
+
+literal
+ // RDF LITERALS
+ : string -> createTypedLiteral($1)
+ // TODO: check this
+ | string LANGTAG -> createLangLiteral($1, lowercase($2.substr(1)))
+ | string '^^' iri -> createTypedLiteral($1, $3)
+ // NUMERIC LITERALS
+ | INTEGER -> createTypedLiteral($1, XSD_INTEGER)
+ | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL)
+ | DOUBLE -> createTypedLiteral($1.toLowerCase(), XSD_DOUBLE)
+ // BOOLEAN LITERALS
+ | (KW_TRUE | KW_FALSE) -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
+ ;
+
+string
+ : (STRING_LITERAL1 | STRING_LITERAL2) -> unescapeString($1, 1)
+ | (STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2) -> unescapeString($1, 3)
+ ;
diff --git a/shacl-compact-syntax/grammar/shaclc-Jison.jison b/shacl-compact-syntax/grammar/shaclc-Jison.jison
new file mode 100644
index 0000000..1907fd0
--- /dev/null
+++ b/shacl-compact-syntax/grammar/shaclc-Jison.jison
@@ -0,0 +1,564 @@
+%{
+/*
+ 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'
+
+/lex
+
+// %ebnf
+
+%start shaclDoc
+
+%%
+
+// TODO: Work out why this occurs multiple times when the empty file is called with other things (the base from the previous file is somehow getting leaked thorugh)
+shaclDoc : directive* (nodeShape|shapeClass)* ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology'))
+ ;
+
+directive : baseDecl | importsDecl | prefixDecl ;
+ // TODO: Remove the duplicate declaration of base
+baseDecl : KW_BASE IRIREF
+ {
+ Parser.base = Parser.factory.namedNode($2.slice(1, -1));
+ Parser.n3Parser._setBase(Parser.base.value);
+ }
+ ;
+
+ // TODO: See if this should be resolveIRI($2)
+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
+ ;
+
+shapeClass : KW_SHAPE_CLASS nodeShapeIri turtleAnnotation? nodeShapeBody -> emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class'))
+ ;
+
+turtleAnnotation : ';' turtleAnnotation2 -> ensureExtended()
+ ;
+
+turtleAnnotation2 : predicate turtleAnnotation?
+ ;
+
+predicate : iri objectList -> $2.forEach(e => emit(Parser.currentNodeShape, $1, e))
+ ;
+
+objectList : object objectTail* -> [$1, ...$2]
+ ;
+
+object : iriOrLiteral
+ | blankNodeSection
+ | list
+ ;
+
+list : '(' object* ')' -> 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*
+ ;
+
+startNodeShape : '{'
+ {
+ if (!Parser.nodeShapeStack) {
+ Parser.nodeShapeStack = [];
+ } else {
+ Parser.nodeShapeStack.push(Parser.currentNodeShape);
+ emit(
+ // In the grammar a path signals the start of a new property declaration
+ Parser.currentPropertyNode,
+ Parser.factory.namedNode(SH + 'node'),
+ Parser.currentNodeShape = blank(),
+ )
+ }
+
+ $$ = Parser.currentNodeShape;
+ }
+ ;
+
+endNodeShape : '}'
+ {
+ if (Parser.nodeShapeStack.length > 0) {
+ Parser.currentNodeShape = Parser.nodeShapeStack.pop();
+ }
+ }
+ ;
+
+nodeShapeBody : startNodeShape constraint* endNodeShape -> $1
+ ;
+
+targetClass : '->' iri+ -> $2.forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) })
+ ;
+
+constraint : ( nodeOrEmit+ | propertyShape ) pcSection? '.'
+ ;
+
+orNotComponent : '|' nodeNot -> $2
+ ;
+
+nodeOrEmit : nodeOr -> emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $1[0]), $1[1])
+ ;
+
+nodeOr : nodeNot
+ {
+ // console.log('ndoe not')
+ }
+ | nodeNot orNotComponent+
+ {
+ 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)
+ ;
+nodeValue : (TARGET | PARAM) '=' iriOrLiteralOrArray -> [$1, $3]
+ ;
+
+propertyShape : path ( propertyCount | propertyOr )*
+ ;
+
+propertyOrComponent : '|' propertyNot -> $2
+ ;
+
+// Top level property emission
+propertyOr : propertyNot -> $1 && emitProperty(...$1)
+ | propertyNot propertyOrComponent+
+ {
+ $$ = emitProperty(
+ 'or',
+ addList([$1, ...$2].map(elem => {
+ const x = blank();
+ emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
+ return x;
+ }))
+ )
+ }
+ ;
+
+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]
+ // TODO: Fix this workaround (the node *should* be emitted this way)
+ | 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))
+ | '*'
+ ;
+
+ // TODO: Check this
+shapeRef : (ATPNAME_LN | ATPNAME_NS) -> expandPrefix($1.slice(1))
+ | '@' IRIREF -> resolveIRI($2)
+ ;
+
+negation : '!' ;
+
+path : pathAlternative
+ {
+ emit(
+ // In the grammar a path signals the start of a new property declaration
+ Parser.currentNodeShape,
+ Parser.factory.namedNode(SH + 'property'),
+ Parser.currentPropertyNode = blank(),
+ )
+
+ emitProperty('path', $1)
+ }
+ ;
+
+additionalAlternative : '|' pathSequence -> $2
+ ;
+
+pathAlternative : pathSequence
+ | pathSequence additionalAlternative+
+ {
+ const n = blank();
+ emit(
+ n,
+ Parser.factory.namedNode(SH + 'alternativePath'),
+ addList([$1, ...$2])
+ )
+ $$ = n
+ }
+ ;
+
+additionalSequence : '/' pathEltOrInverse -> $2
+ ;
+
+pathSequence : pathEltOrInverse
+ | pathEltOrInverse additionalSequence+ -> addList([$1, ...$2])
+
+ ;
+pathElt : pathPrimary
+ | pathPrimary pathMod
+ {
+ emit($$ = blank(), Parser.factory.namedNode(SH + $2), $1)
+ }
+ ;
+pathEltOrInverse : pathElt
+ | pathInverse pathElt
+ {
+ emit($$ = blank(), Parser.factory.namedNode(SH + 'inversePath'), $2)
+ }
+ ;
+pathInverse : '^' ;
+pathMod : '?' -> 'zeroOrOnePath'
+ | '*' -> 'zeroOrMorePath'
+ | '+' -> 'oneOrMorePath'
+ ;
+
+pathPrimary : iri
+ // TODO: Check this (I don' think there needs to be any other special logic for the brackets here)
+ // Note that this is pathAlternative rather than just path as path is a special trigger to emit
+ // the root quad
+ | '(' pathAlternative ')' -> $2
+ ;
+
+iriOrLiteralOrArray : iriOrLiteral
+ | '[' iriOrLiteral* ']' -> addList($2)
+ ;
+
+iriOrLiteral : iri | literal ;
+
+iri : IRIREF -> Parser.factory.namedNode(resolveIRI($1))
+ // TODO: Double check expand prefix works on both
+ | (PNAME_LN | PNAME_NS) -> Parser.factory.namedNode(expandPrefix($1))
+ | 'a' -> ensureExtended(Parser.factory.namedNode(RDF_TYPE))
+ ;
+
+literal
+ // RDF LITERALS
+ : string -> createTypedLiteral($1)
+ // TODO: check this
+ | string LANGTAG -> createLangLiteral($1, lowercase($2.substr(1)))
+ | string '^^' iri -> createTypedLiteral($1, $3)
+ // NUMERIC LITERALS
+ | INTEGER -> createTypedLiteral($1, XSD_INTEGER)
+ | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL)
+ | DOUBLE -> createTypedLiteral($1.toLowerCase(), XSD_DOUBLE)
+ // BOOLEAN LITERALS
+ | (KW_TRUE | KW_FALSE) -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
+ ;
+
+string
+ : (STRING_LITERAL1 | STRING_LITERAL2) -> unescapeString($1, 1)
+ | (STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2) -> unescapeString($1, 3)
+ ;
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:
+ '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ','
+ | ';' | '=' | '/' | '?' | '#' | '@' | '%');
+
From 504b61614bb7cf9f3f421e7c69f0b2189d27774e Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Tue, 19 Mar 2024 10:44:42 +0200
Subject: [PATCH 2/8] use PNG instead of SVG
---
shacl-compact-syntax/grammar/shaclc-ANTLR.md | 150 +++++++++----------
1 file changed, 75 insertions(+), 75 deletions(-)
diff --git a/shacl-compact-syntax/grammar/shaclc-ANTLR.md b/shacl-compact-syntax/grammar/shaclc-ANTLR.md
index d0a9481..5abe8fd 100644
--- a/shacl-compact-syntax/grammar/shaclc-ANTLR.md
+++ b/shacl-compact-syntax/grammar/shaclc-ANTLR.md
@@ -1,6 +1,6 @@
**shaclDoc:**
-
+
```
shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF
@@ -8,7 +8,7 @@ shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF
**directive:**
-
+
```
directive
@@ -23,7 +23,7 @@ referenced by:
**baseDecl:**
-
+
```
baseDecl ::= 'BASE' IRIREF
@@ -35,7 +35,7 @@ referenced by:
**importsDecl:**
-
+
```
importsDecl
@@ -48,7 +48,7 @@ referenced by:
**prefixDecl:**
-
+
```
prefixDecl
@@ -61,7 +61,7 @@ referenced by:
**shapeClass:**
-
+
```
shapeClass
@@ -74,7 +74,7 @@ referenced by:
**nodeShape:**
-
+
```
nodeShape
@@ -87,7 +87,7 @@ referenced by:
**nodeShapeBody:**
-
+
```
nodeShapeBody
@@ -102,7 +102,7 @@ referenced by:
**targetClass:**
-
+
```
targetClass
@@ -115,7 +115,7 @@ referenced by:
**constraint:**
-
+
```
constraint
@@ -128,7 +128,7 @@ referenced by:
**nodeOr:**
-
+
```
nodeOr ::= nodeNot ( '|' nodeNot )*
@@ -140,7 +140,7 @@ referenced by:
**nodeNot:**
-
+
```
nodeNot ::= '!'? nodeValue
@@ -152,7 +152,7 @@ referenced by:
**nodeValue:**
-
+
```
nodeValue
@@ -165,7 +165,7 @@ referenced by:
**propertyShape:**
-
+
```
propertyShape
@@ -178,7 +178,7 @@ referenced by:
**propertyOr:**
-
+
```
propertyOr
@@ -191,7 +191,7 @@ referenced by:
**propertyNot:**
-
+
```
propertyNot
@@ -204,7 +204,7 @@ referenced by:
**propertyAtom:**
-
+
```
propertyAtom
@@ -221,7 +221,7 @@ referenced by:
**propertyCount:**
-
+
```
propertyCount
@@ -234,7 +234,7 @@ referenced by:
**propertyMinCount:**
-
+
```
propertyMinCount
@@ -247,7 +247,7 @@ referenced by:
**propertyMaxCount:**
-
+
```
propertyMaxCount
@@ -261,7 +261,7 @@ referenced by:
**propertyType:**
-
+
```
propertyType
@@ -274,7 +274,7 @@ referenced by:
**nodeKind:**
-
+
```
nodeKind ::= 'BlankNode'
@@ -291,7 +291,7 @@ referenced by:
**shapeRef:**
-
+
```
shapeRef ::= ATPNAME_LN
@@ -305,7 +305,7 @@ referenced by:
**propertyValue:**
-
+
```
propertyValue
@@ -318,7 +318,7 @@ referenced by:
**path:**
-
+
```
path ::= pathAlternative
@@ -331,7 +331,7 @@ referenced by:
**pathAlternative:**
-
+
```
pathAlternative
@@ -344,7 +344,7 @@ referenced by:
**pathSequence:**
-
+
```
pathSequence
@@ -357,7 +357,7 @@ referenced by:
**pathElt:**
-
+
```
pathElt ::= pathPrimary pathMod?
@@ -369,7 +369,7 @@ referenced by:
**pathEltOrInverse:**
-
+
```
pathEltOrInverse
@@ -382,7 +382,7 @@ referenced by:
**pathMod:**
-
+
```
pathMod ::= '?'
@@ -396,7 +396,7 @@ referenced by:
**pathPrimary:**
-
+
```
pathPrimary
@@ -410,7 +410,7 @@ referenced by:
**iriOrLiteralOrArray:**
-
+
```
iriOrLiteralOrArray
@@ -425,7 +425,7 @@ referenced by:
**iriOrLiteral:**
-
+
```
iriOrLiteral
@@ -440,7 +440,7 @@ referenced by:
**iri:**
-
+
```
iri ::= IRIREF
@@ -459,7 +459,7 @@ referenced by:
**prefixedName:**
-
+
```
prefixedName
@@ -473,7 +473,7 @@ referenced by:
**literal:**
-
+
```
literal ::= rdfLiteral
@@ -487,7 +487,7 @@ referenced by:
**booleanLiteral:**
-
+
```
booleanLiteral
@@ -501,7 +501,7 @@ referenced by:
**numericLiteral:**
-
+
```
numericLiteral
@@ -516,7 +516,7 @@ referenced by:
**rdfLiteral:**
-
+
```
rdfLiteral
@@ -529,7 +529,7 @@ referenced by:
**datatype:**
-
+
```
datatype ::= iri
@@ -541,7 +541,7 @@ referenced by:
**string:**
-
+
```
string ::= STRING_LITERAL_LONG1
@@ -556,7 +556,7 @@ referenced by:
**array:**
-
+
```
array ::= '[' iriOrLiteral* ']'
@@ -568,7 +568,7 @@ referenced by:
**nodeParam:**
-
+
```
nodeParam
@@ -604,7 +604,7 @@ referenced by:
**propertyParam:**
-
+
```
propertyParam
@@ -644,7 +644,7 @@ referenced by:
**_:**
-
+
```
_ ::= PASS
@@ -654,7 +654,7 @@ _ ::= PASS
**PASS:**
-
+
```
PASS ::= [ #x9#xd#xa]+
@@ -666,7 +666,7 @@ referenced by:
**COMMENT:**
-
+
```
COMMENT ::= '#' [^#xd#xa]*
@@ -678,7 +678,7 @@ referenced by:
**IRIREF:**
-
+
```
IRIREF ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] | UCHAR )* '>'
@@ -694,7 +694,7 @@ referenced by:
**PNAME_NS:**
-
+
```
PNAME_NS ::= PN_PREFIX? ':'
@@ -709,7 +709,7 @@ referenced by:
**PNAME_LN:**
-
+
```
PNAME_LN ::= PNAME_NS PN_LOCAL
@@ -721,7 +721,7 @@ referenced by:
**ATPNAME_NS:**
-
+
```
ATPNAME_NS
@@ -734,7 +734,7 @@ referenced by:
**ATPNAME_LN:**
-
+
```
ATPNAME_LN
@@ -747,7 +747,7 @@ referenced by:
**LANGTAG:**
-
+
```
LANGTAG ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )*
@@ -759,7 +759,7 @@ referenced by:
**INTEGER:**
-
+
```
INTEGER ::= [+#x2D]? [0-9]+
@@ -773,7 +773,7 @@ referenced by:
**DECIMAL:**
-
+
```
DECIMAL ::= [+#x2D]? [0-9]* '.' [0-9]+
@@ -785,7 +785,7 @@ referenced by:
**DOUBLE:**
-
+
```
DOUBLE ::= [+#x2D]? ( [0-9]+ '.' | '.'? [0-9] ) [0-9]* EXPONENT
@@ -797,7 +797,7 @@ referenced by:
**EXPONENT:**
-
+
```
EXPONENT ::= [eE] [+#x2D]? [0-9]+
@@ -809,7 +809,7 @@ referenced by:
**STRING_LITERAL1:**
-
+
```
STRING_LITERAL1
@@ -822,7 +822,7 @@ referenced by:
**STRING_LITERAL2:**
-
+
```
STRING_LITERAL2
@@ -835,7 +835,7 @@ referenced by:
**STRING_LITERAL_LONG1:**
-
+
```
STRING_LITERAL_LONG1
@@ -848,7 +848,7 @@ referenced by:
**STRING_LITERAL_LONG2:**
-
+
```
STRING_LITERAL_LONG2
@@ -861,7 +861,7 @@ referenced by:
**UCHAR:**
-
+
```
UCHAR ::= ( '\u' | '\U' HEX HEX HEX HEX ) HEX HEX HEX HEX
@@ -877,7 +877,7 @@ referenced by:
**ECHAR:**
-
+
```
ECHAR ::= '\' [tbnrf\"']
@@ -892,7 +892,7 @@ referenced by:
**WS:**
-
+
```
WS ::= [#x0020#x0009#x000D#x000A]
@@ -900,7 +900,7 @@ WS ::= [#x0020#x0009#x000D#x000A]
**PN_CHARS_BASE:**
-
+
```
PN_CHARS_BASE
@@ -914,7 +914,7 @@ referenced by:
**PN_CHARS_U:**
-
+
```
PN_CHARS_U
@@ -929,7 +929,7 @@ referenced by:
**PN_CHARS:**
-
+
```
PN_CHARS ::= PN_CHARS_U
@@ -943,7 +943,7 @@ referenced by:
**PN_PREFIX:**
-
+
```
PN_PREFIX
@@ -957,7 +957,7 @@ referenced by:
**PN_LOCAL:**
-
+
```
PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
@@ -970,7 +970,7 @@ referenced by:
**PLX:**
-
+
```
PLX ::= PERCENT
@@ -983,7 +983,7 @@ referenced by:
**PERCENT:**
-
+
```
PERCENT ::= '%' HEX HEX
@@ -995,7 +995,7 @@ referenced by:
**HEX:**
-
+
```
HEX ::= [0-9A-Fa-f]
@@ -1008,7 +1008,7 @@ referenced by:
**PN_LOCAL_ESC:**
-
+
```
PN_LOCAL_ESC
@@ -1021,7 +1021,7 @@ referenced by:
**EOF:**
-
+
```
EOF ::= $
@@ -1032,6 +1032,6 @@ referenced by:
* shaclDoc
##
- generated by [RR - Railroad Diagram Generator][RR]
+ generated by [RR - Railroad Diagram Generator][RR]
[RR]: https://www.bottlecaps.de/rr/ui
\ No newline at end of file
From aac5fae829350eb8e6ff10479614672f287964b1 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Tue, 19 Mar 2024 10:55:08 +0200
Subject: [PATCH 3/8] give up on Markdown. add links in README
---
shacl-compact-syntax/grammar/Makefile | 9 +-
shacl-compact-syntax/grammar/README.md | 18 +-
shacl-compact-syntax/grammar/shaclc-ANTLR.md | 1037 -------------
shacl-compact-syntax/grammar/shaclc-JavaCC.md | 1151 ---------------
.../grammar/shaclc-XText-orig.xtext | 1284 +++++++++++++++++
5 files changed, 1303 insertions(+), 2196 deletions(-)
delete mode 100644 shacl-compact-syntax/grammar/shaclc-ANTLR.md
delete mode 100644 shacl-compact-syntax/grammar/shaclc-JavaCC.md
create mode 100644 shacl-compact-syntax/grammar/shaclc-XText-orig.xtext
diff --git a/shacl-compact-syntax/grammar/Makefile b/shacl-compact-syntax/grammar/Makefile
index ffcfd71..ae93d36 100644
--- a/shacl-compact-syntax/grammar/Makefile
+++ b/shacl-compact-syntax/grammar/Makefile
@@ -8,15 +8,17 @@ 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
-all: $(HTML) $(MD)
+# 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 $^ > $@
+ $(rr) -md -png $^ > $@
shaclc-ANTLR.ebnf : shaclc-ANTLR.g4
$(ebnf-convert) $^ > $@
@@ -30,4 +32,3 @@ shaclc-Jison.ebnf : shaclc-Jison.jison
shaclc-XText.ebnf : shaclc-XText.xtext
$(ebnf-convert) $^ > $@
-
diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md
index 14d74a1..3f3dc27 100644
--- a/shacl-compact-syntax/grammar/README.md
+++ b/shacl-compact-syntax/grammar/README.md
@@ -5,7 +5,7 @@ As a first task of the SHACL Compact Syntax sub-WG, we look at proposed SHACLC g
- [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
+- [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:
@@ -13,8 +13,18 @@ We use two tools to understand them and try to unify them:
- https://github.com/GuntherRademacher/rr to produce "rail-road" diagrams, which make it easier to understand the grammars.
Problems:
-- Unicode escapes in XText: https://github.com/GuntherRademacher/ebnf-convert/issues/8
-- Two problems in Jison: https://github.com/w3c/shacl/issues/48
+- Unicode escapes in XText: https://github.com/GuntherRademacher/ebnf-convert/issues/8 .
+ So we also saved `shaclc-XText-orig.xtext` in case we need to adapt it.
+- Two problems in Jison: https://github.com/w3c/shacl/issues/48 .
+ So we also saved `shaclc-Jison-orig.jison` in case we need to adapt it.
+
+`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
Initial results:
-- shacl-ANTLR.g4 -> shacl-ANTLR.ebnf
+- [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)) (BROKEN)
+- [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)) (BROKEN)
diff --git a/shacl-compact-syntax/grammar/shaclc-ANTLR.md b/shacl-compact-syntax/grammar/shaclc-ANTLR.md
deleted file mode 100644
index 5abe8fd..0000000
--- a/shacl-compact-syntax/grammar/shaclc-ANTLR.md
+++ /dev/null
@@ -1,1037 +0,0 @@
-**shaclDoc:**
-
-
-
-```
-shaclDoc ::= directive* ( nodeShape | shapeClass )* EOF
-```
-
-**directive:**
-
-
-
-```
-directive
- ::= baseDecl
- | importsDecl
- | prefixDecl
-```
-
-referenced by:
-
-* shaclDoc
-
-**baseDecl:**
-
-
-
-```
-baseDecl ::= 'BASE' IRIREF
-```
-
-referenced by:
-
-* directive
-
-**importsDecl:**
-
-
-
-```
-importsDecl
- ::= 'IMPORTS' IRIREF
-```
-
-referenced by:
-
-* directive
-
-**prefixDecl:**
-
-
-
-```
-prefixDecl
- ::= 'PREFIX' PNAME_NS IRIREF
-```
-
-referenced by:
-
-* directive
-
-**shapeClass:**
-
-
-
-```
-shapeClass
- ::= 'shapeClass' iri nodeShapeBody
-```
-
-referenced by:
-
-* shaclDoc
-
-**nodeShape:**
-
-
-
-```
-nodeShape
- ::= 'shape' iri targetClass? nodeShapeBody
-```
-
-referenced by:
-
-* shaclDoc
-
-**nodeShapeBody:**
-
-
-
-```
-nodeShapeBody
- ::= '{' constraint* '}'
-```
-
-referenced by:
-
-* nodeShape
-* propertyAtom
-* shapeClass
-
-**targetClass:**
-
-
-
-```
-targetClass
- ::= '->' iri+
-```
-
-referenced by:
-
-* nodeShape
-
-**constraint:**
-
-
-
-```
-constraint
- ::= ( nodeOr+ | propertyShape ) '.'
-```
-
-referenced by:
-
-* nodeShapeBody
-
-**nodeOr:**
-
-
-
-```
-nodeOr ::= nodeNot ( '|' nodeNot )*
-```
-
-referenced by:
-
-* constraint
-
-**nodeNot:**
-
-
-
-```
-nodeNot ::= '!'? nodeValue
-```
-
-referenced by:
-
-* nodeOr
-
-**nodeValue:**
-
-
-
-```
-nodeValue
- ::= nodeParam '=' iriOrLiteralOrArray
-```
-
-referenced by:
-
-* nodeNot
-
-**propertyShape:**
-
-
-
-```
-propertyShape
- ::= path ( propertyCount | propertyOr )*
-```
-
-referenced by:
-
-* constraint
-
-**propertyOr:**
-
-
-
-```
-propertyOr
- ::= propertyNot ( '|' propertyNot )*
-```
-
-referenced by:
-
-* propertyShape
-
-**propertyNot:**
-
-
-
-```
-propertyNot
- ::= '!'? propertyAtom
-```
-
-referenced by:
-
-* propertyOr
-
-**propertyAtom:**
-
-
-
-```
-propertyAtom
- ::= propertyType
- | nodeKind
- | shapeRef
- | propertyValue
- | nodeShapeBody
-```
-
-referenced by:
-
-* propertyNot
-
-**propertyCount:**
-
-
-
-```
-propertyCount
- ::= '[' propertyMinCount '..' propertyMaxCount ']'
-```
-
-referenced by:
-
-* propertyShape
-
-**propertyMinCount:**
-
-
-
-```
-propertyMinCount
- ::= INTEGER
-```
-
-referenced by:
-
-* propertyCount
-
-**propertyMaxCount:**
-
-
-
-```
-propertyMaxCount
- ::= INTEGER
- | '*'
-```
-
-referenced by:
-
-* propertyCount
-
-**propertyType:**
-
-
-
-```
-propertyType
- ::= iri
-```
-
-referenced by:
-
-* propertyAtom
-
-**nodeKind:**
-
-
-
-```
-nodeKind ::= 'BlankNode'
- | 'IRI'
- | 'Literal'
- | 'BlankNodeOrIRI'
- | 'BlankNodeOrLiteral'
- | 'IRIOrLiteral'
-```
-
-referenced by:
-
-* propertyAtom
-
-**shapeRef:**
-
-
-
-```
-shapeRef ::= ATPNAME_LN
- | ATPNAME_NS
- | '@' IRIREF
-```
-
-referenced by:
-
-* propertyAtom
-
-**propertyValue:**
-
-
-
-```
-propertyValue
- ::= propertyParam '=' iriOrLiteralOrArray
-```
-
-referenced by:
-
-* propertyAtom
-
-**path:**
-
-
-
-```
-path ::= pathAlternative
-```
-
-referenced by:
-
-* pathPrimary
-* propertyShape
-
-**pathAlternative:**
-
-
-
-```
-pathAlternative
- ::= pathSequence ( '|' pathSequence )*
-```
-
-referenced by:
-
-* path
-
-**pathSequence:**
-
-
-
-```
-pathSequence
- ::= pathEltOrInverse ( '/' pathEltOrInverse )*
-```
-
-referenced by:
-
-* pathAlternative
-
-**pathElt:**
-
-
-
-```
-pathElt ::= pathPrimary pathMod?
-```
-
-referenced by:
-
-* pathEltOrInverse
-
-**pathEltOrInverse:**
-
-
-
-```
-pathEltOrInverse
- ::= '^'? pathElt
-```
-
-referenced by:
-
-* pathSequence
-
-**pathMod:**
-
-
-
-```
-pathMod ::= '?'
- | '*'
- | '+'
-```
-
-referenced by:
-
-* pathElt
-
-**pathPrimary:**
-
-
-
-```
-pathPrimary
- ::= iri
- | '(' path ')'
-```
-
-referenced by:
-
-* pathElt
-
-**iriOrLiteralOrArray:**
-
-
-
-```
-iriOrLiteralOrArray
- ::= iriOrLiteral
- | array
-```
-
-referenced by:
-
-* nodeValue
-* propertyValue
-
-**iriOrLiteral:**
-
-
-
-```
-iriOrLiteral
- ::= iri
- | literal
-```
-
-referenced by:
-
-* array
-* iriOrLiteralOrArray
-
-**iri:**
-
-
-
-```
-iri ::= IRIREF
- | prefixedName
-```
-
-referenced by:
-
-* datatype
-* iriOrLiteral
-* nodeShape
-* pathPrimary
-* propertyType
-* shapeClass
-* targetClass
-
-**prefixedName:**
-
-
-
-```
-prefixedName
- ::= PNAME_LN
- | PNAME_NS
-```
-
-referenced by:
-
-* iri
-
-**literal:**
-
-
-
-```
-literal ::= rdfLiteral
- | numericLiteral
- | booleanLiteral
-```
-
-referenced by:
-
-* iriOrLiteral
-
-**booleanLiteral:**
-
-
-
-```
-booleanLiteral
- ::= 'true'
- | 'false'
-```
-
-referenced by:
-
-* literal
-
-**numericLiteral:**
-
-
-
-```
-numericLiteral
- ::= INTEGER
- | DECIMAL
- | DOUBLE
-```
-
-referenced by:
-
-* literal
-
-**rdfLiteral:**
-
-
-
-```
-rdfLiteral
- ::= string ( LANGTAG | '^^' datatype )?
-```
-
-referenced by:
-
-* literal
-
-**datatype:**
-
-
-
-```
-datatype ::= iri
-```
-
-referenced by:
-
-* rdfLiteral
-
-**string:**
-
-
-
-```
-string ::= STRING_LITERAL_LONG1
- | STRING_LITERAL_LONG2
- | STRING_LITERAL1
- | STRING_LITERAL2
-```
-
-referenced by:
-
-* rdfLiteral
-
-**array:**
-
-
-
-```
-array ::= '[' iriOrLiteral* ']'
-```
-
-referenced by:
-
-* iriOrLiteralOrArray
-
-**nodeParam:**
-
-
-
-```
-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:
-
-* nodeValue
-
-**propertyParam:**
-
-
-
-```
-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:
-
-* propertyValue
-
-**_:**
-
-
-
-```
-_ ::= PASS
- | COMMENT
- /* ws: definition */
-```
-
-**PASS:**
-
-
-
-```
-PASS ::= [ #x9#xd#xa]+
-```
-
-referenced by:
-
-* _
-
-**COMMENT:**
-
-
-
-```
-COMMENT ::= '#' [^#xd#xa]*
-```
-
-referenced by:
-
-* _
-
-**IRIREF:**
-
-
-
-```
-IRIREF ::= '<' ( [^=<>"{}|^`\#x0000-#x0020] | UCHAR )* '>'
-```
-
-referenced by:
-
-* baseDecl
-* importsDecl
-* iri
-* prefixDecl
-* shapeRef
-
-**PNAME_NS:**
-
-
-
-```
-PNAME_NS ::= PN_PREFIX? ':'
-```
-
-referenced by:
-
-* ATPNAME_LN
-* PNAME_LN
-* prefixDecl
-* prefixedName
-
-**PNAME_LN:**
-
-
-
-```
-PNAME_LN ::= PNAME_NS PN_LOCAL
-```
-
-referenced by:
-
-* prefixedName
-
-**ATPNAME_NS:**
-
-
-
-```
-ATPNAME_NS
- ::= '@' PN_PREFIX? ':'
-```
-
-referenced by:
-
-* shapeRef
-
-**ATPNAME_LN:**
-
-
-
-```
-ATPNAME_LN
- ::= '@' PNAME_NS PN_LOCAL
-```
-
-referenced by:
-
-* shapeRef
-
-**LANGTAG:**
-
-
-
-```
-LANGTAG ::= '@' [a-zA-Z]+ ( '-' [a-zA-Z0-9]+ )*
-```
-
-referenced by:
-
-* rdfLiteral
-
-**INTEGER:**
-
-
-
-```
-INTEGER ::= [+#x2D]? [0-9]+
-```
-
-referenced by:
-
-* numericLiteral
-* propertyMaxCount
-* propertyMinCount
-
-**DECIMAL:**
-
-
-
-```
-DECIMAL ::= [+#x2D]? [0-9]* '.' [0-9]+
-```
-
-referenced by:
-
-* numericLiteral
-
-**DOUBLE:**
-
-
-
-```
-DOUBLE ::= [+#x2D]? ( [0-9]+ '.' | '.'? [0-9] ) [0-9]* EXPONENT
-```
-
-referenced by:
-
-* numericLiteral
-
-**EXPONENT:**
-
-
-
-```
-EXPONENT ::= [eE] [+#x2D]? [0-9]+
-```
-
-referenced by:
-
-* DOUBLE
-
-**STRING_LITERAL1:**
-
-
-
-```
-STRING_LITERAL1
- ::= "'" ( [^#x0027#x005C#x000A#x000D] | ECHAR | UCHAR )* "'"
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL2:**
-
-
-
-```
-STRING_LITERAL2
- ::= '"' ( [^#x0022#x005C#x000A#x000D] | ECHAR | UCHAR )* '"'
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL_LONG1:**
-
-
-
-```
-STRING_LITERAL_LONG1
- ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL_LONG2:**
-
-
-
-```
-STRING_LITERAL_LONG2
- ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
-```
-
-referenced by:
-
-* string
-
-**UCHAR:**
-
-
-
-```
-UCHAR ::= ( '\u' | '\U' HEX HEX HEX HEX ) HEX HEX HEX HEX
-```
-
-referenced by:
-
-* IRIREF
-* STRING_LITERAL1
-* STRING_LITERAL2
-* STRING_LITERAL_LONG1
-* STRING_LITERAL_LONG2
-
-**ECHAR:**
-
-
-
-```
-ECHAR ::= '\' [tbnrf\"']
-```
-
-referenced by:
-
-* STRING_LITERAL1
-* STRING_LITERAL2
-* STRING_LITERAL_LONG1
-* STRING_LITERAL_LONG2
-
-**WS:**
-
-
-
-```
-WS ::= [#x0020#x0009#x000D#x000A]
-```
-
-**PN_CHARS_BASE:**
-
-
-
-```
-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_PREFIX
-
-**PN_CHARS_U:**
-
-
-
-```
-PN_CHARS_U
- ::= PN_CHARS_BASE
- | '_'
-```
-
-referenced by:
-
-* PN_CHARS
-* PN_LOCAL
-
-**PN_CHARS:**
-
-
-
-```
-PN_CHARS ::= PN_CHARS_U
- | [-0-9#x00B7#x0300-#x036F#x203F-#x2040]
-```
-
-referenced by:
-
-* PN_LOCAL
-* PN_PREFIX
-
-**PN_PREFIX:**
-
-
-
-```
-PN_PREFIX
- ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
-```
-
-referenced by:
-
-* ATPNAME_NS
-* PNAME_NS
-
-**PN_LOCAL:**
-
-
-
-```
-PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
-```
-
-referenced by:
-
-* ATPNAME_LN
-* PNAME_LN
-
-**PLX:**
-
-
-
-```
-PLX ::= PERCENT
- | PN_LOCAL_ESC
-```
-
-referenced by:
-
-* PN_LOCAL
-
-**PERCENT:**
-
-
-
-```
-PERCENT ::= '%' HEX HEX
-```
-
-referenced by:
-
-* PLX
-
-**HEX:**
-
-
-
-```
-HEX ::= [0-9A-Fa-f]
-```
-
-referenced by:
-
-* PERCENT
-* UCHAR
-
-**PN_LOCAL_ESC:**
-
-
-
-```
-PN_LOCAL_ESC
- ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
-```
-
-referenced by:
-
-* PLX
-
-**EOF:**
-
-
-
-```
-EOF ::= $
-```
-
-referenced by:
-
-* shaclDoc
-
-##
- generated by [RR - Railroad Diagram Generator][RR]
-
-[RR]: https://www.bottlecaps.de/rr/ui
\ No newline at end of file
diff --git a/shacl-compact-syntax/grammar/shaclc-JavaCC.md b/shacl-compact-syntax/grammar/shaclc-JavaCC.md
deleted file mode 100644
index 2f9379a..0000000
--- a/shacl-compact-syntax/grammar/shaclc-JavaCC.md
+++ /dev/null
@@ -1,1151 +0,0 @@
-**Unit:**
-
-
-
-```
-Unit ::= ByteOrderMark shaclDoc EOF
-```
-
-**ByteOrderMark:**
-
-
-
-```
-ByteOrderMark
- ::= BOM?
-```
-
-referenced by:
-
-* PathUnit
-* Unit
-
-**shaclDoc:**
-
-
-
-```
-shaclDoc ::= directive* ( nodeShape | shapeClass )*
-```
-
-referenced by:
-
-* Unit
-
-**directive:**
-
-
-
-```
-directive
- ::= baseDecl
- | prefixDecl
- | importDecl
-```
-
-referenced by:
-
-* shaclDoc
-
-**baseDecl:**
-
-
-
-```
-baseDecl ::= 'BASE' IRIREF
-```
-
-referenced by:
-
-* directive
-
-**prefixDecl:**
-
-
-
-```
-prefixDecl
- ::= 'PREFIX' PNAME_NS IRIREF
-```
-
-referenced by:
-
-* directive
-
-**importDecl:**
-
-
-
-```
-importDecl
- ::= 'IMPORTS' iri
-```
-
-referenced by:
-
-* directive
-
-**nodeShape:**
-
-
-
-```
-nodeShape
- ::= 'shape' iri targetClass? nodeShapeBody
-```
-
-referenced by:
-
-* shaclDoc
-
-**shapeClass:**
-
-
-
-```
-shapeClass
- ::= 'shapeClass' iri nodeShapeBody
-```
-
-referenced by:
-
-* shaclDoc
-
-**targetClass:**
-
-
-
-```
-targetClass
- ::= '->' iri+
-```
-
-referenced by:
-
-* nodeShape
-
-**nodeShapeBody:**
-
-
-
-```
-nodeShapeBody
- ::= '{' constraint* '}'
-```
-
-referenced by:
-
-* nodeShape
-* propertyAtom
-* shapeClass
-
-**constraint:**
-
-
-
-```
-constraint
- ::= ( nodeOr+ | propertyShape | shapeRef ) '.'
-```
-
-referenced by:
-
-* nodeShapeBody
-
-**nodeOr:**
-
-
-
-```
-nodeOr ::= nodeNot ( '|' nodeNot )*
-```
-
-referenced by:
-
-* constraint
-
-**nodeNot:**
-
-
-
-```
-nodeNot ::= '!'? nodeValue
-```
-
-referenced by:
-
-* nodeOr
-
-**nodeValue:**
-
-
-
-```
-nodeValue
- ::= nodeParam '=' ( iriOrLiteral | array )
-```
-
-referenced by:
-
-* nodeNot
-
-**propertyShape:**
-
-
-
-```
-propertyShape
- ::= path ( propertyCount | propertyOr )*
-```
-
-referenced by:
-
-* constraint
-
-**propertyOr:**
-
-
-
-```
-propertyOr
- ::= propertyNot ( '|' propertyNot )*
-```
-
-referenced by:
-
-* propertyShape
-
-**propertyNot:**
-
-
-
-```
-propertyNot
- ::= '!'? propertyAtom
-```
-
-referenced by:
-
-* propertyOr
-
-**propertyAtom:**
-
-
-
-```
-propertyAtom
- ::= propertyType
- | nodeKind
- | shapeRef
- | propertyValue
- | nodeShapeBody
-```
-
-referenced by:
-
-* propertyNot
-
-**propertyCount:**
-
-
-
-```
-propertyCount
- ::= '[' propertyMinCount '..' propertyMaxCount ']'
-```
-
-referenced by:
-
-* propertyShape
-
-**propertyMinCount:**
-
-
-
-```
-propertyMinCount
- ::= INTEGER
-```
-
-referenced by:
-
-* propertyCount
-
-**propertyMaxCount:**
-
-
-
-```
-propertyMaxCount
- ::= INTEGER
- | '*'
-```
-
-referenced by:
-
-* propertyCount
-
-**propertyType:**
-
-
-
-```
-propertyType
- ::= iri
-```
-
-referenced by:
-
-* propertyAtom
-
-**nodeKind:**
-
-
-
-```
-nodeKind ::= 'BlankNode'
- | 'IRI'
- | 'Literal'
- | 'BlankNodeOrIRI'
- | 'BlankNodeOrLiteral'
- | 'IRIOrLiteral'
-```
-
-referenced by:
-
-* propertyAtom
-
-**shapeRef:**
-
-
-
-```
-shapeRef ::= ATPNAME_LN
- | ATPNAME_NS
- | '@' IRIREF
-```
-
-referenced by:
-
-* constraint
-* propertyAtom
-
-**propertyValue:**
-
-
-
-```
-propertyValue
- ::= propertyParam '=' ( iriOrLiteral | array )
-```
-
-referenced by:
-
-* propertyAtom
-
-**nodeParam:**
-
-
-
-```
-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:
-
-* nodeValue
-
-**propertyParam:**
-
-
-
-```
-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:
-
-* propertyValue
-
-**PathUnit:**
-
-
-
-```
-PathUnit ::= ByteOrderMark path EOF
-```
-
-**path:**
-
-
-
-```
-path ::= pathAlternative
-```
-
-referenced by:
-
-* PathUnit
-* pathPrimary
-* propertyShape
-
-**pathAlternative:**
-
-
-
-```
-pathAlternative
- ::= pathSequence ( '|' pathSequence )*
-```
-
-referenced by:
-
-* path
-
-**pathSequence:**
-
-
-
-```
-pathSequence
- ::= pathEltOrInverse ( '/' pathEltOrInverse )*
-```
-
-referenced by:
-
-* pathAlternative
-
-**pathElt:**
-
-
-
-```
-pathElt ::= pathPrimary pathMod?
-```
-
-referenced by:
-
-* pathEltOrInverse
-
-**pathEltOrInverse:**
-
-
-
-```
-pathEltOrInverse
- ::= '^'? pathElt
-```
-
-referenced by:
-
-* pathSequence
-
-**pathMod:**
-
-
-
-```
-pathMod ::= '?'
- | '*'
- | '+'
-```
-
-referenced by:
-
-* pathElt
-
-**pathPrimary:**
-
-
-
-```
-pathPrimary
- ::= iri
- | '(' path ')'
-```
-
-referenced by:
-
-* pathElt
-
-**array:**
-
-
-
-```
-array ::= '[' iriOrLiteral* ']'
-```
-
-referenced by:
-
-* nodeValue
-* propertyValue
-
-**iriOrLiteral:**
-
-
-
-```
-iriOrLiteral
- ::= iri
- | literal
-```
-
-referenced by:
-
-* array
-* nodeValue
-* propertyValue
-
-**literal:**
-
-
-
-```
-literal ::= rdfLiteral
- | numericLiteral
- | booleanLiteral
-```
-
-referenced by:
-
-* iriOrLiteral
-
-**booleanLiteral:**
-
-
-
-```
-booleanLiteral
- ::= 'true'
- | 'false'
-```
-
-referenced by:
-
-* literal
-
-**numericLiteral:**
-
-
-
-```
-numericLiteral
- ::= INTEGER
- | DECIMAL
- | DOUBLE
-```
-
-referenced by:
-
-* literal
-
-**rdfLiteral:**
-
-
-
-```
-rdfLiteral
- ::= string ( LANGTAG | '^^' datatype )?
-```
-
-referenced by:
-
-* literal
-
-**datatype:**
-
-
-
-```
-datatype ::= iri
-```
-
-referenced by:
-
-* rdfLiteral
-
-**string:**
-
-
-
-```
-string ::= STRING_LITERAL1
- | STRING_LITERAL2
- | STRING_LITERAL_LONG1
- | STRING_LITERAL_LONG2
-```
-
-referenced by:
-
-* rdfLiteral
-
-**iri:**
-
-
-
-```
-iri ::= IRIREF
- | PrefixedName
-```
-
-referenced by:
-
-* datatype
-* importDecl
-* iriOrLiteral
-* nodeShape
-* pathPrimary
-* propertyType
-* shapeClass
-* targetClass
-
-**PrefixedName:**
-
-
-
-```
-PrefixedName
- ::= PNAME_LN
- | PNAME_NS
-```
-
-referenced by:
-
-* iri
-
-**IRIREF:**
-
-
-
-```
-IRIREF ::= IRIref
-```
-
-referenced by:
-
-* baseDecl
-* iri
-* prefixDecl
-* shapeRef
-
-**SINGLE_LINE_COMMENT:**
-
-
-
-```
-SINGLE_LINE_COMMENT
- ::= '#' [^#xA#xD]* #xD? #xA?
-```
-
-**BOM:**
-
-
-
-```
-BOM ::= #xFEFF
-```
-
-referenced by:
-
-* ByteOrderMark
-
-**HEX:**
-
-
-
-```
-HEX ::= [0-9A-Fa-f]
-```
-
-referenced by:
-
-* PERCENT
-* UCHAR4
-* UCHAR8
-
-**IRIref:**
-
-
-
-```
-IRIref ::= '<' ( [^><"{}^\|`#x0-#x20] | UCHAR )* '>'
-```
-
-referenced by:
-
-* IRIREF
-
-**PNAME_NS:**
-
-
-
-```
-PNAME_NS ::= PN_PREFIX? ':'
-```
-
-referenced by:
-
-* ATPNAME_NS
-* PNAME_LN
-* PrefixedName
-* prefixDecl
-
-**PNAME_LN:**
-
-
-
-```
-PNAME_LN ::= PNAME_NS PN_LOCAL
-```
-
-referenced by:
-
-* ATPNAME_LN
-* PrefixedName
-
-**ATPNAME_NS:**
-
-
-
-```
-ATPNAME_NS
- ::= '@' PNAME_NS
-```
-
-referenced by:
-
-* shapeRef
-
-**ATPNAME_LN:**
-
-
-
-```
-ATPNAME_LN
- ::= '@' PNAME_LN
-```
-
-referenced by:
-
-* shapeRef
-
-**ECHAR:**
-
-
-
-```
-ECHAR ::= '\' ( 't' | 'b' | 'n' | 'r' | 'f' | '\' | '"' | "'" )
-```
-
-referenced by:
-
-* STRING_LITERAL1
-* STRING_LITERAL2
-* STRING_LITERAL_LONG1
-* STRING_LITERAL_LONG2
-
-**UCHAR:**
-
-
-
-```
-UCHAR ::= UCHAR4
- | UCHAR8
-```
-
-referenced by:
-
-* IRIref
-* STRING_LITERAL1
-* STRING_LITERAL2
-* STRING_LITERAL_LONG1
-* STRING_LITERAL_LONG2
-
-**UCHAR4:**
-
-
-
-```
-UCHAR4 ::= '\' 'u' HEX HEX HEX HEX
-```
-
-referenced by:
-
-* UCHAR
-
-**UCHAR8:**
-
-
-
-```
-UCHAR8 ::= '\' 'U' HEX HEX HEX HEX HEX HEX HEX HEX
-```
-
-referenced by:
-
-* UCHAR
-
-**STRING_LITERAL1:**
-
-
-
-```
-STRING_LITERAL1
- ::= "'" ( [^'\#xA#xD] | ECHAR | UCHAR )* "'"
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL2:**
-
-
-
-```
-STRING_LITERAL2
- ::= '"' ( [^"\#xA#xD] | ECHAR | UCHAR )* '"'
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL_LONG1:**
-
-
-
-```
-STRING_LITERAL_LONG1
- ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''"
-```
-
-referenced by:
-
-* string
-
-**STRING_LITERAL_LONG2:**
-
-
-
-```
-STRING_LITERAL_LONG2
- ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""'
-```
-
-referenced by:
-
-* string
-
-**DIGITS:**
-
-
-
-```
-DIGITS ::= [0-9]+
-```
-
-referenced by:
-
-* DECIMAL
-* INTEGER
-
-**INTEGER:**
-
-
-
-```
-INTEGER ::= ( '+' | '-' )? DIGITS
-```
-
-referenced by:
-
-* numericLiteral
-* propertyMaxCount
-* propertyMinCount
-
-**DECIMAL:**
-
-
-
-```
-DECIMAL ::= ( '+' | '-' )? DIGITS? '.' DIGITS
-```
-
-referenced by:
-
-* numericLiteral
-
-**DOUBLE:**
-
-
-
-```
-DOUBLE ::= ( '+' | '-' )? ( [0-9]+ ( '.' [0-9]* )? | '.' [0-9]+ ) EXPONENT
-```
-
-referenced by:
-
-* numericLiteral
-
-**EXPONENT:**
-
-
-
-```
-EXPONENT ::= [eE] [+#x2D]? [0-9]+
-```
-
-referenced by:
-
-* DOUBLE
-
-**LANGTAG:**
-
-
-
-```
-LANGTAG ::= '@' A2Z+ ( '-' A2ZN+ )*
-```
-
-referenced by:
-
-* rdfLiteral
-
-**A2Z:**
-
-
-
-```
-A2Z ::= [a-zA-Z]
-```
-
-referenced by:
-
-* LANGTAG
-
-**A2ZN:**
-
-
-
-```
-A2ZN ::= [a-zA-Z0-9]
-```
-
-referenced by:
-
-* LANGTAG
-
-**SURROGATE_PAIR:**
-
-
-
-```
-SURROGATE_PAIR
- ::= [#xD800-#xDBFF] [#xDC00-#xDFFF]
-```
-
-referenced by:
-
-* PN_CHARS_BASE
-
-**PN_CHARS_BASE:**
-
-
-
-```
-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_PREFIX
-
-**PN_CHARS_U:**
-
-
-
-```
-PN_CHARS_U
- ::= PN_CHARS_BASE
- | '_'
-```
-
-referenced by:
-
-* PN_CHARS
-* PN_LOCAL
-* VARNAME
-
-**PN_CHARS:**
-
-
-
-```
-PN_CHARS ::= PN_CHARS_U
- | [-0-9#xB7#x300-#x36F#x203F-#x2040]
-```
-
-referenced by:
-
-* PN_LOCAL
-* PN_PREFIX
-
-**PN_PREFIX:**
-
-
-
-```
-PN_PREFIX
- ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
-```
-
-referenced by:
-
-* PNAME_NS
-
-**PN_LOCAL:**
-
-
-
-```
-PN_LOCAL ::= ( PN_CHARS_U | [:0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) )?
-```
-
-referenced by:
-
-* PNAME_LN
-
-**VARNAME:**
-
-
-
-```
-VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9#xB7#x300-#x36F#x203F-#x2040] )*
-```
-
-**PN_LOCAL_ESC:**
-
-
-
-```
-PN_LOCAL_ESC
- ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
-```
-
-referenced by:
-
-* PLX
-
-**PLX:**
-
-
-
-```
-PLX ::= PERCENT
- | PN_LOCAL_ESC
-```
-
-referenced by:
-
-* PN_LOCAL
-
-**PERCENT:**
-
-
-
-```
-PERCENT ::= '%' HEX HEX
-```
-
-referenced by:
-
-* PLX
-
-**UNKNOWN:**
-
-
-
-```
-UNKNOWN ::= [^ #x9#xA#xD#xC]+
-```
-
-**EOF:**
-
-
-
-```
-EOF ::= $
-```
-
-referenced by:
-
-* PathUnit
-* Unit
-
-##
- generated by [RR - Railroad Diagram Generator][RR]
-
-[RR]: https://www.bottlecaps.de/rr/ui
\ No newline at end of file
diff --git a/shacl-compact-syntax/grammar/shaclc-XText-orig.xtext b/shacl-compact-syntax/grammar/shaclc-XText-orig.xtext
new file mode 100644
index 0000000..025f62a
--- /dev/null
+++ b/shacl-compact-syntax/grammar/shaclc-XText-orig.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:
+ '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ','
+ | ';' | '=' | '/' | '?' | '#' | '@' | '%');
+
From 20c2d5b1fb9811cb4629981eb3e065242322e568 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Fri, 22 Mar 2024 10:28:23 +0200
Subject: [PATCH 4/8] add shaclc-XText.html
---
shacl-compact-syntax/grammar/README.md | 6 +-
.../grammar/shaclc-XText-orig.xtext | 1284 ---
.../grammar/shaclc-XText.ebnf | 766 ++
.../grammar/shaclc-XText.html | 7798 +++++++++++++++++
4 files changed, 8567 insertions(+), 1287 deletions(-)
delete mode 100644 shacl-compact-syntax/grammar/shaclc-XText-orig.xtext
create mode 100644 shacl-compact-syntax/grammar/shaclc-XText.ebnf
create mode 100644 shacl-compact-syntax/grammar/shaclc-XText.html
diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md
index 3f3dc27..033d5e6 100644
--- a/shacl-compact-syntax/grammar/README.md
+++ b/shacl-compact-syntax/grammar/README.md
@@ -13,8 +13,8 @@ We use two tools to understand them and try to unify them:
- https://github.com/GuntherRademacher/rr to produce "rail-road" diagrams, which make it easier to understand the grammars.
Problems:
-- Unicode escapes in XText: https://github.com/GuntherRademacher/ebnf-convert/issues/8 .
- So we also saved `shaclc-XText-orig.xtext` in case we need to adapt it.
+- 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`
- Two problems in Jison: https://github.com/w3c/shacl/issues/48 .
So we also saved `shaclc-Jison-orig.jison` in case we need to adapt it.
@@ -26,5 +26,5 @@ Problems:
Initial results:
- [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)) (BROKEN)
+- [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)) (BROKEN)
diff --git a/shacl-compact-syntax/grammar/shaclc-XText-orig.xtext b/shacl-compact-syntax/grammar/shaclc-XText-orig.xtext
deleted file mode 100644
index 025f62a..0000000
--- a/shacl-compact-syntax/grammar/shaclc-XText-orig.xtext
+++ /dev/null
@@ -1,1284 +0,0 @@
-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:
- '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ','
- | ';' | '=' | '/' | '?' | '#' | '@' | '%');
-
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:
+
+
+ no references
Directive:
+
+
+ referenced by:
+
+
BaseDecl:
+
+
+ referenced by:
+
+
ImportsDecl:
+
+
+ referenced by:
+
+
PrefixDecl:
+
+
+ referenced by:
+
+
ShapeClass:
+
+
+ referenced by:
+
+
NodeShape:
+
+
+ referenced by:
+
+
PropertyShape:
+
+
+ referenced by:
+
+
RuleShape:
+
+
+ referenced by:
+
+
TargetShape:
+
+
+ referenced by:
+
+
FunctionShape:
+
+
+ referenced by:
+
+
Target:
+
+
+ referenced by:
+
+
TargetClasses:
+
+
+ referenced by:
+
+
TargetSubjectsOf:
+
+
+ referenced by:
+
+
TargetObjectsOf:
+
+
+ referenced by:
+
+
TargetSelect:
+
+
+ referenced by:
+
+
TargetNodes:
+
+
+ referenced by:
+
+
TargetTargets:
+
+
+ referenced by:
+
+
TargetCall:
+
+
+ referenced by:
+
+
RuleBody:
+
+
+ referenced by:
+
+
TargetBody:
+
+
+ referenced by:
+
+
TargetDeclaration:
+
+
+ referenced by:
+
+
FunctionDeclaration:
+
+
+ referenced by:
+
+
FunctionBody:
+
+
+ referenced by:
+
+
ParameterDeclaration:
+
+
+ referenced by:
+
+
ParameterAssignment:
+
+
+ referenced by:
+
+
ParameterAssignments:
+
+
+ referenced by:
+
+
SparqlConstraint:
+
+
+ referenced by:
+
+
SelectQuery:
+
+
+ referenced by:
+
+
DescribeQuery:
+
+
+ no references
SelectClause:
+
+
+ referenced by:
+
+
SelectItem:
+
+
+ referenced by:
+
+
AskQuery:
+
+
+ referenced by:
+
+
DatasetClause:
+
+
+ referenced by:
+
+
WhereClause:
+
+
+ referenced by:
+
+
SolutionModifier:
+
+
+ referenced by:
+
+
ConstructQuery:
+
+
+ referenced by:
+
+
ConstructTemplate:
+
+
+ referenced by:
+
+
TriplesSameSubject:
+
+
+ referenced by:
+
+
TriplesSameSubjectPath:
+
+
+ referenced by:
+
+
OrderClause:
+
+
+ referenced by:
+
+
OrderCondition:
+
+
+ referenced by:
+
+
ValuesClause:
+
+
+ referenced by:
+
+
DataBlock:
+
+
+ referenced by:
+
+
DataBlockOneVar:
+
+
+ referenced by:
+
+
DataBlockFull:
+
+
+ referenced by:
+
+
DataBlockValue:
+
+
+ referenced by:
+
+
DataBlockValues:
+
+
+ referenced by:
+
+
GroupClause:
+
+
+ referenced by:
+
+
GroupCondition:
+
+
+ referenced by:
+
+
HavingClause:
+
+
+ referenced by:
+
+
HavingCondition:
+
+
+ referenced by:
+
+
Constraint:
+
+
+ referenced by:
+
+
GroupGraphPattern:
+
+
+ referenced by:
+
+
GraphPatternPart:
+
+
+ referenced by:
+
+
SubSelect:
+
+
+ referenced by:
+
+
GraphPatternNotTriples:
+
+
+ referenced by:
+
+
Bind:
+
+
+ referenced by:
+
+
InlineData:
+
+
+ referenced by:
+
+
MinusGraphPattern:
+
+
+ referenced by:
+
+
OptionalGraphPattern:
+
+
+ referenced by:
+
+
GraphGraphPattern:
+
+
+ referenced by:
+
+
UnionGraphPattern:
+
+
+ referenced by:
+
+
ServiceGraphPattern:
+
+
+ no references
TriplesBlock:
+
+
+ referenced by:
+
+
Filter:
+
+
+ referenced by:
+
+
PropertyListPathNotEmpty:
+
+
+ referenced by:
+
+
PathOrVariable:
+
+
+ referenced by:
+
+
PropertyListPath:
+
+
+ referenced by:
+
+
PathObjectList:
+
+
+ referenced by:
+
+
PathObjectListPath:
+
+
+ referenced by:
+
+
PropertyListNotEmpty:
+
+
+ referenced by:
+
+
PropertyList:
+
+
+ referenced by:
+
+
VerbObjectList:
+
+
+ referenced by:
+
+
Verb:
+
+
+ referenced by:
+
+
ObjectList:
+
+
+ referenced by:
+
+
ObjectListPath:
+
+
+ referenced by:
+
+
Object:
+
+
+ referenced by:
+
+
ObjectPath:
+
+
+ referenced by:
+
+
Collection:
+
+
+ referenced by:
+
+
CollectionPath:
+
+
+ referenced by:
+
+
GraphNode:
+
+
+ referenced by:
+
+
GraphNodePath:
+
+
+ referenced by:
+
+
TriplesNode:
+
+
+ referenced by:
+
+
TriplesNodePath:
+
+
+ referenced by:
+
+
BlankNodePropertyList:
+
+
+ referenced by:
+
+
BlankNodePropertyListPath:
+
+
+ referenced by:
+
+
VarOrTerm:
+
+
+ referenced by:
+
+
GraphTerm:
+
+
+ referenced by:
+
+
BuiltInCall:
+
+
+ referenced by:
+
+
ExistsFunc:
+
+
+ referenced by:
+
+
NotExistsFunc:
+
+
+ referenced by:
+
+
Aggregate:
+
+
+ referenced by:
+
+
Expression:
+
+
+ referenced by:
+
+
ConditionalOrExpression:
+
+
+ referenced by:
+
+
ConditionalAndExpression:
+
+
+ referenced by:
+
+
ValueLogical:
+
+
+ referenced by:
+
+
RelationalExpression:
+
+
+ referenced by:
+
+
ExpressionList:
+
+
+ referenced by:
+
+
NumericExpression:
+
+
+ referenced by:
+
+
AdditiveExpression:
+
+
+ referenced by:
+
+
AdditiveTerm:
+
+
+ referenced by:
+
+
MultiplicativeExpression:
+
+
+ referenced by:
+
+
MultiplicativeTerm:
+
+
+ referenced by:
+
+
UnaryExpression:
+
+
+ referenced by:
+
+
PrimaryExpression:
+
+
+ referenced by:
+
+
BrackettedExpression:
+
+
+ referenced by:
+
+
IriOrFunction:
+
+
+ referenced by:
+
+
FunctionCall:
+
+
+ referenced by:
+
+
ArgList:
+
+
+ referenced by:
+
+
VarOrIri:
+
+
+ referenced by:
+
+
LimitClause:
+
+
+ referenced by:
+
+
OffsetClause:
+
+
+ referenced by:
+
+
RuleBodyOrRef:
+
+
+ referenced by:
+
+
NodeConstraint:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ referenced by:
+
+
PropertyConstraint:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ referenced by:
+
+
PropertyCount:
+
+
+ referenced by:
+
+
PropertyMinCount:
+
+
+ referenced by:
+
+
PropertyMaxCount:
+
+
+ referenced by:
+
+
NodeKind:
+
+
+ | 'IRI'
+ | 'Literal'
+ | 'BlankNodeOrIRI'
+ | 'BlankNodeOrLiteral'
+ | 'IRIOrLiteral'
+
+ referenced by:
+
+
PropertyShapeOrRef:
+
+
+ referenced by:
+
+
PropertyShapeBody:
+
+
+ referenced by:
+
+
PropertyExpression:
+
+
+ referenced by:
+
+
PropertyOr:
+
+
+ referenced by:
+
+
PropertyXOne:
+
+
+ referenced by:
+
+
PropertyAnd:
+
+
+ referenced by:
+
+
PropertyNot:
+
+
+ referenced by:
+
+
PropertyBracketted:
+
+
+ referenced by:
+
+
PropertyAtom:
+
+
+
+
+
+
+
+
+
+ | ( 'message' | 'severity' )
Str
+ | 'closed'
+ | 'deactivated'
+
+ referenced by:
+
+
NodeShapeOrRef:
+
+
+ referenced by:
+
+
NodeShapeBody:
+
+
+ referenced by:
+
+
NodeExpression:
+
+
+ referenced by:
+
+
NodeOr:
+
+
+ referenced by:
+
+
NodeXOne:
+
+
+ referenced by:
+
+
NodeAnd:
+
+
+ referenced by:
+
+
NodeNot:
+
+
+ referenced by:
+
+
NodeBracketted:
+
+
+ referenced by:
+
+
NodeAtom:
+
+
+
+
+
+
+
+
+ | ( 'message' | 'severity' )
Str
+ | 'closed'
+ | 'deactivated'
+
+ referenced by:
+
+
NameAnnotation:
+
+
+ referenced by:
+
+
DescriptionAnnotation:
+
+
+ referenced by:
+
+
DefaultValueAnnotation:
+
+
+ referenced by:
+
+
TypeConstraint:
+
+
+ ::= ( 'class' | 'type' )
Iri
+
+ referenced by:
+
+
InConstraint:
+
+
+ referenced by:
+
+
HasValueConstraint:
+
+
+ referenced by:
+
+
MinExclusiveConstraint:
+
+
+ referenced by:
+
+
MinInclusiveConstraint:
+
+
+ referenced by:
+
+
MaxExclusiveConstraint:
+
+
+ referenced by:
+
+
MaxInclusiveConstraint:
+
+
+ referenced by:
+
+
MinLengthConstraint:
+
+
+ referenced by:
+
+
MaxLengthConstraint:
+
+
+ referenced by:
+
+
PatternConstraint:
+
+
+ referenced by:
+
+
LessThanConstraint:
+
+
+ referenced by:
+
+
LessThanOrEqualConstraint:
+
+
+ referenced by:
+
+
FN_STR:
+
+
+ referenced by:
+
+
FN_LANG:
+
+
+ referenced by:
+
+
FN_LANGMATCHES:
+
+
+ ::= 'LANGMATCHES'
+ | 'langmatches'
+
+ referenced by:
+
+
FN_DATATYPE:
+
+
+ ::= 'DATATYPE'
+ | 'datatype'
+
+ referenced by:
+
+
FN_BOUND:
+
+
+ referenced by:
+
+
FN_IRI:
+
+
+ referenced by:
+
+
FN_URI:
+
+
+ referenced by:
+
+
FN_BNODE:
+
+
+ referenced by:
+
+
FN_RAND:
+
+
+ referenced by:
+
+
FN_CEIL:
+
+
+ referenced by:
+
+
FN_FLOOR:
+
+
+ referenced by:
+
+
FN_ROUND:
+
+
+ referenced by:
+
+
FN_CONCAT:
+
+
+ ::= 'CONCAT'
+ | 'concat'
+
+ referenced by:
+
+
FN_SUBSTR:
+
+
+ ::= 'SUBSTR'
+ | 'substr'
+
+ referenced by:
+
+
FN_STRLEN:
+
+
+ ::= 'STRLEN'
+ | 'strlen'
+
+ referenced by:
+
+
FN_REPLACE:
+
+
+ ::= 'REPLACE'
+ | 'replace'
+
+ referenced by:
+
+
FN_UCASE:
+
+
+ referenced by:
+
+
FN_LCASE:
+
+
+ referenced by:
+
+
FN_ENCODE_FOR_URI:
+
+
+ ::= 'ENCODE_FOR_URI'
+ | 'encode_for_uri'
+
+ referenced by:
+
+
FN_CONTAINS:
+
+
+ ::= 'CONTAINS'
+ | 'contains'
+
+ referenced by:
+
+
FN_STRSTARTS:
+
+
+ ::= 'STRSTARTS'
+ | 'strstarts'
+
+ referenced by:
+
+
FN_STRENDS:
+
+
+ ::= 'STRENDS'
+ | 'strends'
+
+ referenced by:
+
+
FN_STRBEFORE:
+
+
+ ::= 'STRBEFORE'
+ | 'strbefore'
+
+ referenced by:
+
+
FN_STRAFTER:
+
+
+ ::= 'STRAFTER'
+ | 'strafter'
+
+ referenced by:
+
+
FN_YEAR:
+
+
+ referenced by:
+
+
FN_MONTH:
+
+
+ referenced by:
+
+
FN_DAY:
+
+
+ referenced by:
+
+
FN_HOURS:
+
+
+ referenced by:
+
+
FN_MINUTES:
+
+
+ ::= 'MINUTES'
+ | 'minutes'
+
+ referenced by:
+
+
FN_SECONDS:
+
+
+ ::= 'SECONDS'
+ | 'seconds'
+
+ referenced by:
+
+
FN_TIMEZONE:
+
+
+ ::= 'TIMEZONE'
+ | 'timezone'
+
+ referenced by:
+
+
FN_TZ:
+
+
+ referenced by:
+
+
FN_NOW:
+
+
+ referenced by:
+
+
FN_UUID:
+
+
+ referenced by:
+
+
FN_STRUUID:
+
+
+ ::= 'STRUUID'
+ | 'struuid'
+
+ referenced by:
+
+
FN_MD5:
+
+
+ referenced by:
+
+
FN_SHA1:
+
+
+ referenced by:
+
+
FN_SHA256:
+
+
+ ::= 'SHA256'
+ | 'sha256'
+
+ referenced by:
+
+
FN_SHA384:
+
+
+ ::= 'SHA384'
+ | 'sha384'
+
+ referenced by:
+
+
FN_SHA512:
+
+
+ ::= 'SHA512'
+ | 'sha512'
+
+ referenced by:
+
+
FN_COALESCE:
+
+
+ ::= 'COALESCE'
+ | 'coalesce'
+
+ referenced by:
+
+
FN_IF:
+
+
+ referenced by:
+
+
FN_STRLANG:
+
+
+ ::= 'STRLANG'
+ | 'strlang'
+
+ referenced by:
+
+
FN_STRDT:
+
+
+ referenced by:
+
+
FN_SAMETERM:
+
+
+ ::= 'sameTerm'
+ | 'SAMETERM'
+ | 'sameterm'
+
+ referenced by:
+
+
FN_ISURI:
+
+
+ | 'ISURI'
+ | 'isuri'
+
+ referenced by:
+
+
FN_ISBLANK:
+
+
+ ::= 'isBLANK'
+ | 'ISBLANK'
+ | 'isblank'
+
+ referenced by:
+
+
FN_ISLITERAL:
+
+
+ ::= 'isLITERAL'
+ | 'ISLITERAL'
+ | 'isliteral'
+
+ referenced by:
+
+
FN_REGEXP:
+
+
+ ::= 'REGEX'
+ | 'regexp'
+
+ referenced by:
+
+
FN_COUNT:
+
+
+ referenced by:
+
+
FN_AVG:
+
+
+ referenced by:
+
+
FN_MIN:
+
+
+ referenced by:
+
+
FN_MAX:
+
+
+ referenced by:
+
+
FN_GROUP_CONCAT:
+
+
+ ::= 'GROUP_CONCAT'
+ | 'group_concat'
+
+ referenced by:
+
+
FN_SEPARATOR:
+
+
+ ::= 'SEPARATOR'
+ | 'separator'
+
+ referenced by:
+
+
FN_SUM:
+
+
+ referenced by:
+
+
FN_SAMPLE:
+
+
+ ::= 'SAMPLE'
+ | 'sample'
+
+ referenced by:
+
+
SKW_ASK:
+
+
+ referenced by:
+
+
SKW_SELECT:
+
+
+ ::= 'SELECT'
+ | 'select'
+
+ referenced by:
+
+
SKW_GRAPH:
+
+
+ ::= 'GRAPH'
+ | 'graph'
+
+ referenced by:
+
+
SKW_OPTIONAL:
+
+
+ ::= 'OPTIONAL'
+ | 'optional'
+
+ referenced by:
+
+
SKW_GROUP:
+
+
+ ::= 'GROUP'
+ | 'group'
+
+ referenced by:
+
+
SKW_BIND:
+
+
+ referenced by:
+
+
SKW_HAVING:
+
+
+ ::= 'HAVING'
+ | 'having'
+
+ referenced by:
+
+
SKW_AS:
+
+
+ referenced by:
+
+
SKW_ORDER:
+
+
+ ::= 'ORDER'
+ | 'order'
+
+ referenced by:
+
+
SKW_UNION:
+
+
+ ::= 'UNION'
+ | 'union'
+
+ referenced by:
+
+
SKW_MINUS:
+
+
+ ::= 'MINUS'
+ | 'minus'
+
+ referenced by:
+
+
SKW_VALUES:
+
+
+ ::= 'VALUES'
+ | 'values'
+
+ referenced by:
+
+
SKW_NAMED:
+
+
+ ::= 'NAMED'
+ | 'named'
+
+ referenced by:
+
+
SKW_FROM:
+
+
+ referenced by:
+
+
SKW_BY:
+
+
+ referenced by:
+
+
SKW_LIMIT:
+
+
+ ::= 'LIMIT'
+ | 'limit'
+
+ referenced by:
+
+
SKW_FILTER:
+
+
+ ::= 'FILTER'
+ | 'filter'
+
+ referenced by:
+
+
SKW_ASC:
+
+
+ referenced by:
+
+
SKW_DESC:
+
+
+ referenced by:
+
+
SKW_EXISTS:
+
+
+ ::= 'EXISTS'
+ | 'exists'
+
+ referenced by:
+
+
SKW_OFFSET:
+
+
+ ::= 'OFFSET'
+ | 'offset'
+
+ referenced by:
+
+
SKW_DISTINCT:
+
+
+ ::= 'DISTINCT'
+ | 'distinct'
+
+ referenced by:
+
+
SKW_REDUCED:
+
+
+ ::= 'REDUCED'
+ | 'reduced'
+
+ referenced by:
+
+
SKW_CONSTRUCT:
+
+
+ ::= 'CONSTRUCT'
+ | 'construct'
+
+ referenced by:
+
+
SKW_WHERE:
+
+
+ ::= 'WHERE'
+ | 'where'
+
+ referenced by:
+
+
SKW_DESCRIBE:
+
+
+ ::= 'DESCRIBE'
+ | 'describe'
+
+ referenced by:
+
+
SKW_NOT:
+
+
+ referenced by:
+
+
SKW_IN:
+
+
+ referenced by:
+
+
SKW_SERVICE:
+
+
+ ::= 'SERVICE'
+ | 'service'
+
+ referenced by:
+
+
SKW_SILENT:
+
+
+ ::= 'SILENT'
+ | 'silent'
+
+ referenced by:
+
+
ShapeRef:
+
+
+ referenced by:
+
+
RuleRef:
+
+
+ referenced by:
+
+
TargetRef:
+
+
+ referenced by:
+
+
FunctionRef:
+
+
+ no references
Path:
+
+
+ referenced by:
+
+
PathAlternative:
+
+
+ referenced by:
+
+
PathSequence:
+
+
+ referenced by:
+
+
PathElt:
+
+
+ referenced by:
+
+
PathEltOrInverse:
+
+
+ referenced by:
+
+
PathMod:
+
+
+ referenced by:
+
+
PathPrimary:
+
+
+ referenced by:
+
+
PathNegatedPropertySet:
+
+
+ referenced by:
+
+
PathOneInPropertySet:
+
+
+ referenced by:
+
+
IriOrLiteralOrArray:
+
+
+ no references
IriOrLiteral:
+
+
+ referenced by:
+
+
Iri:
+
+
+ referenced by:
+
+
PrefixedName:
+
+
+ referenced by:
+
+
PrefixedLabel:
+
+
+ referenced by:
+
+
BlankNode:
+
+
+ referenced by:
+
+
Literal:
+
+
+ referenced by:
+
+
BooleanLiteral:
+
+
+ ::= 'true'
+ | 'false'
+
+ referenced by:
+
+
NumericLiteral:
+
+
+ referenced by:
+
+
RdfLiteral:
+
+
+ referenced by:
+
+
Str:
+
+
+ referenced by:
+
+
Array:
+
+
+ referenced by:
+
+
Variable:
+
+
+ referenced by:
+
+
KW_AND:
+
+
+ referenced by:
+
+
KW_OR:
+
+
+ referenced by:
+
+
KW_XONE:
+
+
+ referenced by:
+
+
KW_NOT:
+
+
+ referenced by:
+
+
OP_AND:
+
+
+ referenced by:
+
+
OP_OR:
+
+
+ referenced by:
+
+
OP_NOT:
+
+
+ referenced by:
+
+
OP_XONE:
+
+
+ referenced by:
+
+
VAR1:
+
+
+ referenced by:
+
+
VAR2:
+
+
+ referenced by:
+
+
VARNAME:
+
+
+ referenced by:
+
+
PASS:
+
+
+ no references
COMMENT:
+
+
+ no references
IRIREF:
+
+ IRIREF ::= '<' ( [^<>"{}|^`\#x0-#x20#xAB#xBB] |
UCHAR )* '>'
+
+ referenced by:
+
+
LABEL_REF1:
+
+
+ ::= #xAB (
.* - (
.* #xBB
.* ) ) #xBB
+
+ referenced by:
+
+
LABEL_REF2:
+
+
+ ::= '<<' (
.* - (
.* '>>'
.* ) ) '>>'
+
+ referenced by:
+
+
PNAME_NS:
+
+
+ referenced by:
+
+
PNAME_LN:
+
+
+ referenced by:
+
+
AT_PNAME_NS:
+
+
+ referenced by:
+
+
AT_PNAME_LN:
+
+
+ referenced by:
+
+
AT_IRIREF:
+
+
+ referenced by:
+
+
DTYPETAG:
+
+
+ referenced by:
+
+
BLANK_NODE_LABEL:
+
+
+ referenced by:
+
+
LANGTAG:
+
+ LANGTAG ::= '@' [A-Za-z]+ ( '-' [A-Za-z0-9]+ )*
+
+ referenced by:
+
+
INTEGER:
+
+
+ referenced by:
+
+
DECIMAL:
+
+
+ referenced by:
+
+
DOUBLE:
+
+
+ referenced by:
+
+
UCASE_LABEL:
+
+
+ ::= [A-Z_] ( [A-Z_] |
DIGIT )*
+
+ no references
EXPONENT:
+
+
+ referenced by:
+
+
STRING_LITERAL1:
+
+
+ referenced by:
+
+
STRING_LITERAL2:
+
+
+ referenced by:
+
+
STRING_LITERAL_LONG1:
+
+
+ ::= "'''" ( ( "'" | "''" )? ( [^'\] |
ECHAR |
UCHAR ) )* "'''"
+
+ referenced by:
+
+
STRING_LITERAL_LONG2:
+
+
+ ::= '"""' ( ( '"' | '""' )? ( [^"\] |
ECHAR |
UCHAR ) )* '"""'
+
+ referenced by:
+
+
DIGIT:
+
+
+ referenced by:
+
+
UCHAR:
+
+
+ referenced by:
+
+
ECHAR:
+
+
+ referenced by:
+
+
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]
+
+ referenced by:
+
+
PN_CHARS_U:
+
+
+ referenced by:
+
+
PN_CHARS:
+
+
+ | [-#xB7#x300-#x36F#x203F-#x2040]
+
+
+ referenced by:
+
+
PN_PREFIX:
+
+
+ referenced by:
+
+
PN_LOCAL:
+
+
+ referenced by:
+
+
PLX:
+
+
+ referenced by:
+
+
PERCENT:
+
+
+ referenced by:
+
+
HEX:
+
+
+ referenced by:
+
+
PN_LOCAL_ESC:
+
+
+ ::= '\' [_~.!$&'()*+,;=/?@%#x2D#x23]
+
+ referenced by:
+
+
+
+
+
+
+
\ No newline at end of file
From eaa3471dbe7058271750f68238cb54f65257719f Mon Sep 17 00:00:00 2001
From: Jesse Wright <63333554+jeswr@users.noreply.github.com>
Date: Thu, 25 Apr 2024 17:44:26 +0100
Subject: [PATCH 5/8] feat: add jison enbf
---
.../grammar/shaclc-Jison.ebnf | 116 ++++
.../grammar/shaclc-Jison.html | 588 ++++++++++++++++++
.../grammar/shaclc-Jison.jison | 170 ++---
3 files changed, 804 insertions(+), 70 deletions(-)
create mode 100644 shacl-compact-syntax/grammar/shaclc-Jison.ebnf
create mode 100644 shacl-compact-syntax/grammar/shaclc-Jison.html
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:

+
+
+ referenced by:
+
+
+
baseDecl:

+
+
+ referenced by:
+
+
+
importsDecl:

+
+
+ referenced by:
+
+
+
prefixDecl:

+
+
+ referenced by:
+
+
+
nodeShapeIri:

+
+
+ referenced by:
+
+
+
nodeShape:

+
+
+ referenced by:
+
+
+
shapeClass:

+
+
+ referenced by:
+
+
+
turtleAnnotation:

+
+
+ referenced by:
+
+
+
turtleAnnotation2:

+
+
+ referenced by:
+
+
+
predicate:

+
+
+ referenced by:
+
+
+
objectList:

+
+
+ referenced by:
+
+
+
object:

+
+
+ referenced by:
+
+
+
list:

+
+
+ referenced by:
+
+
+
objectTail:

+
+
+ referenced by:
+
+
+
blankNodeSection:

+
+
+ referenced by:
+
+
+
pcSection:

+
+
+ referenced by:
+
+
+
iriHead:

+
+
+ referenced by:
+
+
+
ttlStatement:

+
+
+ referenced by:
+
+
+
nodeShapeBody:

+
+
+ referenced by:
+
+
+
targetClass:

+
+
+ referenced by:
+
+
+
constraint:

+
+
+ referenced by:
+
+
+
orNotComponent:

+
+
+ referenced by:
+
+
+
nodeOrEmit:

+
+
+ referenced by:
+
+
+
nodeOr:

+
+
+ referenced by:
+
+
+
nodeNot:

+
+
+ referenced by:
+
+
+
targetOrParam:

+
+
+ referenced by:
+
+
+
nodeValue:

+
+
+ referenced by:
+
+
+
propertyOrComponent:

+
+
+ referenced by:
+
+
+
propertyNot:

+
+
+ referenced by:
+
+
+
propertyAtom:

+
+
+ referenced by:
+
+
+
propertyCount:

+
+
+ referenced by:
+
+
+
propertyMinCount:

+
+
+ referenced by:
+
+
+
propertyMaxCount:

+
+
+ referenced by:
+
+
+
shapeRef:

+
+
+ referenced by:
+
+
+
path:

+
+
+ referenced by:
+
+
+
additionalAlternative:

+
+
+ referenced by:
+
+
+
pathAlternative:

+
+
+ referenced by:
+
+
+
additionalSequence:

+
+
+ referenced by:
+
+
+
pathSequence:

+
+
+ referenced by:
+
+
+
pathElt:

+
+
+ referenced by:
+
+
+
pathEltOrInverse:

+
+
+ referenced by:
+
+
+
pathMod:

+
+
+ referenced by:
+
+
+
pathPrimary:

+
+
+ referenced by:
+
+
+
iriOrLiteralOrArray:

+
+
+ referenced by:
+
+
+
iriOrLiteral:

+
+
+ referenced by:
+
+
+
iri:

+
+
+ referenced by:
+
+
+
literal:

+
+
+ referenced by:
+
+
+
string:

+
+
+ 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
index 1907fd0..aa11fe8 100644
--- a/shacl-compact-syntax/grammar/shaclc-Jison.jison
+++ b/shacl-compact-syntax/grammar/shaclc-Jison.jison
@@ -251,20 +251,37 @@ PARAM 'deactivated' | 'severity' | 'message' | 'class' | 'data
<> return 'EOF'
-/lex
+%ebnf
-// %ebnf
+/lex
%start shaclDoc
%%
-// TODO: Work out why this occurs multiple times when the empty file is called with other things (the base from the previous file is somehow getting leaked thorugh)
-shaclDoc : directive* (nodeShape|shapeClass)* ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology'))
+
+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 ;
- // TODO: Remove the duplicate declaration of base
+
baseDecl : KW_BASE IRIREF
{
Parser.base = Parser.factory.namedNode($2.slice(1, -1));
@@ -272,7 +289,6 @@ baseDecl : KW_BASE IRIREF
}
;
- // TODO: See if this should be resolveIRI($2)
importsDecl : KW_IMPORTS IRIREF -> emit(Parser.base, Parser.factory.namedNode(OWL + 'imports'), Parser.factory.namedNode($2.slice(1, -1)))
;
@@ -286,22 +302,32 @@ nodeShapeIri : iri
}
;
-nodeShape : KW_SHAPE nodeShapeIri targetClass? turtleAnnotation? nodeShapeBody
+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'))
+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 turtleAnnotation?
+turtleAnnotation2 : predicate
+ | predicate turtleAnnotation
;
predicate : iri objectList -> $2.forEach(e => emit(Parser.currentNodeShape, $1, e))
;
-objectList : object objectTail* -> [$1, ...$2]
+objectList : object -> [$1]
+ | object objectTailOrMore -> [$1, ...$2]
+ ;
+
+objectTailOrMore : objectTail
+ | objectTailOrMore objectTail
;
object : iriOrLiteral
@@ -309,7 +335,12 @@ object : iriOrLiteral
| list
;
-list : '(' object* ')' -> addList($2, true)
+objectOrMore : object
+ | objectOrMore object
+ ;
+
+list : '(' ')' -> addList([], true)
+ | '(' objectOrMore ')' -> addList($2, true)
;
objectTail : ',' object -> $2
@@ -356,7 +387,8 @@ iriHead : iri
ttlStatement : iriHead turtleAnnotation2 "."
;
-ttlSection : ttlStatement*
+ttlSection : ttlStatement
+ | ttlSection ttlStatement
;
startNodeShape : '{'
@@ -366,7 +398,6 @@ startNodeShape : '{'
} else {
Parser.nodeShapeStack.push(Parser.currentNodeShape);
emit(
- // In the grammar a path signals the start of a new property declaration
Parser.currentPropertyNode,
Parser.factory.namedNode(SH + 'node'),
Parser.currentNodeShape = blank(),
@@ -385,13 +416,31 @@ endNodeShape : '}'
}
;
-nodeShapeBody : startNodeShape constraint* endNodeShape -> $1
+constraintOrMore : constraint
+ | constraintOrMore constraint
+ ;
+
+nodeShapeBody : startNodeShape endNodeShape -> $1
+ | startNodeShape constraintOrMore endNodeShape -> $1
;
-targetClass : '->' iri+ -> $2.forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) })
+iriOrMore : iri
+ | iriOrMore iri
;
-constraint : ( nodeOrEmit+ | propertyShape ) pcSection? '.'
+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
@@ -400,11 +449,14 @@ orNotComponent : '|' nodeNot -> $2
nodeOrEmit : nodeOr -> emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $1[0]), $1[1])
;
+orNotComponentOrMore : orNotComponent
+ | orNotComponentOrMore orNotComponent
+ ;
+
nodeOr : nodeNot
{
- // console.log('ndoe not')
}
- | nodeNot orNotComponent+
+ | nodeNot orNotComponentOrMore
{
const o = addList([$1, ...$2].map(elem => {
const x = blank();
@@ -418,28 +470,22 @@ nodeOr : nodeNot
nodeNot : nodeValue
| negation nodeValue -> chainProperty('not', ...$2)
;
-nodeValue : (TARGET | PARAM) '=' iriOrLiteralOrArray -> [$1, $3]
+
+targetOrParam : TARGET | PARAM ;
+
+nodeValue : targetOrParam '=' iriOrLiteralOrArray -> [$1, $3]
;
-propertyShape : path ( propertyCount | propertyOr )*
+propertyShape : path
+ | propertyShape propertyCount
+ | propertyShape propertyOr
;
propertyOrComponent : '|' propertyNot -> $2
;
-// Top level property emission
-propertyOr : propertyNot -> $1 && emitProperty(...$1)
- | propertyNot propertyOrComponent+
- {
- $$ = emitProperty(
- 'or',
- addList([$1, ...$2].map(elem => {
- const x = blank();
- emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
- return x;
- }))
- )
- }
+propertyOr : propertyNot
+ | propertyOr propertyOrComponent
;
propertyNot : propertyAtom
@@ -450,7 +496,6 @@ 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]
- // TODO: Fix this workaround (the node *should* be emitted this way)
| nodeShapeBody -> undefined //['node', $1]
;
@@ -464,9 +509,9 @@ propertyMaxCount : INTEGER -> emitProperty('maxCount', createTypedLiteral($1,
| '*'
;
- // TODO: Check this
-shapeRef : (ATPNAME_LN | ATPNAME_NS) -> expandPrefix($1.slice(1))
- | '@' IRIREF -> resolveIRI($2)
+shapeRef : ATPNAME_LN
+ | ATPNAME_NS
+ | '@' IRIREF
;
negation : '!' ;
@@ -474,7 +519,6 @@ negation : '!' ;
path : pathAlternative
{
emit(
- // In the grammar a path signals the start of a new property declaration
Parser.currentNodeShape,
Parser.factory.namedNode(SH + 'property'),
Parser.currentPropertyNode = blank(),
@@ -488,36 +532,21 @@ additionalAlternative : '|' pathSequence -> $2
;
pathAlternative : pathSequence
- | pathSequence additionalAlternative+
- {
- const n = blank();
- emit(
- n,
- Parser.factory.namedNode(SH + 'alternativePath'),
- addList([$1, ...$2])
- )
- $$ = n
- }
+ | pathAlternative additionalAlternative
;
additionalSequence : '/' pathEltOrInverse -> $2
;
pathSequence : pathEltOrInverse
- | pathEltOrInverse additionalSequence+ -> addList([$1, ...$2])
+ | pathSequence additionalSequence
;
pathElt : pathPrimary
| pathPrimary pathMod
- {
- emit($$ = blank(), Parser.factory.namedNode(SH + $2), $1)
- }
;
pathEltOrInverse : pathElt
| pathInverse pathElt
- {
- emit($$ = blank(), Parser.factory.namedNode(SH + 'inversePath'), $2)
- }
;
pathInverse : '^' ;
pathMod : '?' -> 'zeroOrOnePath'
@@ -526,39 +555,40 @@ pathMod : '?' -> 'zeroOrOnePath'
;
pathPrimary : iri
- // TODO: Check this (I don' think there needs to be any other special logic for the brackets here)
- // Note that this is pathAlternative rather than just path as path is a special trigger to emit
- // the root quad
| '(' pathAlternative ')' -> $2
;
+iriOrLiteralOrMore : iriOrLiteral
+ | iriOrLiteralOrMore iriOrLiteral
+ ;
+
iriOrLiteralOrArray : iriOrLiteral
- | '[' iriOrLiteral* ']' -> addList($2)
+ | '[' ']'
+ | '[' iriOrLiteralOrMore ']'
;
iriOrLiteral : iri | literal ;
-iri : IRIREF -> Parser.factory.namedNode(resolveIRI($1))
- // TODO: Double check expand prefix works on both
- | (PNAME_LN | PNAME_NS) -> Parser.factory.namedNode(expandPrefix($1))
- | 'a' -> ensureExtended(Parser.factory.namedNode(RDF_TYPE))
+iri : IRIREF
+ | PNAME_LN
+ | PNAME_NS
+ | 'a'
;
literal
- // RDF LITERALS
: string -> createTypedLiteral($1)
- // TODO: check this
| string LANGTAG -> createLangLiteral($1, lowercase($2.substr(1)))
| string '^^' iri -> createTypedLiteral($1, $3)
- // NUMERIC LITERALS
| INTEGER -> createTypedLiteral($1, XSD_INTEGER)
| DECIMAL -> createTypedLiteral($1, XSD_DECIMAL)
| DOUBLE -> createTypedLiteral($1.toLowerCase(), XSD_DOUBLE)
- // BOOLEAN LITERALS
- | (KW_TRUE | KW_FALSE) -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
+ | KW_TRUE -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
+ | KW_FALSE -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
;
string
- : (STRING_LITERAL1 | STRING_LITERAL2) -> unescapeString($1, 1)
- | (STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2) -> unescapeString($1, 3)
+ : STRING_LITERAL1
+ | STRING_LITERAL2
+ | STRING_LITERAL_LONG1
+ | STRING_LITERAL_LONG2
;
From 2c3058a21cdaada996d2960594af889726cfb8e2 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Fri, 2 Aug 2024 13:42:15 +0300
Subject: [PATCH 6/8] Update README.md, delete obsolete
shaclc-Jison-orig.jison. fixes https://github.com/w3c/shacl/issues/48
---
shacl-compact-syntax/grammar/README.md | 11 +-
.../grammar/shaclc-Jison-orig.jison | 564 ------------------
2 files changed, 6 insertions(+), 569 deletions(-)
delete mode 100644 shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md
index 033d5e6..1b0fca8 100644
--- a/shacl-compact-syntax/grammar/README.md
+++ b/shacl-compact-syntax/grammar/README.md
@@ -1,4 +1,4 @@
-# Unifying SHACLC Grammars
+# Unifying SHACL-C Grammars
(Task: https://github.com/w3c/shacl/issues/37#issuecomment-1997655429 )
As a first task of the SHACL Compact Syntax sub-WG, we look at proposed SHACLC grammars:
@@ -15,16 +15,17 @@ We use two tools to understand them and try to unify them:
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`
-- Two problems in Jison: https://github.com/w3c/shacl/issues/48 .
- So we also saved `shaclc-Jison-orig.jison` in case we need to adapt it.
+- 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
-Initial results:
+# 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)) (BROKEN)
+- [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-Jison-orig.jison b/shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
deleted file mode 100644
index f1b27eb..0000000
--- a/shacl-compact-syntax/grammar/shaclc-Jison-orig.jison
+++ /dev/null
@@ -1,564 +0,0 @@
-%{
-/*
- 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'
-
-/lex
-
-%ebnf
-
-%start shaclDoc
-
-%%
-
-// TODO: Work out why this occurs multiple times when the empty file is called with other things (the base from the previous file is somehow getting leaked thorugh)
-shaclDoc : directive* (nodeShape|shapeClass)* ttlSection EOF -> emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology'))
- ;
-
-directive : baseDecl | importsDecl | prefixDecl ;
- // TODO: Remove the duplicate declaration of base
-baseDecl : KW_BASE IRIREF
- {
- Parser.base = Parser.factory.namedNode($2.slice(1, -1));
- Parser.n3Parser._setBase(Parser.base.value);
- }
- ;
-
- // TODO: See if this should be resolveIRI($2)
-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
- ;
-
-shapeClass : KW_SHAPE_CLASS nodeShapeIri turtleAnnotation? nodeShapeBody -> emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class'))
- ;
-
-turtleAnnotation : ';' turtleAnnotation2 -> ensureExtended()
- ;
-
-turtleAnnotation2 : predicate turtleAnnotation?
- ;
-
-predicate : iri objectList -> $2.forEach(e => emit(Parser.currentNodeShape, $1, e))
- ;
-
-objectList : object objectTail* -> [$1, ...$2]
- ;
-
-object : iriOrLiteral
- | blankNodeSection
- | list
- ;
-
-list : '(' object* ')' -> 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*
- ;
-
-startNodeShape : '{'
- {
- if (!Parser.nodeShapeStack) {
- Parser.nodeShapeStack = [];
- } else {
- Parser.nodeShapeStack.push(Parser.currentNodeShape);
- emit(
- // In the grammar a path signals the start of a new property declaration
- Parser.currentPropertyNode,
- Parser.factory.namedNode(SH + 'node'),
- Parser.currentNodeShape = blank(),
- )
- }
-
- $$ = Parser.currentNodeShape;
- }
- ;
-
-endNodeShape : '}'
- {
- if (Parser.nodeShapeStack.length > 0) {
- Parser.currentNodeShape = Parser.nodeShapeStack.pop();
- }
- }
- ;
-
-nodeShapeBody : startNodeShape constraint* endNodeShape -> $1
- ;
-
-targetClass : '->' iri+ -> $2.forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) })
- ;
-
-constraint : ( nodeOrEmit+ | propertyShape ) pcSection? '.'
- ;
-
-orNotComponent : '|' nodeNot -> $2
- ;
-
-nodeOrEmit : nodeOr -> emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $1[0]), $1[1])
- ;
-
-nodeOr : nodeNot
- {
- // console.log('ndoe not')
- }
- | nodeNot orNotComponent+
- {
- 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)
- ;
-nodeValue : (TARGET | PARAM) '=' iriOrLiteralOrArray -> [$1, $3]
- ;
-
-propertyShape : path ( propertyCount | propertyOr )*
- ;
-
-propertyOrComponent : '|' propertyNot -> $2
- ;
-
-// Top level property emission
-propertyOr : propertyNot -> $1 && emitProperty(...$1)
- | propertyNot propertyOrComponent+
- {
- $$ = emitProperty(
- 'or',
- addList([$1, ...$2].map(elem => {
- const x = blank();
- emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
- return x;
- }))
- )
- }
- ;
-
-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]
- // TODO: Fix this workaround (the node *should* be emitted this way)
- | 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))
- | '*'
- ;
-
- // TODO: Check this
-shapeRef : (ATPNAME_LN | ATPNAME_NS) -> expandPrefix($1.slice(1))
- | '@' IRIREF -> resolveIRI($2)
- ;
-
-negation : '!' ;
-
-path : pathAlternative
- {
- emit(
- // In the grammar a path signals the start of a new property declaration
- Parser.currentNodeShape,
- Parser.factory.namedNode(SH + 'property'),
- Parser.currentPropertyNode = blank(),
- )
-
- emitProperty('path', $1)
- }
- ;
-
-additionalAlternative : '|' pathSequence -> $2
- ;
-
-pathAlternative : pathSequence
- | pathSequence additionalAlternative+
- {
- const n = blank();
- emit(
- n,
- Parser.factory.namedNode(SH + 'alternativePath'),
- addList([$1, ...$2])
- )
- $$ = n
- }
- ;
-
-additionalSequence : '/' pathEltOrInverse -> $2
- ;
-
-pathSequence : pathEltOrInverse
- | pathEltOrInverse additionalSequence+ -> addList([$1, ...$2])
-
- ;
-pathElt : pathPrimary
- | pathPrimary pathMod
- {
- emit($$ = blank(), Parser.factory.namedNode(SH + $2), $1)
- }
- ;
-pathEltOrInverse : pathElt
- | pathInverse pathElt
- {
- emit($$ = blank(), Parser.factory.namedNode(SH + 'inversePath'), $2)
- }
- ;
-pathInverse : '^' ;
-pathMod : '?' -> 'zeroOrOnePath'
- | '*' -> 'zeroOrMorePath'
- | '+' -> 'oneOrMorePath'
- ;
-
-pathPrimary : iri
- // TODO: Check this (I don' think there needs to be any other special logic for the brackets here)
- // Note that this is pathAlternative rather than just path as path is a special trigger to emit
- // the root quad
- | '(' pathAlternative ')' -> $2
- ;
-
-iriOrLiteralOrArray : iriOrLiteral
- | '[' iriOrLiteral* ']' -> addList($2)
- ;
-
-iriOrLiteral : iri | literal ;
-
-iri : IRIREF -> Parser.factory.namedNode(resolveIRI($1))
- // TODO: Double check expand prefix works on both
- | (PNAME_LN | PNAME_NS) -> Parser.factory.namedNode(expandPrefix($1))
- | 'a' -> ensureExtended(Parser.factory.namedNode(RDF_TYPE))
- ;
-
-literal
- // RDF LITERALS
- : string -> createTypedLiteral($1)
- // TODO: check this
- | string LANGTAG -> createLangLiteral($1, lowercase($2.substr(1)))
- | string '^^' iri -> createTypedLiteral($1, $3)
- // NUMERIC LITERALS
- | INTEGER -> createTypedLiteral($1, XSD_INTEGER)
- | DECIMAL -> createTypedLiteral($1, XSD_DECIMAL)
- | DOUBLE -> createTypedLiteral($1.toLowerCase(), XSD_DOUBLE)
- // BOOLEAN LITERALS
- | (KW_TRUE | KW_FALSE) -> createTypedLiteral($1.toLowerCase(), XSD_BOOLEAN)
- ;
-
-string
- : (STRING_LITERAL1 | STRING_LITERAL2) -> unescapeString($1, 1)
- | (STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2) -> unescapeString($1, 3)
- ;
From 11eae8412a2d1ac7a57db8b8c0882a18852d6397 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Sun, 11 Aug 2024 11:22:50 +0300
Subject: [PATCH 7/8] accept SHACL-C spelling
Co-authored-by: Ted Thibodeau Jr
---
shacl-compact-syntax/grammar/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md
index 1b0fca8..f5e1e97 100644
--- a/shacl-compact-syntax/grammar/README.md
+++ b/shacl-compact-syntax/grammar/README.md
@@ -1,7 +1,7 @@
# Unifying SHACL-C Grammars
(Task: https://github.com/w3c/shacl/issues/37#issuecomment-1997655429 )
-As a first task of the SHACL Compact Syntax sub-WG, we look at proposed SHACLC grammars:
+As a first task of the SHACL Compact Syntax sub-WG, 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
From 0db1a5a5737ddf1757e3c786407b95476d17b917 Mon Sep 17 00:00:00 2001
From: Vladimir Alexiev
Date: Fri, 23 Aug 2024 10:05:10 +0300
Subject: [PATCH 8/8] accept @TallTed suggestions
Co-authored-by: Ted Thibodeau Jr
---
shacl-compact-syntax/grammar/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shacl-compact-syntax/grammar/README.md b/shacl-compact-syntax/grammar/README.md
index f5e1e97..252f517 100644
--- a/shacl-compact-syntax/grammar/README.md
+++ b/shacl-compact-syntax/grammar/README.md
@@ -1,7 +1,7 @@
# Unifying SHACL-C Grammars
(Task: https://github.com/w3c/shacl/issues/37#issuecomment-1997655429 )
-As a first task of the SHACL Compact Syntax sub-WG, we look at proposed SHACL-C grammars:
+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