anchor.diff:      : '-'
       ;
   
  +fragment
  +SIGN
  +    : (PLUS|MINUS)	
  +    ;
  +	
   ASTERISK
       : '*'
       ;
   
  +QUESTION_MARK
  +    : '?'
  +    ;
  +    	
   COMMA
       : ','
       ;
   
  -NOT
  +NEGATION
       : '!'
       ;
   
  
positive.code: // $<Parser
  
  query
      : prologue ( selectQuery | constructQuery | describeQuery | askQuery ) EOF
      ;
  
  prologue
      : baseDecl? prefixDecl*
      ;
  
  baseDecl
      : BASE IRI_REF
      ;
  
  prefixDecl
      : PREFIX PNAME_NS IRI_REF
      ;
  
  selectQuery
      : SELECT ( DISTINCT | REDUCED )? ( var+ | ASTERISK ) datasetClause* whereClause solutionModifier
      ;
  
  constructQuery
      : CONSTRUCT constructTemplate datasetClause* whereClause solutionModifier
      ;
  
  describeQuery
      : DESCRIBE ( varOrIRIref+ | ASTERISK ) datasetClause* whereClause? solutionModifier
      ;
  
  askQuery
      : ASK datasetClause* whereClause
      ;
  
  datasetClause
      : FROM ( defaultGraphClause | namedGraphClause )
      ;
  
  defaultGraphClause
      : sourceSelector
      ;
  
  namedGraphClause
      : NAMED sourceSelector
      ;
  
  sourceSelector
      : iriRef
      ;
  
  whereClause
      : WHERE? groupGraphPattern
      ;
  
  solutionModifier
      : orderClause? limitOffsetClauses?
      ;
  
  limitOffsetClauses
      : ( limitClause offsetClause? | offsetClause limitClause? )
      ;
  
  orderClause
      : ORDER BY orderCondition+
      ;
  
  orderCondition
      : ( ( ASC | DESC ) brackettedExpression )
      | ( constraint | var )
      ;
  
  limitClause
      : LIMIT INTEGER
      ;
  
  offsetClause
      : OFFSET INTEGER
      ;
  
  groupGraphPattern
      : OPEN_CURLY_BRACE triplesBlock? ( ( graphPatternNotTriples | filter ) DOT? triplesBlock? )* CLOSE_CURLY_BRACE
      ;
  
  triplesBlock
      : triplesSameSubject ( DOT triplesBlock? )?
      ;
  
  graphPatternNotTriples
      : optionalGraphPattern | groupOrUnionGraphPattern | graphGraphPattern
      ;
  
  optionalGraphPattern
      : OPTIONAL groupGraphPattern
      ;
  
  graphGraphPattern
      : GRAPH varOrIRIref groupGraphPattern
      ;
  
  groupOrUnionGraphPattern
      : groupGraphPattern ( UNION groupGraphPattern )*
      ;
  
  filter
      : FILTER constraint
      ;
  
  constraint
  
negative.code:     ;
  
  varOrTerm
      : var | graphTerm
      ;
  
  varOrIRIref
  