[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 ::= Rule1 | Rule2 | Declaration [12] Rule1 ::= 'RULE' iri? HeadTemplate 'WHERE' BodyPattern [13] Rule2 ::= 'IF' BodyPattern 'THEN' HeadTemplate [14] Declaration ::= ( 'TRANSITIVE' '(' iri ')' | 'SYMMETRIC' '(' iri ')' | 'INVERSE' '(' iri ',' iri ')' ) [15] Data ::= 'DATA' '{' TriplesDataBlock? '}' [16] TriplesDataBlock ::= TriplesSameSubject ( '.' TriplesDataBlock? )? [17] HeadTemplate ::= '{' HeadTemplateBlock? '}' [18] BodyPattern ::= '{' BodyTriplesBlock? ( BodyNotTriples '.'? BodyTriplesBlock? )* '}' [19] BodyNotTriples ::= Filter | Negation | Assignment [20] BodyTriplesBlock ::= TriplesBlock [21] Negation ::= 'NOT' '{' BodyBasic '}' [22] BodyBasic ::= BodyTriplesBlock? ( BodyBasicNotTriples '.'? BodyTriplesBlock? )* [23] BodyBasicNotTriples ::= Filter [24] HeadTemplateBlock ::= TriplesBlock [25] TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? [26] ReifiedTripleBlock ::= ReifiedTriple PropertyList [27] ReifiedTripleBlockPath ::= ReifiedTriple PropertyListPath [28] Assignment ::= 'SET' '(' Var ':=' Expression ')' [29] Reifier ::= '~' VarOrReifierId? [30] VarOrReifierId ::= Var | iri | BlankNode [31] Filter ::= 'FILTER' Constraint [32] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall [33] FunctionCall ::= iri ArgList [34] ArgList ::= NIL | '(' Expression ( ',' Expression )* ')' [35] ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' [36] TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList | ReifiedTripleBlock [37] PropertyList ::= PropertyListNotEmpty? [38] PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* [39] Verb ::= VarOrIri | 'a' [40] ObjectList ::= Object ( ',' Object )* [41] Object ::= GraphNode Annotation [42] TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath | ReifiedTripleBlockPath [43] PropertyListPath ::= PropertyListPathNotEmpty? [44] PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectListPath )? )* [45] VerbPath ::= Path [46] VerbSimple ::= Var [47] ObjectListPath ::= ObjectPath ( ',' ObjectPath )* [48] ObjectPath ::= GraphNodePath AnnotationPath [49] Path ::= PathSequence [50] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* [51] PathEltOrInverse ::= PathElt | '^' PathElt [52] PathElt ::= PathPrimary [53] PathPrimary ::= iri | 'a' | '(' Path ')' [54] TriplesNode ::= Collection | BlankNodePropertyList [55] BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' [56] TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath [57] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' [58] Collection ::= '(' GraphNode+ ')' [59] CollectionPath ::= '(' GraphNodePath+ ')' [60] AnnotationPath ::= ( Reifier | AnnotationBlockPath )* [61] AnnotationBlockPath ::= '{|' PropertyListPathNotEmpty '|}' [62] Annotation ::= ( Reifier | AnnotationBlock )* [63] AnnotationBlock ::= '{|' PropertyListNotEmpty '|}' [64] GraphNode ::= VarOrTerm | TriplesNode | ReifiedTriple [65] GraphNodePath ::= VarOrTerm | TriplesNodePath | ReifiedTriple [66] VarOrTerm ::= Var | RDFTerm [67] RDFTerm ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTerm [68] ReifiedTriple ::= '<<' ReifiedTripleSubject Verb ReifiedTripleObject Reifier? '>>' [69] ReifiedTripleSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [70] ReifiedTripleObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm [71] TripleTerm ::= '<<(' TripleTermSubject Verb TripleTermObject ')>>' [72] TripleTermSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [73] TripleTermObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm [74] TripleTermData ::= '<<(' TripleTermDataSubject ( iri | 'a' ) TripleTermDataObject ')>>' [75] TripleTermDataSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral [76] TripleTermDataObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | TripleTermData [77] VarOrIri ::= Var | iri [78] Var ::= VAR1 | VAR2 [79] Expression ::= ConditionalOrExpression [80] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* [81] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* [82] ValueLogical ::= RelationalExpression [83] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? [84] NumericExpression ::= AdditiveExpression [85] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* [86] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* [87] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression [88] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [89] ExprTripleTerm ::= '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>' [90] ExprTripleTermSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var [91] ExprTripleTermObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm [92] BrackettedExpression ::= '(' Expression ')' [93] 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 ')' [94] iriOrFunction ::= iri ArgList? [95] RDFLiteral ::= String ( LANG_DIR | '^^' iri )? [96] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative [97] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE [98] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE [99] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE [100] BooleanLiteral ::= 'true' | 'false' [101] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 [102] iri ::= IRIREF | PrefixedName [103] PrefixedName ::= PNAME_LN | PNAME_NS [104] BlankNode ::= BLANK_NODE_LABEL | ANON @terminals [105] IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>' [106] PNAME_NS ::= PN_PREFIX? ':' [107] PNAME_LN ::= PNAME_NS PN_LOCAL [108] BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? [109] VAR1 ::= '?' VARNAME [110] VAR2 ::= '$' VARNAME [111] LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)? [112] INTEGER ::= [0-9]+ [113] DECIMAL ::= [0-9]* '.' [0-9]+ [114] DOUBLE ::= ( ([0-9]+ ('.'[0-9]*)? ) | ( '.' ([0-9])+ ) ) [eE][+-]?[0-9]+ [115] INTEGER_POSITIVE ::= '+' INTEGER [116] DECIMAL_POSITIVE ::= '+' DECIMAL [117] DOUBLE_POSITIVE ::= '+' DOUBLE [118] INTEGER_NEGATIVE ::= '-' INTEGER [119] DECIMAL_NEGATIVE ::= '-' DECIMAL [120] DOUBLE_NEGATIVE ::= '-' DOUBLE [121] STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR | UCHAR )* "'" [122] STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR | UCHAR )* '"' [123] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" [124] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' [125] ECHAR ::= '\' [tbnrf\"'] [126] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX) [127] NIL ::= '(' WS* ')' [128] WS ::= #x20 | #x9 | #xD | #xA [129] ANON ::= '[' WS* ']' [130] 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] [131] PN_CHARS_U ::= PN_CHARS_BASE | '_' [132] VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* [133] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] [134] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? [135] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? [136] PLX ::= PERCENT | PN_LOCAL_ESC [137] PERCENT ::= '%' HEX HEX [138] HEX ::= [0-9] | [A-F] | [a-f] [139] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )