Query ::= SelectClause ( FromClause )? TriplePatternClause ( ConstraintClause )? ( UsingClause )? SelectClause ::= 'SELECT' VarList FromClause ::= 'FROM' UriList TriplePatternClause ::= 'WHERE' TriplePatternList ConstraintClause ::= 'AND' ConstraintList UsingClause ::= 'USING' ( ForList )+ TriplePatternList ::= TriplePattern ( TriplePattern )* TriplePattern ::= '(' VarOrLiteral VarOrLiteral VarOrLiteral ')' VarOrLiteral ::= Var | Literal Var ::= '?' Identifier VarList ::= Var ( ( ',' )? Var )* UriList ::= UriLiteral ( ( "," )? UriLiteral )* ConstraintList ::= Expression ( 'AND' Expression )* ForList ::= Identifier 'FOR' UriLiteral Expression ::= Var SomeFunction SomeFunction ::= ( NumExpression | StringExpression )+ NumExpression ::= ( '>' | '<' | '==' | '=' | '!=' | '<=' | '>=' ) NumericLiteral StringExpression ::= ( 'like' | 'ne' | 'eq' | '~' ) Literal Literal ::= TextLiteral | UriLiteral | NumericLiteral NumericLiteral ::= /\d+/ | /\d+\.\d+/ ; UriLiteral ::= /[A-Za-z][\w:-\.]*/ ; TextLiteral ::= /'\w+'/ Identifier ::= /[A-Za-z]\w*/