[1]   Top   ::=   Prologue ( Query | Update )
[2]   QueryUnit   ::=   Prologue Query
[3]   Query   ::=   SelectQuery | ConstructQuery | DescribeQuery | AskQuery
[4]   Prologue   ::=   BaseDecl? PrefixDecl*
[5]   BaseDecl   ::=   'BASE' IRI_REF
[6]   PrefixDecl   ::=   'PREFIX' PNAME_NS IRI_REF
[7]   SelectQuery   ::=   Project DatasetClause* WhereClause SolutionModifier
[8]   SubSelect   ::=   Project WhereClause SolutionModifier
[9]   Project   ::=   'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | Aggregate | BuiltInCall | FunctionCall | RDFLiteral | NumericLiteral | BooleanLiteral | ( '(' Expression ( 'AS' Var )? ')' ) )+ | '*' )
[10]   ConstructQuery   ::=   'CONSTRUCT' ConstructTemplate DatasetClause* WhereClause SolutionModifier
[11]   DescribeQuery   ::=   'DESCRIBE' ( VarOrIRIref+ | '*' ) DatasetClause* WhereClause? SolutionModifier
[12]   AskQuery   ::=   'ASK' DatasetClause* WhereClause
[13]   DatasetClause   ::=   'FROM' ( DefaultGraphClause | NamedGraphClause )
[14]   DefaultGraphClause   ::=   SourceSelector
[15]   NamedGraphClause   ::=   'NAMED' SourceSelector
[16]   SourceSelector   ::=   IRIref
[17]   WhereClause   ::=   'WHERE'? GroupGraphPattern
[18]   SolutionModifier   ::=   GroupClause? HavingClause? OrderClause? LimitOffsetClauses?
[19]   GroupClause   ::=   'GROUP' 'BY' GroupCondition+
[20]   GroupCondition   ::=   ( BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var )
[21]   HavingClause   ::=   'HAVING' HavingCondition+
[22]   HavingCondition   ::=   Constraint
[23]   OrderClause   ::=   'ORDER' 'BY' OrderCondition+
[24]   OrderCondition   ::=   ( ( 'ASC' | 'DESC' ) BrackettedExpression )
| ( Constraint | Var )
[25]   LimitOffsetClauses   ::=   ( LimitClause OffsetClause? | OffsetClause LimitClause? )
[26]   LimitClause   ::=   'LIMIT' INTEGER
[27]   OffsetClause   ::=   'OFFSET' INTEGER
[28]   UpdateUnit   ::=   Prologue Update
[29]   Update   ::=   Update1*
[30]   Update1   ::=   ( Modify | Load | Clear | Drop | Create ) ';'?
[31]   Modify   ::=   ( 'WITH' IRIref )? ( Insert | Delete )
[32]   Insert   ::=   'INSERT' ( 'DATA' QuadData | QuadTemplate 'WHERE' GroupGraphPattern )
[33]   Delete   ::=   'DELETE' ( 'DATA' QuadData | 'WHERE' QuadTemplate | QuadTemplate ( 'INSERT' QuadTemplate )? 'WHERE' GroupGraphPattern )
[34]   Clear   ::=   'CLEAR' GraphRef
[35]   Load   ::=   'LOAD' IRIref+ ( 'INTO' GraphRef )?
[36]   Drop   ::=   'DROP' 'SILENT'? IRIref
[37]   Create   ::=   'CREATE' 'SILENT'? IRIref
[38]   GraphRef   ::=   DFT | IRIref
[39]   QuadTemplate   ::=   '{' Quads '}'
[40]   Quads   ::=   TriplesTemplate? ( QuadsNotTriples '.'? TriplesTemplate? )*
[41]   QuadsNotTriples   ::=   'GRAPH' VarOrIRIref '{' TriplesTemplate '}'
[42]   TriplesTemplate   ::=   TriplesSameSubject ( '.' TriplesTemplate? )?
[43]   QuadData   ::=   '{' Quads '}'
[44]   GroupGraphPattern   ::=   '{' ( SubSelect | GroupGraphPatternSub ) '}'
[45]   GroupGraphPatternSub   ::=   TriplesBlock? ( ( GraphPatternNotTriples | Filter ) '.'? TriplesBlock? )*
[46]   TriplesBlock   ::=   TriplesSameSubjectPath ( '.' TriplesBlock? )?
[47]   GraphPatternNotTriples   ::=   OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern | ExistsElt | NotExistsElt
[48]   OptionalGraphPattern   ::=   'OPTIONAL' GroupGraphPattern
[49]   GraphGraphPattern   ::=   'GRAPH' VarOrIRIref GroupGraphPattern
[50]   ExistsElt   ::=   'EXISTS' GroupGraphPattern
[51]   NotExistsElt   ::=   ( 'UNSAID' | 'NOT EXISTS' ) GroupGraphPattern
[52]   GroupOrUnionGraphPattern   ::=   GroupGraphPattern ( 'UNION' GroupGraphPattern )*
[53]   Filter   ::=   'FILTER' Constraint
[54]   Constraint   ::=   BrackettedExpression | BuiltInCall | FunctionCall
[55]   FunctionCall   ::=   IRIref ArgList
[56]   ArgList   ::=   ( NIL | '(' Expression ( ',' Expression )* ')' )
[57]   ConstructTemplate   ::=   '{' ConstructTriples? '}'
[58]   ConstructTriples   ::=   TriplesSameSubject ( '.' TriplesSameSubject )* '.'?
[59]   TriplesSameSubject   ::=   VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList
[60]   PropertyListNotEmpty   ::=   Verb ObjectList ( ';' ( Verb ObjectList )? )*
[61]   PropertyList   ::=   PropertyListNotEmpty?
[62]   ObjectList   ::=   Object ( ',' Object )*
[63]   Object   ::=   GraphNode
[64]   Verb   ::=   VarOrIRIref | 'a'
[65]   TriplesSameSubjectPath   ::=   VarOrTerm PropertyListNotEmptyPath | TriplesNode PropertyListPath
[66]   PropertyListNotEmptyPath   ::=   ( VerbPath | VerbSimple ) ObjectList ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )*
[67]   PropertyListPath   ::=   PropertyListNotEmpty?
[68]   VerbPath   ::=   Path
[69]   VerbSimple   ::=   Var
[70]   Path   ::=   PathAlternative
[71]   PathAlternative   ::=   PathSequence ( '|' PathSequence )*
[72]   PathSequence   ::=   PathEltOrInverse ( '/' PathEltOrInverse | '^' PathElt )*
[73]   PathElt   ::=   PathPrimary PathMod?
[74]   PathEltOrInverse   ::=   PathElt | '^' PathElt
[75]   PathMod   ::=   ( '*' | '?' | '+' | '{' ( Integer ( ',' ( '}' | Integer '}' ) | '}' ) ) )
[76]   PathPrimary   ::=   ( IRIref | 'a' | '!' PathNegatedPropertyClass | '(' Path ')' )
[77]   PathNegatedPropertyClass   ::=   ( PathOneInPropertyClass | '(' ( PathOneInPropertyClass ( '|' PathOneInPropertyClass )* )? ')' )
[78]   PathOneInPropertyClass   ::=   IRIref | 'a'
[79]   Integer   ::=   INTEGER
[80]   TriplesNode   ::=   Collection | BlankNodePropertyList
[81]   BlankNodePropertyList   ::=   '[' PropertyListNotEmpty ']'
[82]   Collection   ::=   '(' GraphNode+ ')'
[83]   GraphNode   ::=   VarOrTerm | TriplesNode
[84]   VarOrTerm   ::=   Var | GraphTerm
[85]   VarOrIRIref   ::=   Var | IRIref
[86]   Var   ::=   VAR1 | VAR2
[87]   GraphTerm   ::=   IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL
[88]   Expression   ::=   ConditionalOrExpression
[89]   ConditionalOrExpression   ::=   ConditionalAndExpression ( '||' ConditionalAndExpression )*
[90]   ConditionalAndExpression   ::=   ValueLogical ( '&&' ValueLogical )*
[91]   ValueLogical   ::=   RelationalExpression
[92]   RelationalExpression   ::=   NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | IN ArgList | NOT_IN ArgList )?
[93]   NumericExpression   ::=   AdditiveExpression
[94]   AdditiveExpression   ::=   MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )? )*
[95]   MultiplicativeExpression   ::=   UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )*
[96]   UnaryExpression   ::=     '!' PrimaryExpression
| '+' PrimaryExpression
| '-' PrimaryExpression
| PrimaryExpression
[97]   PrimaryExpression   ::=   BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | Aggregate
[98]   BrackettedExpression   ::=   '(' Expression ')'
[99]   BuiltInCall   ::=     'STR' '(' Expression ')'
| 'LANG' '(' Expression ')'
| 'LANGMATCHES' '(' Expression ',' Expression ')'
| 'DATATYPE' '(' Expression ')'
| 'BOUND' '(' Var ')'
| 'IRI' '(' Expression ')'
| 'URI' '(' Expression ')'
| 'BNODE' '(' Expression? ')'
| 'COALESCE' ArgList
| 'IF' '(' Expression ',' Expression ',' Expression ')'
| 'STRLANG' '(' Expression ',' Expression ')'
| 'STRDT' '(' Expression ',' Expression ')'
| 'sameTerm' '(' Expression ',' Expression ')'
| 'isIRI' '(' Expression ')'
| 'isURI' '(' Expression ')'
| 'isBLANK' '(' Expression ')'
| 'isLITERAL' '(' Expression ')'
| RegexExpression
| ExistsFunc
| NotExistsFunc
[100]   RegexExpression   ::=   'REGEX' '(' Expression ',' Expression ( ',' Expression )? ')'
[101]   ExistsFunc   ::=   'EXISTS' GroupGraphPattern
[102]   NotExistsFunc   ::=   ( 'UNSAID' | 'NOT EXISTS' ) GroupGraphPattern
[103]   Aggregate   ::=   ( 'COUNT' '(' ( '*' | Var | 'DISTINCT' ( '*' | Var ) ) ')' | 'SUM' '(' Expression ')' | 'MIN' '(' Expression ')' | 'MAX' '(' Expression ')' | 'AVG' '(' Expression ')' )
[104]   IRIrefOrFunction   ::=   IRIref ArgList?
[105]   RDFLiteral   ::=   String ( LANGTAG | ( '^^' IRIref ) )?
[106]   NumericLiteral   ::=   NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative
[107]   NumericLiteralUnsigned   ::=   INTEGER | DECIMAL | DOUBLE
[108]   NumericLiteralPositive   ::=   INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE
[109]   NumericLiteralNegative   ::=   INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE
[110]   BooleanLiteral   ::=   'true' | 'false'
[111]   String   ::=   STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2
[112]   IRIref   ::=   IRI_REF | PrefixedName
[113]   PrefixedName   ::=   PNAME_LN | PNAME_NS
[114]   BlankNode   ::=   BLANK_NODE_LABEL | ANON
[115]   IRI_REF   ::=   '<' ([^<>"{}|^`\]-[#x00-#x20])* '>'
[116]   PNAME_NS   ::=   PN_PREFIX? ':'
[117]   PNAME_LN   ::=   PNAME_NS PN_LOCAL
[118]   BLANK_NODE_LABEL   ::=   '_:' PN_LOCAL
[119]   VAR1   ::=   '?' VARNAME
[120]   VAR2   ::=   '$' VARNAME
[121]   LANGTAG   ::=   '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
[122]   INTEGER   ::=   [0-9]+
[123]   DECIMAL   ::=   [0-9]+ '.' [0-9]* | '.' [0-9]+
[124]   DOUBLE   ::=   [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT
[125]   INTEGER_POSITIVE   ::=   '+' INTEGER
[126]   DECIMAL_POSITIVE   ::=   '+' DECIMAL
[127]   DOUBLE_POSITIVE   ::=   '+' DOUBLE
[128]   INTEGER_NEGATIVE   ::=   '-' INTEGER
[129]   DECIMAL_NEGATIVE   ::=   '-' DECIMAL
[130]   DOUBLE_NEGATIVE   ::=   '-' DOUBLE
[131]   EXPONENT   ::=   [eE] [+-]? [0-9]+
[132]   STRING_LITERAL1   ::=   "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'"
[133]   STRING_LITERAL2   ::=   '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"'
[134]   STRING_LITERAL_LONG1   ::=   "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR ) )* "'''"
[135]   STRING_LITERAL_LONG2   ::=   '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR ) )* '"""'
[136]   ECHAR   ::=   '\' [tbnrf\"']
[137]   NIL   ::=   '(' WS* ')'
[138]   WS   ::=   #x20 | #x9 | #xD | #xA
[139]   ANON   ::=   '[' WS* ']'
[140]   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]
[141]   PN_CHARS_U   ::=   PN_CHARS_BASE | '_'
[142]   VARNAME   ::=   ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
[143]   PN_CHARS   ::=   PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]
[144]   PN_PREFIX   ::=   PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)?
[145]   PN_LOCAL   ::=   ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?