-
Notifications
You must be signed in to change notification settings - Fork 0
/
trig-nng.bnf
73 lines (72 loc) · 4.42 KB
/
trig-nng.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
// adapted from the trig 1.2 bnf
// https://www.w3.org/TR/rdf12-trig/
// - adds formulae as alternative to quoted triples for subject and object
// - adds referenced / transcluded graphs
[[1]] trigDoc ::= topLevelBlock *
[[2]] topLevelBlock ::= directive | topLevelGraph | topLevelTriples
[[2a]] topLevelTriples ::= ( ( labelOrSubject | collection | quotedTriple ) predicateObjectList '.' ) | ( blankNodePropertyList predicateObjectList? '.' )
[[2b]] topLevelGraph ::= labelOrSubject? wrappedGraph ( predicateObjectList '.')?
[[3]] nestedBlocks ::= ( nestedGraph nestedBlocks?) | ( nestedGraphPol ( '.' nestedBlocks )?) | ( nestedTriples ( '.' nestedBlocks )?)
[[3a]] nestedTriples ::= ( ( labelOrSubject | collection | quotedTriple) predicateObjectList ) | (blankNodePropertyList predicateObjectList? )
[[3b]] nestedGraph ::= labelOrSubject? wrappedGraph
[[3c]] nestedGraphPol ::= labelOrSubject? wrappedGraph predicateObjectList
[[5]] wrappedGraph ::= '{' nestedBlocks '}'
[[7]] labelOrSubject ::= iri | BlankNode
[[8]] directive ::= prefixID | base | sparqlPrefix | sparqlBase
[[9]] prefixID ::= '@prefix' PNAME_NS IRIREF '.'
[[10]] base ::= '@base' IRIREF '.'
[[11]] sparqlPrefix ::= 'PREFIX' PNAME_NS IRIREF
[[12]] sparqlBase ::= 'BASE' IRIREF
[[14]] predicateObjectList ::= verb objectList (';' predicateObjectList)?
[[15]] objectList ::= annotatedObject (',' annotatedObject)*
[[15a]] annotatedObject ::= object annotation?
[[16]] verb ::= predicate | 'a'
[[17]] subject ::= iri | BlankNode | collection | quotedTriple | wrappedGraph
[[18]] predicate ::= iri
[[19]] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | quotedTriple | wrappedGraph
[[20]] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
[[21]] blankNodePropertyList ::= '[' predicateObjectList ']'
[[22]] collection ::= '(' object* ')'
[[23]] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
[[24]] RDFLiteral ::= String (LANGTAG | ('^^' iri))?
[[25]] BooleanLiteral ::= 'true' | 'false'
[[26]] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
[[27]] iri ::= IRIREF | PrefixedName
[[28]] PrefixedName ::= PNAME_LN | PNAME_NS
// imported from sparql
// [29] BlankNode ::= BLANK_NODE_LABEL | ANON
[[29]] BlankNode ::= ( '_:' BLANK_NODE_LABEL ) | ANON
[[30]] quotedTriple ::= '<<' qtSubject predicate qtObject '>>'
[[31]] qtSubject ::= iri | BlankNode | quotedTriple
[[32]] qtObject ::= iri | BlankNode | literal | quotedTriple
[[33]] annotation ::= '{|' predicateObjectList '|}'
// imported from sparql
// [35] IRIREF ::= '<' ([^#x00-#x20<>'{}|^`\] | UCHAR)* '>'
[[35]] IRIREF ::= '<' IRI_NAMESTRING? '>'
// terminals imported from sparql
// [36] PNAME_NS ::= PN_PREFIX? ':'
// [37] PNAME_LN ::= PNAME_NS PN_LOCAL
// [38] BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)?
// [39] LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
// [40] INTEGER ::= [+-]? [0-9]+
// [41] DECIMAL ::= [+-]? ([0-9]* '.' [0-9]+)
// [42] DOUBLE ::= [+-]? (([0-9]+ '.' [0-9]* EXPONENT) | ('.' [0-9]+ EXPONENT) | ([0-9]+ EXPONENT))
// [43] EXPONENT ::= [eE] [+-]? [0-9]+
// [44] STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#x0A#x0D] | ECHAR | UCHAR)* '"'
// [45] STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#x0A#x0D] | ECHAR | UCHAR)* "'"
// [46] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''"
// [47] STRING_LITERAL_LONG_QUOTE ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""'
// [48] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX)
// [49] ECHAR ::= '\' [tbnrf\'']
// [50] NIL ::= '(' WS* ')'
// [51] WS ::= #x20 | #x09 | #x0D | #x0A
[[52]] ANON ::= '[' ']'
// [53] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x00010000-#x000EFFFF]
// [54] PN_CHARS_U ::= PN_CHARS_BASE | '_'
// [55] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
// [56] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
// [57] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
// [58] PLX ::= PERCENT | PN_LOCAL_ESC
// [59] PERCENT ::= '%' HEX HEX
// [60] HEX ::= [0-9] | [A-F] | [a-f]
// [61] PN_LOCAL_ESC ::= '\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | ''' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')