[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 | 'CONSTRUCT' HeadTemplate 'WHERE' ConstructBodyPattern ) [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 | 'BOUND' '(' Var ')' | 'NOT' 'EXISTS' '{' BodyBasic '}' [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] ConstructBodyPattern ::= '{' BodyTriplesBlock? ( ConstructBodyNotTriples '.'? BodyTriplesBlock? )* '}' [26] ConstructBodyNotTriples ::= Filter | Bind [27] Bind ::= 'BIND' '(' Expression 'AS' Var ')' [28] DataTriplesBlock ::= TriplesSameSubjectData ( '.' DataTriplesBlock? )? [29] TriplesSameSubjectData ::= RDFTermData PropertyListNotEmptyData | TriplesNodeData PropertyListData | ReifiedTripleBlockData [30] PropertyListData ::= PropertyListNotEmptyData? [31] PropertyListNotEmptyData ::= VerbData ObjectListData ( ';' ( VerbData ObjectListData )? )* [32] VerbData ::= iri | 'a' [33] ObjectListData ::= ObjectData ( ',' ObjectData )* [34] ObjectData ::= GraphNodeData AnnotationData [35] GraphNodeData ::= RDFTermData | TriplesNodeData | ReifiedTripleData [36] TriplesNodeData ::= CollectionData | BlankNodePropertyListData [37] BlankNodePropertyListData ::= '[' PropertyListNotEmptyData ']' [38] CollectionData ::= '(' GraphNodeData+ ')' [39] AnnotationData ::= ( ReifierData | AnnotationBlockData )* [40] AnnotationBlockData ::= '{|' PropertyListNotEmptyData '|}' [41] ReifierData ::= '~' ReifierIdData? [42] ReifierIdData ::= iri | BlankNode [43] ReifiedTripleBlockData ::= ReifiedTripleData PropertyListData [44] ReifiedTripleData ::= '<<' ReifiedTripleSubjectData VerbData ReifiedTripleObjectData ReifierData? '>>' [45] ReifiedTripleSubjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTripleData | TripleTermData [46] ReifiedTripleObjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTripleData | TripleTermData [47] TripleTermData ::= '<<(' TripleTermSubjectData VerbData TripleTermObjectData ')>>' [48] TripleTermSubjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTermData [49] TripleTermObjectData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTermData [50] HeadTemplateBlock ::= TriplesBlockTemplate [51] TriplesBlockTemplate ::= TriplesSameSubjectTemplate ( '.' TriplesBlockTemplate? )? [52] TriplesSameSubjectTemplate::= VarOrRDFTerm PropertyListNotEmptyTemplate | TriplesNodeTemplate PropertyListTemplate | ReifiedTripleBlockTemplate [53] PropertyListTemplate ::= PropertyListNotEmptyTemplate? [54] PropertyListNotEmptyTemplate::= Verb ObjectListTemplate ( ';' ( Verb ObjectListTemplate )? )* [55] ObjectListTemplate ::= ObjectTemplate ( ',' ObjectTemplate )* [56] ObjectTemplate ::= GraphNodeTemplate AnnotationTemplate [57] GraphNodeTemplate ::= VarOrRDFTerm | TriplesNodeTemplate | ReifiedTriple [58] TriplesNodeTemplate ::= CollectionTemplate | BlankNodePropertyListTemplate [59] BlankNodePropertyListTemplate::= '[' PropertyListNotEmptyTemplate ']' [60] CollectionTemplate ::= '(' GraphNodeTemplate+ ')' [61] AnnotationTemplate ::= ( Reifier | AnnotationBlockTemplate )* [62] AnnotationBlockTemplate ::= '{|' PropertyListNotEmptyTemplate '|}' [63] ReifiedTripleBlockTemplate::= ReifiedTriple PropertyListTemplate [64] BodyTriplesBlock ::= TriplesBlockPattern [65] TriplesBlockPattern ::= TriplesSameSubjectPattern ( '.' TriplesBlockPattern? )? [66] ReifiedTripleBlockPattern ::= ReifiedTriple PropertyListPattern [67] TriplesSameSubjectPattern ::= VarOrRDFTerm PropertyListNotEmptyPattern | TriplesNodePattern PropertyListPattern | ReifiedTripleBlockPattern [68] PropertyListPattern ::= PropertyListNotEmptyPattern? [69] PropertyListNotEmptyPattern::= ( VerbPath | Var ) ObjectListPattern ( ';' ( ( VerbPath | Var ) ObjectListPattern )? )* [70] ObjectListPattern ::= ObjectPattern ( ',' ObjectPattern )* [71] ObjectPattern ::= GraphNodePattern AnnotationPattern [72] TriplesNodePattern ::= CollectionPattern | BlankNodePropertyListPattern [73] BlankNodePropertyListPattern::= '[' PropertyListNotEmptyPattern ']' [74] CollectionPattern ::= '(' GraphNodePattern+ ')' [75] AnnotationPattern ::= ( Reifier | AnnotationBlockPattern )* [76] AnnotationBlockPattern ::= '{|' PropertyListNotEmptyPattern '|}' [77] GraphNodePattern ::= VarOrRDFTerm | TriplesNodePattern | ReifiedTriple [78] Reifier ::= '~' ReifierId? [79] ReifierId ::= Var | iri | BlankNode [80] ReifiedTriple ::= '<<' ReifiedTripleSubject Verb ReifiedTripleObject Reifier? '>>' [81] ReifiedTripleSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [82] ReifiedTripleObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [83] TripleTerm ::= '<<(' TripleTermSubject Verb TripleTermObject ')>>' [84] TripleTermSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [85] TripleTermObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [86] Verb ::= VarOrIri | 'a' [87] VerbPath ::= Path [88] Path ::= PathSequence [89] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* [90] PathEltOrInverse ::= PathElt | '^' PathElt [91] PathElt ::= ( iri | 'a' | '(' Path ')' ) [92] RDFTermData ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTermData [93] VarOrRDFTerm ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTerm [94] VarOrIri ::= Var | iri [95] Var ::= VAR1 | VAR2 [96] RDFLiteral ::= String ( LANG_DIR | '^^' iri )? [97] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative [98] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE [99] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE [100] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE [101] BooleanLiteral ::= 'true' | 'false' [102] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 [103] iri ::= IRIREF | PrefixedName [104] PrefixedName ::= PNAME_LN | PNAME_NS [105] BlankNode ::= BLANK_NODE_LABEL | ANON [106] Expression ::= ConditionalOrExpression [107] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* [108] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* [109] ValueLogical ::= RelationalExpression [110] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? [111] NumericExpression ::= AdditiveExpression [112] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* [113] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* [114] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression [115] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [116] iriOrFunction ::= iri ArgList? [117] ExprTripleTerm ::= '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>' [118] ExprTripleTermSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var [119] ExprTripleTermObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [120] BrackettedExpression ::= '(' Expression ')' [121] 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 [122] IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>' [123] PNAME_NS ::= PN_PREFIX? ':' [124] PNAME_LN ::= PNAME_NS PN_LOCAL [125] BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? [126] VAR1 ::= '?' VARNAME [127] VAR2 ::= '$' VARNAME [128] LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)? [129] INTEGER ::= [0-9]+ [130] DECIMAL ::= [0-9]* '.' [0-9]+ [131] DOUBLE ::= ( ([0-9]+ ('.'[0-9]*)? ) | ( '.' ([0-9])+ ) ) [eE][+-]?[0-9]+ [132] INTEGER_POSITIVE ::= '+' INTEGER [133] DECIMAL_POSITIVE ::= '+' DECIMAL [134] DOUBLE_POSITIVE ::= '+' DOUBLE [135] INTEGER_NEGATIVE ::= '-' INTEGER [136] DECIMAL_NEGATIVE ::= '-' DECIMAL [137] DOUBLE_NEGATIVE ::= '-' DOUBLE [138] STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR | UCHAR )* "'" [139] STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR | UCHAR )* '"' [140] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" [141] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' [142] ECHAR ::= '\' [tbnrf\"'] [143] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX) [144] NIL ::= '(' WS* ')' [145] WS ::= #x20 | #x9 | #xD | #xA [146] ANON ::= '[' WS* ']' [147] 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] [148] PN_CHARS_U ::= PN_CHARS_BASE | '_' [149] VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* [150] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] [151] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? [152] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? [153] PLX ::= PERCENT | PN_LOCAL_ESC [154] PERCENT ::= '%' HEX HEX [155] HEX ::= [0-9] | [A-F] | [a-f] [156] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )