RuleSet ::= ( Prologue ( Rule | Data ) )* Rule ::= Rule1 | Rule2 | Rule3 | Declaration Rule1 ::= 'RULE' HeadTemplate 'WHERE' BodyPattern Rule2 ::= 'IF' BodyPattern 'THEN' HeadTemplate Rule3 ::= HeadTemplate ':-' BodyPattern Declaration ::= ( 'TRANSITIVE' '(' iri ')' | 'SYMMETRIC' '(' iri ')' | 'INVERSE' '(' iri ',' iri ')' ) Data ::= 'DATA' TriplesTemplateBlock HeadTemplate ::= TriplesTemplateBlock BodyPattern ::= '{' BodyPattern1? Assignment* '}' BodyPattern1 ::= ( Filter | BodyPatternSub ( Filter BodyPatternSub? )* ) BodyPatternSub ::= TriplesBlock Prologue ::= ( BaseDecl | PrefixDecl | VersionDecl | ImportsDecl )* BaseDecl ::= 'BASE' IRIREF PrefixDecl ::= 'PREFIX' PNAME_NS IRIREF VersionDecl ::= 'VERSION' VersionSpecifier VersionSpecifier ::= STRING_LITERAL1 | STRING_LITERAL2 ImportsDecl ::= 'IMPORTS' iri TriplesTemplateBlock ::= '{' TriplesTemplate? '}' TriplesTemplate ::= TriplesSameSubject ( '.' TriplesTemplate? )? TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? ReifiedTripleBlock ::= ReifiedTriple PropertyList ReifiedTripleBlockPath ::= ReifiedTriple PropertyListPath Assignment ::= Bind Bind ::= 'BIND' '(' Expression 'AS' Var ')' Let ::= 'LET' '(' Var ':=' Expression ')' Reifier ::= '~' VarOrReifierId? VarOrReifierId ::= Var | iri | BlankNode Filter ::= 'FILTER' Constraint Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall FunctionCall ::= iri ArgList ArgList ::= NIL | '(' Expression ( ',' Expression )* ')' ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList | ReifiedTripleBlock PropertyList ::= PropertyListNotEmpty? PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* Verb ::= VarOrIri | 'a' ObjectList ::= Object ( ',' Object )* Object ::= GraphNode Annotation TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath | ReifiedTripleBlockPath PropertyListPath ::= PropertyListPathNotEmpty? PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectListPath )? )* VerbPath ::= Path VerbSimple ::= Var ObjectListPath ::= ObjectPath ( ',' ObjectPath )* ObjectPath ::= GraphNodePath AnnotationPath Path ::= PathSequence PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* PathEltOrInverse ::= PathElt | '^' PathElt PathElt ::= PathPrimary PathPrimary ::= iri | 'a' | '(' Path ')' TriplesNode ::= Collection | BlankNodePropertyList BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' Collection ::= '(' GraphNode+ ')' CollectionPath ::= '(' GraphNodePath+ ')' AnnotationPath ::= ( Reifier | AnnotationBlockPath )* AnnotationBlockPath ::= '{|' PropertyListPathNotEmpty '|}' Annotation ::= ( Reifier | AnnotationBlock )* AnnotationBlock ::= '{|' PropertyListNotEmpty '|}' GraphNode ::= VarOrTerm | TriplesNode | ReifiedTriple GraphNodePath ::= VarOrTerm | TriplesNodePath | ReifiedTriple VarOrTerm ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTerm ReifiedTriple ::= '<<' ReifiedTripleSubject Verb ReifiedTripleObject Reifier? '>>' ReifiedTripleSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple ReifiedTripleObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm TripleTerm ::= '<<(' TripleTermSubject Verb TripleTermObject ')>>' TripleTermSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode TripleTermObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm TripleTermData ::= '<<(' TripleTermDataSubject ( iri | 'a' ) TripleTermDataObject ')>>' TripleTermDataSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral TripleTermDataObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | TripleTermData VarOrIri ::= Var | iri Var ::= VAR1 | VAR2 Expression ::= ConditionalOrExpression ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* ValueLogical ::= RelationalExpression RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? NumericExpression ::= AdditiveExpression AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm ExprTripleTerm ::= '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>' ExprTripleTermSubject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var ExprTripleTermObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm BrackettedExpression ::= '(' Expression ')' BuiltInCall ::= 'STR' '(' Expression ')' | 'LANG' '(' Expression ')' | 'LANGMATCHES' '(' Expression ',' Expression ')' | 'LANGDIR' '(' Expression ')' | 'DATATYPE' '(' Expression ')' | 'BOUND' '(' Var ')' | 'IRI' '(' Expression ')' | 'URI' '(' Expression ')' | 'BNODE' ( '(' Expression ')' | NIL ) | 'RAND' 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 | 'MD5' '(' Expression ')' | 'SHA1' '(' Expression ')' | 'SHA256' '(' Expression ')' | 'SHA384' '(' Expression ')' | 'SHA512' '(' Expression ')' | 'COALESCE' ExpressionList | '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 ')' iriOrFunction ::= iri ArgList? RDFLiteral ::= String ( LANG_DIR | '^^' iri )? NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE BooleanLiteral ::= 'true' | 'false' String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2 iri ::= IRIREF | PrefixedName PrefixedName ::= PNAME_LN | PNAME_NS BlankNode ::= BLANK_NODE_LABEL | ANON @terminals IRIREF ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* '>' PNAME_NS ::= PN_PREFIX? ':' PNAME_LN ::= PNAME_NS PN_LOCAL BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? VAR1 ::= '?' VARNAME VAR2 ::= '$' VARNAME LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)? INTEGER ::= [0-9]+ DECIMAL ::= [0-9]* '.' [0-9]+ DOUBLE ::= ( ([0-9]+ ('.'[0-9]*)? ) | ( '.' ([0-9])+ ) ) [eE][+-]?[0-9]+ INTEGER_POSITIVE ::= '+' INTEGER DECIMAL_POSITIVE ::= '+' DECIMAL DOUBLE_POSITIVE ::= '+' DOUBLE INTEGER_NEGATIVE ::= '-' INTEGER DECIMAL_NEGATIVE ::= '-' DECIMAL DOUBLE_NEGATIVE ::= '-' DOUBLE STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'" STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"' STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''" STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""' ECHAR ::= '\' [tbnrf\"'] NIL ::= '(' WS* ')' WS ::= #x20 | #x9 | #xD | #xA ANON ::= '[' WS* ']' 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] PN_CHARS_U ::= PN_CHARS_BASE | '_' VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )* PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX ) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX) )? PLX ::= PERCENT | PN_LOCAL_ESC PERCENT ::= '%' HEX HEX HEX ::= [0-9] | [A-F] | [a-f] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )