-
Notifications
You must be signed in to change notification settings - Fork 0
/
bnf
140 lines (137 loc) · 7.94 KB
/
bnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
shexDoc ::= directive* ((notStartAction | startActions) statement*)?
directive ::= baseDecl | prefixDecl | importDecl
baseDecl ::= "BASE" IRIREF
prefixDecl ::= "PREFIX" PNAME_NS IRIREF
importDecl ::= "IMPORT" IRIREF
notStartAction ::= start | shapeExprDecl
start ::= "START" '=' inlineShapeExpression
startActions ::= codeDecl+
statement ::= directive | notStartAction
shapeExprDecl ::= shapeExprLabel (shapeExpression | "EXTERNAL")
shapeExpression ::= shapeOr
inlineShapeExpression ::= inlineShapeOr
shapeOr ::= shapeAnd ("OR" shapeAnd)*
inlineShapeOr ::= inlineShapeAnd ("OR" inlineShapeAnd)*
shapeAnd ::= shapeNot ("AND" shapeNot)*
inlineShapeAnd ::= inlineShapeNot ("AND" inlineShapeNot)*
shapeNot ::= "NOT"? shapeAtom
inlineShapeNot ::= "NOT"? inlineShapeAtom
shapeAtom ::= nonLitNodeConstraint shapeOrRef?
| litNodeConstraint
| shapeOrRef nonLitNodeConstraint?
| '(' shapeExpression ')'
| '.'
inlineShapeAtom ::= nonLitNodeConstraint inlineShapeOrRef?
| litNodeConstraint
| inlineShapeOrRef nonLitNodeConstraint?
| '(' shapeExpression ')'
| '.'
shapeOrRef ::= shapeDefinition | shapeRef
inlineShapeOrRef ::= inlineShapeDefinition | shapeRef
shapeRef ::= ATPNAME_LN | ATPNAME_NS | '@' shapeExprLabel
litNodeConstraint ::= "LITERAL" xsFacet*
| datatype xsFacet*
| valueSet xsFacet*
| numericFacet+
nonLitNodeConstraint ::= nonLiteralKind stringFacet* | stringFacet+
nonLiteralKind ::= "IRI" | "BNODE" | "NONLITERAL"
xsFacet ::= stringFacet | numericFacet
stringFacet ::= stringLength INTEGER
| REGEXP
stringLength ::= "LENGTH" | "MINLENGTH" | "MAXLENGTH"
numericFacet ::= numericRange rawNumeric
| numericLength INTEGER
numericRange ::= "MININCLUSIVE" | "MINEXCLUSIVE" | "MAXINCLUSIVE" | "MAXEXCLUSIVE"
numericLength ::= "TOTALDIGITS" | "FRACTIONDIGITS"
shapeDefinition ::= inlineShapeDefinition annotation* semanticActions
inlineShapeDefinition ::= shapeQualifiers '{' tripleExpression? '}'
shapeQualifiers ::= (extraPropertySet | "CLOSED")*
extraPropertySet ::= "EXTRA" predicate+
tripleExpression ::= oneOfTripleExpr
oneOfTripleExpr ::= groupTripleExpr | multiElementOneOf
multiElementOneOf ::= groupTripleExpr ('|' groupTripleExpr)+
groupTripleExpr ::= singleElementGroup | multiElementGroup
singleElementGroup ::= unaryTripleExpr ';'?
multiElementGroup ::= unaryTripleExpr (';' unaryTripleExpr)+ ';'?
unaryTripleExpr ::= ('$' tripleExprLabel)? (tripleConstraint | bracketedTripleExpr)
| include
bracketedTripleExpr ::= '(' tripleExpression ')' cardinality? annotation* semanticActions
tripleConstraint ::= senseFlags? predicate inlineShapeExpression cardinality? annotation* semanticActions
cardinality ::= '*' | '+' | '?' | REPEAT_RANGE
senseFlags ::= '^'
valueSet ::= '[' valueSetValue* ']'
valueSetValue ::= iriRange | literalRange | languageRange
| '.' (iriExclusion+ | literalExclusion+ | languageExclusion+)
iriRange ::= iri ('~' iriExclusion*)?
iriExclusion ::= '-' iri '~'?
literalRange ::= literal ('~' literalExclusion*)?
literalExclusion ::= '-' literal '~'?
languageRange ::= LANGTAG ('~' languageExclusion*)?
| '@' '~' languageExclusion*
languageExclusion ::= '-' LANGTAG '~'?
include ::= '&' tripleExprLabel
annotation ::= "//" predicate (iri | literal)
semanticActions ::= codeDecl*
codeDecl ::= '%' iri (CODE | '%')
literal ::= rdfLiteral | numericLiteral | booleanLiteral
predicate ::= iri | RDF_TYPE
datatype ::= iri
shapeExprLabel ::= iri | blankNode
tripleExprLabel ::= iri | blankNode
rawNumeric ::= INTEGER | DECIMAL | DOUBLE
numericLiteral ::= rawNumeric
rdfLiteral ::= langString | string ("^^" datatype)?
booleanLiteral ::= "true" | "false"
string ::= STRING_LITERAL1 | STRING_LITERAL_LONG1
| STRING_LITERAL2 | STRING_LITERAL_LONG2
langString ::= LANG_STRING_LITERAL1 | LANG_STRING_LITERAL_LONG1
| LANG_STRING_LITERAL2 | LANG_STRING_LITERAL_LONG2
iri ::= IRIREF | prefixedName
prefixedName ::= PNAME_LN | PNAME_NS
blankNode ::= BLANK_NODE_LABEL
@terminals
CODE ::= "{" ([^%\\] | "\\" [%\\] | UCHAR)* "%" "}"
REPEAT_RANGE ::= "{" INTEGER ( "," (INTEGER | "*")? )? "}"
RDF_TYPE ::= "a"
IRIREF ::= "<" ([^#0000- <>\"{}|^`\\] | UCHAR)* ">"
PNAME_NS ::= PN_PREFIX? ":"
PNAME_LN ::= PNAME_NS PN_LOCAL
ATPNAME_NS ::= "@" PNAME_NS
ATPNAME_LN ::= "@" PNAME_LN
REGEXP ::= "/" ([^/\\\n\r] | "\\" [nrt\\|.?*+(){}$-\[\]^/] | UCHAR)+ "/" REGEXP_FLAGS?
REGEXP_FLAGS ::= [smix]+
BLANK_NODE_LABEL ::= "_:" (PN_CHARS_U | [0-9]) ((PN_CHARS | ".")* PN_CHARS)?
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]+
STRING_LITERAL1 ::= "'" ([^'\\\n\r] | ECHAR | UCHAR)* "'"
STRING_LITERAL2 ::= '"' ([^\"\\\n\r] | ECHAR | UCHAR)* '"'
STRING_LITERAL_LONG1 ::= "'''" ( ("'" | "''")? ([^\\'\\] | ECHAR | UCHAR) )* "'''"
STRING_LITERAL_LONG2 ::= '"""' ( ('"' | '""')? ([^\"\\] | ECHAR | UCHAR) )* '"""'
LANG_STRING_LITERAL1 ::= "'" ([^'\\\n\r] | ECHAR | UCHAR)* "'" LANGTAG
LANG_STRING_LITERAL2 ::= '"' ([^\"\\\n\r] | ECHAR | UCHAR)* '"' LANGTAG
LANG_STRING_LITERAL_LONG1 ::= "'''" ( ("'" | "''")? ([^\\'\\] | ECHAR | UCHAR) )* "'''" LANGTAG
LANG_STRING_LITERAL_LONG2 ::= '"""' ( ('"' | '""')? ([^\"\\] | ECHAR | UCHAR) )* '"""' LANGTAG
UCHAR ::= "\\u" HEX HEX HEX HEX
| "\\U" HEX HEX HEX HEX HEX HEX HEX HEX
ECHAR ::= "\\" [tbnrf\\\"\\']
PN_CHARS_BASE ::= [A-Z] | [a-z]
| [#00C0-#00D6] | [#00D8-#00F6] | [#00F8-#02FF]
| [#0370-#037D] | [#037F-#1FFF]
| [#200C-#200D] | [#2070-#218F] | [#2C00-#2FEF]
| [#3001-#D7FF] | [#F900-#FDCF] | [#FDF0-#FFFD]
| [#10000-#EFFFF]
PN_CHARS_U ::= PN_CHARS_BASE | "_"
PN_CHARS ::= PN_CHARS_U | "-" | [0-9]
| [#00B7] | [#0300-#036F] | [#203F-#2040]
PN_PREFIX ::= PN_CHARS_BASE ( (PN_CHARS | ".")* PN_CHARS )?
PN_LOCAL ::= (PN_CHARS_U | ":" | [0-9] | PLX) (PN_CHARS | "." | ":" | PLX)*
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= "%" HEX HEX
HEX ::= [0-9] | [A-F] | [a-f]
PN_LOCAL_ESC ::= "\\" ( "_" | "~" | "." | "-" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%" )
@pass ::= [ \t\r\n]+
| "#" [^\r\n]*
| "/*" ([^*] | "*" ([^/] | "\\/"))* "*/"