anchor.diff:      ;
       	
   path
  -    : pathSequence ( PIPE pathSequence )* -> PATH pathSequence ( PIPE pathSequence )*
  +    : pathSequence ( PIPE pathSequence )* -> ^(PATH pathSequence+)
       ; 
   
   pathSequence
  -    : pathEltOrInverse ( DIVIDE pathEltOrInverse )*
  -    ;
  -    	  	
  +    : pathEltOrInverse ( DIVIDE pathEltOrInverse )* -> ^(PATH_SEQUENCE pathEltOrInverse+)
  +    ;
  +
  +pathEltOrInverse
  +    : INVERSE? pathElt
  +    ;
  +       	  	
   pathElt
       : pathPrimary pathMod?
       ;
  -    
  -pathEltOrInverse
  -    : pathElt | INVERSE pathElt
  -    ;
  -    
  +
   pathMod
       : ( ASTERISK | QUESTION_MARK | PLUS | OPEN_CURLY_BRACE ( INTEGER ( COMMA ( CLOSE_CURLY_BRACE | INTEGER CLOSE_CURLY_BRACE ) | CLOSE_CURLY_BRACE ) | COMMA INTEGER CLOSE_CURLY_BRACE ) )
       ;
  
positive.code: 	
  triplesNode
      : OPEN_BRACE graphNode+ CLOSE_BRACE -> ^(COLLECTION graphNode+)
      | lsb=OPEN_SQUARE_BRACKET propertyListNotEmpty[new CommonTree(new CommonToken(VAR,"[]"))] CLOSE_SQUARE_BRACKET -> ^(TRIPLE propertyListNotEmpty)
      ;
  
  graphNode
  
negative.code:     ;
  
  triplesSameSubjectPath
      : varOrTerm propertyListNotEmptyPath[(CommonTree)$varOrTerm.tree] -> ^(TRIPLE propertyListNotEmptyPath)
      | triplesNode propertyListNotEmpty[new CommonTree(new CommonToken(BLANK_NODE,"[]"))]? -> ^(TRIPLE  triplesNode (/*^(SUBJECT BLANK_NODE)*/ propertyListNotEmpty)?)
      ;
    
  propertyListNotEmptyPath[CommonTree subject]
      : verbSimpleOrPath objectList (SEMICOLON (verbSimpleOrPath objectList)?)* -> (^(SUBJECT {new CommonTree(subject)}) ^(PREDICATE verbSimpleOrPath) objectList)+
      ;
    
  verbSimpleOrPath
      : verbPath
      | verbSimple
      ;
    
  verbPath
      : path
      ;
  