[1] RuleSet ::= RuleOrDataBlock [2] RuleOrDataBlock ::= Prologue ( RuleOrData+ ( Prologue1 RuleOrData? )* )? [3] RuleOrData ::= Rule | Data [4] Prologue ::= Prologue1* [5] Prologue1 ::= BaseDecl | PrefixDecl | VersionDecl | ImportsDecl [6] BaseDecl ::= 'BASE' IRIREF [7] PrefixDecl ::= 'PREFIX' PNAME_NS IRIREF [8] VersionDecl ::= 'VERSION' VersionSpecifier [9] VersionSpecifier ::= STRING_LITERAL1 | STRING_LITERAL2 [10] ImportsDecl ::= 'IMPORTS' iri [11] Rule ::= 'RULE' iri? HeadTemplate 'WHERE' 'DATA'? BodyPattern [12] Data ::= 'DATA' '{' DataTriplesBlock? '}' [13] HeadTemplate ::= '{' HeadTemplateBlock? '}' [14] BodyPattern ::= '{' BodyTriplesBlock? ( BodyNotTriples '.'? BodyTriplesBlock? )* '}' [15] BodyNotTriples ::= Filter | Negation | Assignment [16] Filter ::= 'FILTER' Constraint [17] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall [18] FunctionCall ::= iri ArgList [19] ArgList ::= NIL | '(' Expression ( ',' Expression )* ')' [20] ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' [21] Negation ::= 'NOT' 'DATA'? '{' BodyBasic '}' [22] BodyBasic ::= BodyTriplesBlock? ( BodyBasicNotTriples '.'? BodyTriplesBlock? )* [23] BodyBasicNotTriples ::= Filter [24] Assignment ::= 'SET' '(' Var ':=' Expression ')' [25] DataTriplesBlock ::= TriplesSameSubjectData ( '.' DataTriplesBlock? )? [26] TriplesSameSubjectData ::= RDFTermData PropertyListNotEmptyData | TriplesNodeData PropertyListData | ReifiedTripleBlockData [27] PropertyListData ::= PropertyListNotEmptyData? [28] PropertyListNotEmptyData ::= VerbData ObjectListData ( ';' ( VerbData ObjectListData )? )* [29] VerbData ::= iri | 'a' [30] ObjectListData ::= ObjectData ( ',' ObjectData )* [31] ObjectData ::= GraphNodeData AnnotationData [32] GraphNodeData ::= RDFTermData | TriplesNodeData | ReifiedTripleData [33] TriplesNodeData ::= CollectionData | BlankNodePropertyListData [34] BlankNodePropertyListData ::= '[' PropertyListNotEmptyData ']' [35] CollectionData ::= '(' GraphNodeData+ ')' [36] AnnotationData ::= ( ReifierData | AnnotationBlockData )* [37] AnnotationBlockData ::= '{|' PropertyListNotEmptyData '|}' [38] ReifierData ::= '~' ReifierIdData? [39] ReifierIdData ::= iri | BlankNode [40] ReifiedTripleBlockData ::= ReifiedTripleData PropertyListData [41] ReifiedTripleData ::= '<<' ReifiedTripleSubjectData VerbData ReifiedTripleObjectData ReifierData? '>>' [42] ReifiedTripleSubjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTripleData | TripleTermData [43] ReifiedTripleObjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTripleData | TripleTermData [44] TripleTermData ::= '<<(' TripleTermSubjectData VerbData TripleTermObjectData ')>>' [45] TripleTermSubjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTermData [46] TripleTermObjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTermData [47] HeadTemplateBlock ::= TriplesBlockTemplate [48] TriplesBlockTemplate ::= TriplesSameSubjectTemplate ( '.' TriplesBlockTemplate? )? [49] TriplesSameSubjectTemplate ::= VarOrRDFTerm PropertyListNotEmptyTemplate | TriplesNodeTemplate PropertyListTemplate | ReifiedTripleBlockTemplate [50] PropertyListTemplate ::= PropertyListNotEmptyTemplate? [51] PropertyListNotEmptyTemplate ::= Verb ObjectListTemplate ( ';' ( Verb ObjectListTemplate )? )* [52] ObjectListTemplate ::= ObjectTemplate ( ',' ObjectTemplate )* [53] ObjectTemplate ::= GraphNodeTemplate AnnotationTemplate [54] GraphNodeTemplate ::= VarOrRDFTerm | TriplesNodeTemplate | ReifiedTriple [55] TriplesNodeTemplate ::= CollectionTemplate | BlankNodePropertyListTemplate [56] BlankNodePropertyListTemplate ::= '[' PropertyListNotEmptyTemplate ']' [57] CollectionTemplate ::= '(' GraphNodeTemplate+ ')' [58] AnnotationTemplate ::= ( Reifier | AnnotationBlockTemplate )* [59] AnnotationBlockTemplate ::= '{|' PropertyListNotEmptyTemplate '|}' [60] ReifiedTripleBlockTemplate ::= ReifiedTriple PropertyListTemplate [61] BodyTriplesBlock ::= TriplesBlockPattern [62] TriplesBlockPattern ::= TriplesSameSubjectPattern ( '.' TriplesBlockPattern? )? [63] ReifiedTripleBlockPattern ::= ReifiedTriple PropertyListPattern [64] TriplesSameSubjectPattern ::= VarOrRDFTerm PropertyListNotEmptyPattern | TriplesNodePattern PropertyListPattern | ReifiedTripleBlockPattern [65] PropertyListPattern ::= PropertyListNotEmptyPattern? [66] PropertyListNotEmptyPattern ::= ( VerbPath | Var ) ObjectListPattern ( ';' ( ( VerbPath | Var ) ObjectListPattern )? )* [67] ObjectListPattern ::= ObjectPattern ( ',' ObjectPattern )* [68] ObjectPattern ::= GraphNodePattern AnnotationPattern [69] TriplesNodePattern ::= CollectionPattern | BlankNodePropertyListPattern [70] BlankNodePropertyListPattern ::= '[' PropertyListNotEmptyPattern ']' [71] CollectionPattern ::= '(' GraphNodePattern+ ')' [72] AnnotationPattern ::= ( Reifier | AnnotationBlockPattern )* [73] AnnotationBlockPattern ::= '{|' PropertyListNotEmptyPattern '|}' [74] GraphNodePattern ::= VarOrRDFTerm | TriplesNodePattern | ReifiedTriple [75] Reifier ::= '~' ReifierId? [76] ReifierId ::= Var | iri | BlankNode [77] ReifiedTriple ::= '<<' ReifiedTripleSubject Verb ReifiedTripleObject Reifier? '>>' [78] ReifiedTripleSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [79] ReifiedTripleObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [80] TripleTerm ::= '<<(' TripleTermSubject Verb TripleTermObject ')>>' [81] TripleTermSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [82] TripleTermObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [83] Verb ::= VarOrIri | 'a' [84] VerbPath ::= Path [85] Path ::= PathSequence [86] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* [87] PathEltOrInverse ::= PathElt | '^' PathElt [88] PathElt ::= ( iri | 'a' | '(' Path ')' ) [89] RDFTermData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTermData [90] VarOrRDFTerm ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTerm [91] VarOrIri ::= Var | iri [92] Var ::= VAR1 | VAR2 [93] RDFLiteral ::= String ( LANG_DIR | '^^' iri )? [94] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative [95] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE [96] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE [97] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE [98] BooleanLiteral ::= 'true' | 'false' [99] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 [100] iri ::= IRIREF | PrefixedName [101] PrefixedName ::= PNAME_LN | PNAME_NS [102] BlankNode ::= BLANK_NODE_LABEL | ANON [103] Expression ::= ConditionalOrExpression [104] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* [105] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* [106] ValueLogical ::= RelationalExpression [107] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? [108] NumericExpression ::= AdditiveExpression [109] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* [110] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* [111] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression [112] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [113] iriOrFunction ::= iri ArgList? [114] ExprTripleTerm ::= '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>' [115] ExprTripleTermSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var [116] ExprTripleTermObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [117] BrackettedExpression ::= '(' Expression ')' [118] BuiltInCall ::= 'STR' '(' Expression ')' | 'LANG' '(' Expression ')' | 'LANGMATCHES' '(' Expression ',' Expression ')' | 'LANGDIR' '(' Expression ')' | 'DATATYPE' '(' Expression ')' | 'IRI' '(' Expression ')' | 'URI' '(' Expression ')' | 'BNODE' ( '(' Expression ')' | NIL ) | 'ABS' '(' Expression ')' | 'CEIL' '(' Expression ')' | 'FLOOR' '(' Expression ')' | 'ROUND' '(' Expression ')' | 'CONCAT' ExpressionList | 'SUBSTR' '(' Expression ',' Expression ( ',' Expression )? ')' | 'STRLEN' '(' Expression ')' | 'REPLACE' '(' Expression ',' Expression ',' Expression ( ',' Expression )? ')' | 'UCASE' '(' Expression ')' | 'LCASE' '(' Expression ')' | 'ENCODE_FOR_URI' '(' Expression ')' | 'CONTAINS' '(' Expression ',' Expression ')' | 'STRSTARTS' '(' Expression ',' Expression ')' | 'STRENDS' '(' Expression ',' Expression ')' | 'STRBEFORE' '(' Expression ',' Expression ')' | 'STRAFTER' '(' Expression ',' Expression ')' | 'YEAR' '(' Expression ')' | 'MONTH' '(' Expression ')' | 'DAY' '(' Expression ')' | 'HOURS' '(' Expression ')' | 'MINUTES' '(' Expression ')' | 'SECONDS' '(' Expression ')' | 'TIMEZONE' '(' Expression ')' | 'TZ' '(' Expression ')' | 'NOW' NIL | 'UUID' NIL | 'STRUUID' NIL | 'IF' '(' Expression ',' Expression ',' Expression ')' | 'STRLANG' '(' Expression ',' Expression ')' | 'STRLANGDIR' '(' Expression ',' Expression ',' Expression ')' | 'STRDT' '(' Expression ',' Expression ')' | 'sameTerm' '(' Expression ',' Expression ')' | 'isIRI' '(' Expression ')' | 'isURI' '(' Expression ')' | 'isBLANK' '(' Expression ')' | 'isLITERAL' '(' Expression ')' | 'isNUMERIC' '(' Expression ')' | 'hasLANG' '(' Expression ')' | 'hasLANGDIR' '(' Expression ')' | 'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')' | 'isTRIPLE' '(' Expression ')' | 'TRIPLE' '(' Expression ',' Expression ',' Expression ')' | 'SUBJECT' '(' Expression ')' | 'PREDICATE' '(' Expression ')' | 'OBJECT' '(' Expression ')' @terminals [119] IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>' [120] PNAME_NS ::= PN_PREFIX? ':' [121] PNAME_LN ::= PNAME_NS PN_LOCAL [122] BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? [123] VAR1 ::= '?' VARNAME [124] VAR2 ::= '$' VARNAME [125] LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)? [126] INTEGER ::= [0-9]+ [127] DECIMAL ::= [0-9]* '.' [0-9]+ [128] DOUBLE ::= ( ([0-9]+ ('.'[0-9]*)? ) | ( '.' ([0-9])+ ) ) [eE][+-]?[0-9]+ [129] INTEGER_POSITIVE ::= '+' INTEGER [130] DECIMAL_POSITIVE ::= '+' DECIMAL [131] DOUBLE_POSITIVE ::= '+' DOUBLE [132] INTEGER_NEGATIVE ::= '-' INTEGER [133] DECIMAL_NEGATIVE ::= '-' DECIMAL [134] DOUBLE_NEGATIVE ::= '-' DOUBLE [135] STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR | UCHAR )* "'" [136] STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR | UCHAR )* '"' [137] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" [138] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' [139] ECHAR ::= '\' [tbnrf\"'] [140] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX) [141] NIL ::= '(' WS* ')' [142] WS ::= #x20 | #x9 | #xD | #xA [143] ANON ::= '[' WS* ']' [144] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] [145] PN_CHARS_U ::= PN_CHARS_BASE | '_' [146] VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* [147] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] [148] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? [149] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? [150] PLX ::= PERCENT | PN_LOCAL_ESC [151] PERCENT ::= '%' HEX HEX [152] HEX ::= [0-9] | [A-F] | [a-f] [153] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )