/* SPARQLParser12.java */
/* Generated By:JavaCC: Do not edit this line. SPARQLParser12.java */
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *   SPDX-License-Identifier: Apache-2.0
 */
package org.apache.jena.sparql.lang.sparql_12.javacc ;
import org.apache.jena.graph.* ;
import org.apache.jena.query.* ;
import org.apache.jena.sparql.core.Var ;
import org.apache.jena.sparql.syntax.* ;
import org.apache.jena.sparql.expr.* ;
import org.apache.jena.sparql.path.* ;
import org.apache.jena.sparql.expr.aggregate.* ;
import org.apache.jena.sparql.expr.aggregate.lib.* ;
import org.apache.jena.update.* ;
import org.apache.jena.sparql.modify.request.* ;

@SuppressWarnings("all")
public class SPARQLParser12 extends org.apache.jena.sparql.lang.sparql_12.SPARQLParser12Base implements SPARQLParser12Constants {

// // Common top for single entry point.
// void Top(): {}
// {
//     ( Query() | Update() )
//     <EOF>
// }
// Query only entry point
  final public void QueryUnit() throws ParseException {
startQuery() ;
    Query();
    jj_consume_token(0);
finishQuery() ;
}

  final public void Query() throws ParseException {
    Prologue();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SELECT:{
      SelectQuery();
      break;
      }
    case CONSTRUCT:{
      ConstructQuery();
      break;
      }
    case DESCRIBE:{
      DescribeQuery();
      break;
      }
    case ASK:{
      AskQuery();
      break;
      }
    default:
      jj_la1[0] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    ValuesClause();
}

  final public void UpdateUnit() throws ParseException {
startUpdateRequest() ;
    Update();
    jj_consume_token(0);
finishUpdateRequest() ;
}

  final public void Prologue() throws ParseException {
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case BASE:
      case PREFIX:
      case VERSION:{
        ;
        break;
        }
      default:
        jj_la1[1] = jj_gen;
        break label_1;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case BASE:{
        BaseDecl();
        break;
        }
      case PREFIX:{
        PrefixDecl();
        break;
        }
      case VERSION:{
        VersionDecl();
        break;
        }
      default:
        jj_la1[2] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
}

  final public void BaseDecl() throws ParseException {Token t ; String iri ;
    t = jj_consume_token(BASE);
    iri = IRIREF();
setBase(iri, t.beginLine, t.beginColumn ) ;
}

  final public void PrefixDecl() throws ParseException {Token t ; String iri ;
    jj_consume_token(PREFIX);
    t = jj_consume_token(PNAME_NS);
    iri = IRIREF();
String s = fixupPrefix(t.image, t.beginLine, t.beginColumn);
      setPrefix(s, iri, t.beginLine, t.beginColumn) ;
}

  final public void VersionDecl() throws ParseException {Token t ; String version ;
    t = jj_consume_token(VERSION);
    version = VersionSpecifier();
declareVersion(version, t.beginLine, t.beginColumn);
}

  final public String VersionSpecifier() throws ParseException {Token t ; String version ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case STRING_LITERAL1:{
      t = jj_consume_token(STRING_LITERAL1);
version = stripQuotes(t.image) ;
      break;
      }
    case STRING_LITERAL2:{
      t = jj_consume_token(STRING_LITERAL2);
version = stripQuotes(t.image) ;
      break;
      }
    default:
      jj_la1[3] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
version = unescapeStr(version, t.beginLine, t.beginColumn) ;
      checkRDFString(version, t.beginLine, t.beginColumn) ;
      {if ("" != null) return version;}
    throw new Error("Missing return statement in function");
}

// ---- Query type clauses
  final public void SelectQuery() throws ParseException {
    SelectClause();
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case FROM:{
        ;
        break;
        }
      default:
        jj_la1[4] = jj_gen;
        break label_2;
      }
      DatasetClause();
    }
    WhereClause();
    SolutionModifier();
}

  final public void SubSelect() throws ParseException {
    SelectClause();
    WhereClause();
    SolutionModifier();
    ValuesClause();
}

  final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ;
    jj_consume_token(SELECT);
getQuery().setQuerySelectType() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DISTINCT:
    case REDUCED:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
getQuery().setDistinct(true);
        break;
        }
      case REDUCED:{
        jj_consume_token(REDUCED);
getQuery().setReduced(true);
        break;
        }
      default:
        jj_la1[5] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    default:
      jj_la1[6] = jj_gen;
      ;
    }
setAllowAggregatesInExpressions(true) ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:
    case LPAREN:{
      label_3:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case VAR1:
        case VAR2:{
          v = Var();
getQuery().addResultVar(v) ;
          break;
          }
        case LPAREN:{
v = null ;
          jj_consume_token(LPAREN);
          expr = Expression();
          jj_consume_token(AS);
          v = Var();
          jj_consume_token(RPAREN);
getQuery().addResultVar(v, expr) ;
getQuery().setQueryResultStar(false) ;
          break;
          }
        default:
          jj_la1[7] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case VAR1:
        case VAR2:
        case LPAREN:{
          ;
          break;
          }
        default:
          jj_la1[8] = jj_gen;
          break label_3;
        }
      }
      break;
      }
    case STAR:{
      jj_consume_token(STAR);
getQuery().setQueryResultStar(true) ;
      break;
      }
    default:
      jj_la1[9] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
setAllowAggregatesInExpressions(false) ;
}

  final public void ConstructQuery() throws ParseException {Template t ;
                          TripleCollectorBGP acc = new TripleCollectorBGP() ;
    jj_consume_token(CONSTRUCT);
getQuery().setQueryConstructType() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LBRACE:{
      // Full form.
          t = ConstructTemplate();
getQuery().setConstructTemplate(t) ;
      label_4:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case FROM:{
          ;
          break;
          }
        default:
          jj_la1[10] = jj_gen;
          break label_4;
        }
        DatasetClause();
      }
      WhereClause();
      SolutionModifier();
      break;
      }
    case FROM:
    case WHERE:{
      label_5:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case FROM:{
          ;
          break;
          }
        default:
          jj_la1[11] = jj_gen;
          break label_5;
        }
        DatasetClause();
      }
      jj_consume_token(WHERE);
      t = ConstructTemplate();
getQuery().setConstructTemplate(t) ;
      ElementGroup elg = templateToQueryPattern(t);
      getQuery().setQueryPattern(elg) ;
      SolutionModifier();
      break;
      }
    default:
      jj_la1[12] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void DescribeQuery() throws ParseException {Node n ;
    jj_consume_token(DESCRIBE);
getQuery().setQueryDescribeType() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:{
      label_6:
      while (true) {
        n = VarOrIri();
getQuery().addDescribeNode(n) ;
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case IRIref:
        case PNAME_NS:
        case PNAME_LN:
        case VAR1:
        case VAR2:{
          ;
          break;
          }
        default:
          jj_la1[13] = jj_gen;
          break label_6;
        }
      }
getQuery().setQueryResultStar(false) ;
      break;
      }
    case STAR:{
      jj_consume_token(STAR);
getQuery().setQueryResultStar(true) ;
      break;
      }
    default:
      jj_la1[14] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    label_7:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case FROM:{
        ;
        break;
        }
      default:
        jj_la1[15] = jj_gen;
        break label_7;
      }
      DatasetClause();
    }
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case WHERE:
    case LBRACE:{
      WhereClause();
      break;
      }
    default:
      jj_la1[16] = jj_gen;
      ;
    }
    SolutionModifier();
}

  final public void AskQuery() throws ParseException {
    jj_consume_token(ASK);
getQuery().setQueryAskType() ;
    label_8:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case FROM:{
        ;
        break;
        }
      default:
        jj_la1[17] = jj_gen;
        break label_8;
      }
      DatasetClause();
    }
    WhereClause();
    SolutionModifier();
}

// ----
  final public void DatasetClause() throws ParseException {
    jj_consume_token(FROM);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      DefaultGraphClause();
      break;
      }
    case NAMED:{
      NamedGraphClause();
      break;
      }
    default:
      jj_la1[18] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void DefaultGraphClause() throws ParseException {String iri ;
    iri = SourceSelector();
// This checks for duplicates
    getQuery().addGraphURI(iri) ;
}

  final public void NamedGraphClause() throws ParseException {String iri ;
    jj_consume_token(NAMED);
    iri = SourceSelector();
// This checks for duplicates
    getQuery().addNamedGraphURI(iri) ;
}

  final public String SourceSelector() throws ParseException {String iri ;
    iri = iri();
{if ("" != null) return iri ;}
    throw new Error("Missing return statement in function");
}

  final public void WhereClause() throws ParseException {Element el ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case WHERE:{
      jj_consume_token(WHERE);
      break;
      }
    default:
      jj_la1[19] = jj_gen;
      ;
    }
startWherePattern() ;
    el = GroupGraphPattern();
getQuery().setQueryPattern(el) ;
finishWherePattern() ;
}

  final public void SolutionModifier() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case GROUP:{
      GroupClause();
      break;
      }
    default:
      jj_la1[20] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case HAVING:{
      HavingClause();
      break;
      }
    default:
      jj_la1[21] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case ORDER:{
      OrderClause();
      break;
      }
    default:
      jj_la1[22] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LIMIT:
    case OFFSET:{
      LimitOffsetClauses();
      break;
      }
    default:
      jj_la1[23] = jj_gen;
      ;
    }
}

  final public void GroupClause() throws ParseException {
    jj_consume_token(GROUP);
    jj_consume_token(BY);
    label_9:
    while (true) {
      GroupCondition();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case VAR1:
      case VAR2:
      case TRIPLE:
      case IS_TRIPLE:
      case SUBJECT:
      case PREDICATE:
      case OBJECT:
      case EXISTS:
      case NOT:
      case COUNT:
      case MIN:
      case MAX:
      case SUM:
      case AVG:
      case SAMPLE:
      case GROUP_CONCAT:
      case BOUND:
      case COALESCE:
      case IF:
      case BNODE:
      case IRI:
      case URI:
      case STR:
      case STRLANG:
      case STRLANGDIR:
      case STRDT:
      case DTYPE:
      case LANG:
      case LANGMATCHES:
      case LANGDIR:
      case IS_URI:
      case IS_IRI:
      case IS_BLANK:
      case IS_LITERAL:
      case IS_NUMERIC:
      case HAS_LANG:
      case HAS_LANGDIR:
      case REGEX:
      case SAME_TERM:
      case RAND:
      case ABS:
      case CEIL:
      case FLOOR:
      case ROUND:
      case CONCAT:
      case SUBSTR:
      case STRLEN:
      case REPLACE:
      case UCASE:
      case LCASE:
      case ENCODE_FOR_URI:
      case CONTAINS:
      case STRSTARTS:
      case STRENDS:
      case STRBEFORE:
      case STRAFTER:
      case YEAR:
      case MONTH:
      case DAY:
      case HOURS:
      case MINUTES:
      case SECONDS:
      case TIMEZONE:
      case TZ:
      case NOW:
      case UUID:
      case STRUUID:
      case MD5:
      case SHA1:
      case SHA256:
      case SHA384:
      case SHA512:
      case LPAREN:{
        ;
        break;
        }
      default:
        jj_la1[24] = jj_gen;
        break label_9;
      }
    }
}

  final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case TRIPLE:
    case IS_TRIPLE:
    case SUBJECT:
    case PREDICATE:
    case OBJECT:
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:
    case BOUND:
    case COALESCE:
    case IF:
    case BNODE:
    case IRI:
    case URI:
    case STR:
    case STRLANG:
    case STRLANGDIR:
    case STRDT:
    case DTYPE:
    case LANG:
    case LANGMATCHES:
    case LANGDIR:
    case IS_URI:
    case IS_IRI:
    case IS_BLANK:
    case IS_LITERAL:
    case IS_NUMERIC:
    case HAS_LANG:
    case HAS_LANGDIR:
    case REGEX:
    case SAME_TERM:
    case RAND:
    case ABS:
    case CEIL:
    case FLOOR:
    case ROUND:
    case CONCAT:
    case SUBSTR:
    case STRLEN:
    case REPLACE:
    case UCASE:
    case LCASE:
    case ENCODE_FOR_URI:
    case CONTAINS:
    case STRSTARTS:
    case STRENDS:
    case STRBEFORE:
    case STRAFTER:
    case YEAR:
    case MONTH:
    case DAY:
    case HOURS:
    case MINUTES:
    case SECONDS:
    case TIMEZONE:
    case TZ:
    case NOW:
    case UUID:
    case STRUUID:
    case MD5:
    case SHA1:
    case SHA256:
    case SHA384:
    case SHA512:{
      expr = BuiltInCall();
getQuery().addGroupBy((Var)null, expr) ;
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      expr = FunctionCall();
getQuery().addGroupBy((Var)null, expr) ;
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      expr = Expression();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case AS:{
        jj_consume_token(AS);
        v = Var();
        break;
        }
      default:
        jj_la1[25] = jj_gen;
        ;
      }
      jj_consume_token(RPAREN);
getQuery().addGroupBy(v ,expr) ;
      break;
      }
    case VAR1:
    case VAR2:{
      v = Var();
getQuery().addGroupBy(v) ;
      break;
      }
    default:
      jj_la1[26] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void HavingClause() throws ParseException {
setAllowAggregatesInExpressions(true) ;
    jj_consume_token(HAVING);
    label_10:
    while (true) {
      HavingCondition();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case TRIPLE:
      case IS_TRIPLE:
      case SUBJECT:
      case PREDICATE:
      case OBJECT:
      case EXISTS:
      case NOT:
      case COUNT:
      case MIN:
      case MAX:
      case SUM:
      case AVG:
      case SAMPLE:
      case GROUP_CONCAT:
      case BOUND:
      case COALESCE:
      case IF:
      case BNODE:
      case IRI:
      case URI:
      case STR:
      case STRLANG:
      case STRLANGDIR:
      case STRDT:
      case DTYPE:
      case LANG:
      case LANGMATCHES:
      case LANGDIR:
      case IS_URI:
      case IS_IRI:
      case IS_BLANK:
      case IS_LITERAL:
      case IS_NUMERIC:
      case HAS_LANG:
      case HAS_LANGDIR:
      case REGEX:
      case SAME_TERM:
      case RAND:
      case ABS:
      case CEIL:
      case FLOOR:
      case ROUND:
      case CONCAT:
      case SUBSTR:
      case STRLEN:
      case REPLACE:
      case UCASE:
      case LCASE:
      case ENCODE_FOR_URI:
      case CONTAINS:
      case STRSTARTS:
      case STRENDS:
      case STRBEFORE:
      case STRAFTER:
      case YEAR:
      case MONTH:
      case DAY:
      case HOURS:
      case MINUTES:
      case SECONDS:
      case TIMEZONE:
      case TZ:
      case NOW:
      case UUID:
      case STRUUID:
      case MD5:
      case SHA1:
      case SHA256:
      case SHA384:
      case SHA512:
      case LPAREN:{
        ;
        break;
        }
      default:
        jj_la1[27] = jj_gen;
        break label_10;
      }
    }
setAllowAggregatesInExpressions(false) ;
}

  final public void HavingCondition() throws ParseException {Expr c ;
    c = Constraint();
getQuery().addHavingCondition(c) ;
}

  final public void OrderClause() throws ParseException {
setAllowAggregatesInExpressions(true) ;
    jj_consume_token(ORDER);
    jj_consume_token(BY);
    label_11:
    while (true) {
      OrderCondition();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case VAR1:
      case VAR2:
      case ASC:
      case DESC:
      case TRIPLE:
      case IS_TRIPLE:
      case SUBJECT:
      case PREDICATE:
      case OBJECT:
      case EXISTS:
      case NOT:
      case COUNT:
      case MIN:
      case MAX:
      case SUM:
      case AVG:
      case SAMPLE:
      case GROUP_CONCAT:
      case BOUND:
      case COALESCE:
      case IF:
      case BNODE:
      case IRI:
      case URI:
      case STR:
      case STRLANG:
      case STRLANGDIR:
      case STRDT:
      case DTYPE:
      case LANG:
      case LANGMATCHES:
      case LANGDIR:
      case IS_URI:
      case IS_IRI:
      case IS_BLANK:
      case IS_LITERAL:
      case IS_NUMERIC:
      case HAS_LANG:
      case HAS_LANGDIR:
      case REGEX:
      case SAME_TERM:
      case RAND:
      case ABS:
      case CEIL:
      case FLOOR:
      case ROUND:
      case CONCAT:
      case SUBSTR:
      case STRLEN:
      case REPLACE:
      case UCASE:
      case LCASE:
      case ENCODE_FOR_URI:
      case CONTAINS:
      case STRSTARTS:
      case STRENDS:
      case STRBEFORE:
      case STRAFTER:
      case YEAR:
      case MONTH:
      case DAY:
      case HOURS:
      case MINUTES:
      case SECONDS:
      case TIMEZONE:
      case TZ:
      case NOW:
      case UUID:
      case STRUUID:
      case MD5:
      case SHA1:
      case SHA256:
      case SHA384:
      case SHA512:
      case LPAREN:{
        ;
        break;
        }
      default:
        jj_la1[28] = jj_gen;
        break label_11;
      }
    }
setAllowAggregatesInExpressions(false) ;
}

  final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ;
direction = Query.ORDER_DEFAULT ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case ASC:
    case DESC:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case ASC:{
        jj_consume_token(ASC);
direction = Query.ORDER_ASCENDING ;
        break;
        }
      case DESC:{
        jj_consume_token(DESC);
direction = Query.ORDER_DESCENDING ;
        break;
        }
      default:
        jj_la1[29] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      expr = BrackettedExpression();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:
    case TRIPLE:
    case IS_TRIPLE:
    case SUBJECT:
    case PREDICATE:
    case OBJECT:
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:
    case BOUND:
    case COALESCE:
    case IF:
    case BNODE:
    case IRI:
    case URI:
    case STR:
    case STRLANG:
    case STRLANGDIR:
    case STRDT:
    case DTYPE:
    case LANG:
    case LANGMATCHES:
    case LANGDIR:
    case IS_URI:
    case IS_IRI:
    case IS_BLANK:
    case IS_LITERAL:
    case IS_NUMERIC:
    case HAS_LANG:
    case HAS_LANGDIR:
    case REGEX:
    case SAME_TERM:
    case RAND:
    case ABS:
    case CEIL:
    case FLOOR:
    case ROUND:
    case CONCAT:
    case SUBSTR:
    case STRLEN:
    case REPLACE:
    case UCASE:
    case LCASE:
    case ENCODE_FOR_URI:
    case CONTAINS:
    case STRSTARTS:
    case STRENDS:
    case STRBEFORE:
    case STRAFTER:
    case YEAR:
    case MONTH:
    case DAY:
    case HOURS:
    case MINUTES:
    case SECONDS:
    case TIMEZONE:
    case TZ:
    case NOW:
    case UUID:
    case STRUUID:
    case MD5:
    case SHA1:
    case SHA256:
    case SHA384:
    case SHA512:
    case LPAREN:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case TRIPLE:
      case IS_TRIPLE:
      case SUBJECT:
      case PREDICATE:
      case OBJECT:
      case EXISTS:
      case NOT:
      case COUNT:
      case MIN:
      case MAX:
      case SUM:
      case AVG:
      case SAMPLE:
      case GROUP_CONCAT:
      case BOUND:
      case COALESCE:
      case IF:
      case BNODE:
      case IRI:
      case URI:
      case STR:
      case STRLANG:
      case STRLANGDIR:
      case STRDT:
      case DTYPE:
      case LANG:
      case LANGMATCHES:
      case LANGDIR:
      case IS_URI:
      case IS_IRI:
      case IS_BLANK:
      case IS_LITERAL:
      case IS_NUMERIC:
      case HAS_LANG:
      case HAS_LANGDIR:
      case REGEX:
      case SAME_TERM:
      case RAND:
      case ABS:
      case CEIL:
      case FLOOR:
      case ROUND:
      case CONCAT:
      case SUBSTR:
      case STRLEN:
      case REPLACE:
      case UCASE:
      case LCASE:
      case ENCODE_FOR_URI:
      case CONTAINS:
      case STRSTARTS:
      case STRENDS:
      case STRBEFORE:
      case STRAFTER:
      case YEAR:
      case MONTH:
      case DAY:
      case HOURS:
      case MINUTES:
      case SECONDS:
      case TIMEZONE:
      case TZ:
      case NOW:
      case UUID:
      case STRUUID:
      case MD5:
      case SHA1:
      case SHA256:
      case SHA384:
      case SHA512:
      case LPAREN:{
        expr = Constraint();
        break;
        }
      case VAR1:
      case VAR2:{
        v = Var();
        break;
        }
      default:
        jj_la1[30] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    default:
      jj_la1[31] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if ( v == null )
          getQuery().addOrderBy(expr, direction) ;
      else
          getQuery().addOrderBy(v, direction) ;
}

  final public void LimitOffsetClauses() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LIMIT:{
      LimitClause();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case OFFSET:{
        OffsetClause();
        break;
        }
      default:
        jj_la1[32] = jj_gen;
        ;
      }
      break;
      }
    case OFFSET:{
      OffsetClause();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case LIMIT:{
        LimitClause();
        break;
        }
      default:
        jj_la1[33] = jj_gen;
        ;
      }
      break;
      }
    default:
      jj_la1[34] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void LimitClause() throws ParseException {Token t ;
    jj_consume_token(LIMIT);
    t = jj_consume_token(INTEGER);
getQuery().setLimit(integerValue(t.image)) ;
}

  final public void OffsetClause() throws ParseException {Token t ;
    jj_consume_token(OFFSET);
    t = jj_consume_token(INTEGER);
getQuery().setOffset(integerValue(t.image)) ;
}

  final public void ValuesClause() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VALUES:{
      t = jj_consume_token(VALUES);
startValuesClause(t.beginLine, t.beginColumn) ;
      DataBlock();
finishValuesClause(t.beginLine, t.beginColumn) ;
      break;
      }
    default:
      jj_la1[35] = jj_gen;
      ;
    }
}

// Strict SPARQL 1.1 : mandatory separator, optional terminator.
  final public void Update() throws ParseException {
    Prologue();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INSERT:
    case DELETE:
    case INSERT_DATA:
    case DELETE_DATA:
    case DELETE_WHERE:
    case LOAD:
    case CLEAR:
    case CREATE:
    case ADD:
    case MOVE:
    case COPY:
    case DROP:
    case WITH:{
      Update1();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SEMICOLON:{
        jj_consume_token(SEMICOLON);
        Update();
        break;
        }
      default:
        jj_la1[36] = jj_gen;
        ;
      }
      break;
      }
    default:
      jj_la1[37] = jj_gen;
      ;
    }
}

  final public void Update1() throws ParseException {Update up = null ;
startUpdateOperation() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LOAD:{
      up = Load();
      break;
      }
    case CLEAR:{
      up = Clear();
      break;
      }
    case DROP:{
      up = Drop();
      break;
      }
    case ADD:{
      up = Add();
      break;
      }
    case MOVE:{
      up = Move();
      break;
      }
    case COPY:{
      up = Copy();
      break;
      }
    case CREATE:{
      up = Create();
      break;
      }
    case DELETE_WHERE:{
      up = DeleteWhere();
      break;
      }
    case INSERT:
    case DELETE:
    case WITH:{
      up = Modify();
      break;
      }
    case INSERT_DATA:{
      InsertData();
      break;
      }
    case DELETE_DATA:{
      DeleteData();
      break;
      }
    default:
      jj_la1[38] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if (null != up) emitUpdate(up) ;
    finishUpdateOperation() ;
}

  final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ;
    jj_consume_token(LOAD);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent = true ;
      break;
      }
    default:
      jj_la1[39] = jj_gen;
      ;
    }
    url = iri();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INTO:{
      jj_consume_token(INTO);
      dest = GraphRef();
      break;
      }
    default:
      jj_la1[40] = jj_gen;
      ;
    }
{if ("" != null) return new UpdateLoad(url, dest, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Clear() throws ParseException {boolean silent = false ; Target target ;
    jj_consume_token(CLEAR);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent = true ;
      break;
      }
    default:
      jj_la1[41] = jj_gen;
      ;
    }
    target = GraphRefAll();
{if ("" != null) return new UpdateClear(target, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Drop() throws ParseException {boolean silent = false ; Target target ;
    jj_consume_token(DROP);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent = true ;
      break;
      }
    default:
      jj_la1[42] = jj_gen;
      ;
    }
    target = GraphRefAll();
{if ("" != null) return new UpdateDrop(target, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Create() throws ParseException {Node iri ; boolean silent = false ;
    jj_consume_token(CREATE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent=true ;
      break;
      }
    default:
      jj_la1[43] = jj_gen;
      ;
    }
    iri = GraphRef();
{if ("" != null) return new UpdateCreate(iri, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ;
    jj_consume_token(ADD);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent=true ;
      break;
      }
    default:
      jj_la1[44] = jj_gen;
      ;
    }
    src = GraphOrDefault();
    jj_consume_token(TO);
    dest = GraphOrDefault();
{if ("" != null) return new UpdateAdd(src, dest, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ;
    jj_consume_token(MOVE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent=true ;
      break;
      }
    default:
      jj_la1[45] = jj_gen;
      ;
    }
    src = GraphOrDefault();
    jj_consume_token(TO);
    dest = GraphOrDefault();
{if ("" != null) return new UpdateMove(src, dest, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ;
    jj_consume_token(COPY);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent=true ;
      break;
      }
    default:
      jj_la1[46] = jj_gen;
      ;
    }
    src = GraphOrDefault();
    jj_consume_token(TO);
    dest = GraphOrDefault();
{if ("" != null) return new UpdateCopy(src, dest, silent) ;}
    throw new Error("Missing return statement in function");
}

// #ifdef ARQ
// void Meta() : { QuadDataAccSink qd = new QuadDataAccSink() ; }
// {
//    <META> 
//    QuadData(qd)
// }
// #endif
  final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ;
    t = jj_consume_token(INSERT_DATA);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
startDataInsert(qd, beginLine, beginColumn) ;
    QuadData(qd);
finishDataInsert(qd, beginLine, beginColumn) ;
    qd.close() ;
}

  final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ;
    t = jj_consume_token(DELETE_DATA);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
startDataDelete(qd, beginLine, beginColumn) ;
    QuadData(qd);
finishDataDelete(qd, beginLine, beginColumn) ;
    qd.close() ;
}

  final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ;
    t = jj_consume_token(DELETE_WHERE);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
startDeleteTemplate(qp, beginLine, beginColumn) ;
    QuadPattern(qp);
finishDeleteTemplate(qp, beginLine, beginColumn) ;
{if ("" != null) return new UpdateDeleteWhere(qp) ;}
    throw new Error("Missing return statement in function");
}

  final public Update Modify() throws ParseException {Element el ; String iri = null ;
                    UpdateModify up = new UpdateModify() ;
startModifyUpdate() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case WITH:{
      jj_consume_token(WITH);
      iri = iri();
Node n = createNode(iri) ; up.setWithIRI(n) ;
      break;
      }
    default:
      jj_la1[47] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DELETE:{
      DeleteClause(up);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case INSERT:{
        InsertClause(up);
        break;
        }
      default:
        jj_la1[48] = jj_gen;
        ;
      }
      break;
      }
    case INSERT:{
      InsertClause(up);
      break;
      }
    default:
      jj_la1[49] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    label_12:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case USING:{
        ;
        break;
        }
      default:
        jj_la1[50] = jj_gen;
        break label_12;
      }
      UsingClause(up);
    }
    jj_consume_token(WHERE);
startWherePattern() ;
    el = GroupGraphPattern();
up.setElement(el) ;
finishWherePattern() ;
finishModifyUpdate() ;
{if ("" != null) return up ;}
    throw new Error("Missing return statement in function");
}

  final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ;
    t = jj_consume_token(DELETE);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
startDeleteTemplate(qp, beginLine, beginColumn) ;
    QuadPattern(qp);
finishDeleteTemplate(qp, beginLine, beginColumn) ;
up.setHasDeleteClause(true) ;
}

  final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ;
    t = jj_consume_token(INSERT);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
startInsertTemplate(qp, beginLine, beginColumn) ;
    QuadPattern(qp);
finishInsertTemplate(qp, beginLine, beginColumn) ;
up.setHasInsertClause(true) ;
}

  final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ;
    jj_consume_token(USING);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri) ; update.addUsing(n) ;
      break;
      }
    case NAMED:{
      jj_consume_token(NAMED);
      iri = iri();
n = createNode(iri) ; update.addUsingNamed(n) ;
      break;
      }
    default:
      jj_la1[51] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public Target GraphOrDefault() throws ParseException {String iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DFT:{
      jj_consume_token(DFT);
{if ("" != null) return Target.DEFAULT ;}
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case GRAPH:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case GRAPH:{
        jj_consume_token(GRAPH);
        break;
        }
      default:
        jj_la1[52] = jj_gen;
        ;
      }
      iri = iri();
{if ("" != null) return Target.create(createNode(iri)) ;}
      break;
      }
    default:
      jj_la1[53] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node GraphRef() throws ParseException {String iri ;
    jj_consume_token(GRAPH);
    iri = iri();
{if ("" != null) return createNode(iri) ;}
    throw new Error("Missing return statement in function");
}

  final public Target GraphRefAll() throws ParseException {Node iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case GRAPH:{
      iri = GraphRef();
{if ("" != null) return Target.create(iri) ;}
      break;
      }
    case DFT:{
      jj_consume_token(DFT);
{if ("" != null) return Target.DEFAULT ;}
      break;
      }
    case NAMED:{
      jj_consume_token(NAMED);
{if ("" != null) return Target.NAMED ;}
      break;
      }
    case ALL:{
      jj_consume_token(ALL);
{if ("" != null) return Target.ALL ;}
      break;
      }
    default:
      jj_la1[54] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public void QuadPattern(QuadAcc acc) throws ParseException {
    jj_consume_token(LBRACE);
    Quads(acc);
    jj_consume_token(RBRACE);
}

//Ground data : As QuadPattern but don't allow variables.
  final public void QuadData(QuadDataAccSink acc) throws ParseException {
    jj_consume_token(LBRACE);
    Quads(acc);
    jj_consume_token(RBRACE);
}

  final public void Quads(QuadAccSink acc) throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case LPAREN:
    case NIL:
    case LBRACKET:
    case ANON:
    case L_TRIPLE:
    case LT2:{
      TriplesTemplate(acc);
      break;
      }
    default:
      jj_la1[55] = jj_gen;
      ;
    }
    label_13:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case GRAPH:{
        ;
        break;
        }
      default:
        jj_la1[56] = jj_gen;
        break label_13;
      }
      QuadsNotTriples(acc);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DOT:{
        jj_consume_token(DOT);
        break;
        }
      default:
        jj_la1[57] = jj_gen;
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        TriplesTemplate(acc);
        break;
        }
      default:
        jj_la1[58] = jj_gen;
        ;
      }
    }
}

  final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ;
    jj_consume_token(GRAPH);
    gn = VarOrIri();
setAccGraph(acc, gn) ;
    jj_consume_token(LBRACE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case LPAREN:
    case NIL:
    case LBRACKET:
    case ANON:
    case L_TRIPLE:
    case LT2:{
      TriplesTemplate(acc);
      break;
      }
    default:
      jj_la1[59] = jj_gen;
      ;
    }
    jj_consume_token(RBRACE);
setAccGraph(acc, prev) ;
}

  final public void TriplesTemplate(TripleCollector acc) throws ParseException {
    TriplesSameSubject(acc);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DOT:{
      jj_consume_token(DOT);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        TriplesTemplate(acc);
        break;
        }
      default:
        jj_la1[60] = jj_gen;
        ;
      }
      break;
      }
    default:
      jj_la1[61] = jj_gen;
      ;
    }
}

// ---- General Graph Pattern 
  final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ;
    t = jj_consume_token(LBRACE);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SELECT:{
startSubSelect(beginLine, beginColumn) ;
      SubSelect();
Query q = endSubSelect(beginLine, beginColumn) ;
      el = new ElementSubQuery(q) ;
      break;
      }
    default:
      jj_la1[62] = jj_gen;
      el = GroupGraphPatternSub();
    }
    jj_consume_token(RBRACE);
{if ("" != null) return el ;}
    throw new Error("Missing return statement in function");
}

  final public Element GroupGraphPatternSub() throws ParseException {Element el = null ;
ElementGroup elg = new ElementGroup() ;
startGroup(elg) ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case LPAREN:
    case NIL:
    case LBRACKET:
    case ANON:
    case L_TRIPLE:
    case LT2:{
startTriplesBlock() ;
      el = TriplesBlock(null);
endTriplesBlock() ;
      elg.addElement(el) ;
      break;
      }
    default:
      jj_la1[63] = jj_gen;
      ;
    }
    label_14:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case VALUES:
      case GRAPH:
      case OPTIONAL:
      case MINUS_P:
      case BIND:
      case SERVICE:
      case FILTER:
      case LBRACE:{
        ;
        break;
        }
      default:
        jj_la1[64] = jj_gen;
        break label_14;
      }
      el = GraphPatternNotTriples();
elg.addElement(el) ;
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DOT:{
        jj_consume_token(DOT);
        break;
        }
      default:
        jj_la1[65] = jj_gen;
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
startTriplesBlock() ;
        el = TriplesBlock(null);
endTriplesBlock() ;
        elg.addElement(el) ;
        break;
        }
      default:
        jj_la1[66] = jj_gen;
        ;
      }
    }
endGroup(elg) ;
{if ("" != null) return elg ;}
    throw new Error("Missing return statement in function");
}

  final public Element TriplesBlock(ElementPathBlock acc) throws ParseException {
if ( acc == null )
        acc = new ElementPathBlock() ;
    TriplesSameSubjectPath(acc);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DOT:{
      jj_consume_token(DOT);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        TriplesBlock(acc);
        break;
        }
      default:
        jj_la1[67] = jj_gen;
        ;
      }
      break;
      }
    default:
      jj_la1[68] = jj_gen;
      ;
    }
{if ("" != null) return acc ;}
    throw new Error("Missing return statement in function");
}

  final public Node ReifiedTripleBlock(TripleCollector acc) throws ParseException {Node reifId ;
    reifId = ReifiedTriple(acc);
    PropertyList(reifId, acc);
{if ("" != null) return reifId ;}
    throw new Error("Missing return statement in function");
}

  final public Node ReifiedTripleBlockPath(TripleCollector acc) throws ParseException {Node reifId ;
    reifId = ReifiedTriple(acc);
    PropertyListPath(reifId, acc);
{if ("" != null) return reifId ;}
    throw new Error("Missing return statement in function");
}

// -----
  final public Element GraphPatternNotTriples() throws ParseException {Element el = null ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LBRACE:{
      el = GroupOrUnionGraphPattern();
      break;
      }
    case OPTIONAL:{
      el = OptionalGraphPattern();
      break;
      }
    case MINUS_P:{
      el = MinusGraphPattern();
      break;
      }
    case GRAPH:{
      el = GraphGraphPattern();
      break;
      }
    case SERVICE:{
      el = ServiceGraphPattern();
      break;
      }
    case FILTER:{
      el = Filter();
      break;
      }
    case BIND:{
      el = Bind();
      break;
      }
    case VALUES:{
      el = InlineData();
      break;
      }
    default:
      jj_la1[69] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return el ;}
    throw new Error("Missing return statement in function");
}

// ---- Definitions of each pattern element
  final public Element OptionalGraphPattern() throws ParseException {Element el ;
    jj_consume_token(OPTIONAL);
    el = GroupGraphPattern();
{if ("" != null) return new ElementOptional(el) ;}
    throw new Error("Missing return statement in function");
}

  final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ;
    jj_consume_token(GRAPH);
    n = VarOrIri();
    el = GroupGraphPattern();
{if ("" != null) return new ElementNamedGraph(n, el) ;}
    throw new Error("Missing return statement in function");
}

  final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ;
    jj_consume_token(SERVICE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case SILENT:{
      jj_consume_token(SILENT);
silent=true;
      break;
      }
    default:
      jj_la1[70] = jj_gen;
      ;
    }
    n = VarOrIri();
    el = GroupGraphPattern();
{if ("" != null) return new ElementService(n, el, silent) ;}
    throw new Error("Missing return statement in function");
}

  final public Element Bind() throws ParseException {Var v ; Expr expr ;
    jj_consume_token(BIND);
    jj_consume_token(LPAREN);
    expr = Expression();
    jj_consume_token(AS);
    v = Var();
    jj_consume_token(RPAREN);
{if ("" != null) return new ElementBind(v, expr) ;}
    throw new Error("Missing return statement in function");
}

  final public Element InlineData() throws ParseException {ElementData el ; Token t ;
    t = jj_consume_token(VALUES);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
el = new ElementData() ;
    startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ;
    DataBlock();
finishInlineData(beginLine, beginColumn) ;
    {if ("" != null) return el ;}
    throw new Error("Missing return statement in function");
}

  final public void DataBlock() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      InlineDataOneVar();
      break;
      }
    case LPAREN:
    case NIL:{
      InlineDataFull();
      break;
      }
    default:
      jj_la1[71] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn;
    v = Var();
emitDataBlockVariable(v) ;
    t = jj_consume_token(LBRACE);
beginLine = t.beginLine; beginColumn = t.beginColumn; t = null;
    label_15:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case UNDEF:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case L_TRIPLE:{
        ;
        break;
        }
      default:
        jj_la1[72] = jj_gen;
        break label_15;
      }
      n = DataBlockValue();
startDataBlockValueRow(beginLine, beginColumn) ;
      emitDataBlockValue(n, beginLine, beginColumn) ;
      finishDataBlockValueRow(beginLine, beginColumn) ;
    }
    t = jj_consume_token(RBRACE);
}

  final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case NIL:{
      jj_consume_token(NIL);
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      label_16:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case VAR1:
        case VAR2:{
          ;
          break;
          }
        default:
          jj_la1[73] = jj_gen;
          break label_16;
        }
        v = Var();
emitDataBlockVariable(v) ;
      }
      jj_consume_token(RPAREN);
      break;
      }
    default:
      jj_la1[74] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(LBRACE);
    label_17:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case LPAREN:
      case NIL:{
        ;
        break;
        }
      default:
        jj_la1[75] = jj_gen;
        break label_17;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case LPAREN:{
        t = jj_consume_token(LPAREN);
beginLine = t.beginLine; beginColumn = t.beginColumn; t = null;
startDataBlockValueRow(beginLine, beginColumn) ;
        label_18:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case IRIref:
          case PNAME_NS:
          case PNAME_LN:
          case UNDEF:
          case TRUE:
          case FALSE:
          case INTEGER:
          case DECIMAL:
          case DOUBLE:
          case INTEGER_POSITIVE:
          case DECIMAL_POSITIVE:
          case DOUBLE_POSITIVE:
          case INTEGER_NEGATIVE:
          case DECIMAL_NEGATIVE:
          case DOUBLE_NEGATIVE:
          case STRING_LITERAL1:
          case STRING_LITERAL2:
          case STRING_LITERAL_LONG1:
          case STRING_LITERAL_LONG2:
          case L_TRIPLE:{
            ;
            break;
            }
          default:
            jj_la1[76] = jj_gen;
            break label_18;
          }
          n = DataBlockValue();
emitDataBlockValue(n, beginLine, beginColumn) ;
        }
        t = jj_consume_token(RPAREN);
beginLine = t.beginLine; beginColumn = t.beginColumn; t = null;
finishDataBlockValueRow(beginLine, beginColumn) ;
        break;
        }
      case NIL:{
        t = jj_consume_token(NIL);
beginLine = t.beginLine; beginColumn = t.beginColumn; t = null;
startDataBlockValueRow(beginLine, beginColumn) ;
finishDataBlockValueRow(beginLine, beginColumn) ;
        break;
        }
      default:
        jj_la1[77] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    jj_consume_token(RBRACE);
}

  final public Node DataBlockValue() throws ParseException {Node n ; String iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
{if ("" != null) return createNode(iri) ;}
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
{if ("" != null) return n ;}
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
{if ("" != null) return n ;}
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
{if ("" != null) return n ;}
      break;
      }
    case UNDEF:{
      jj_consume_token(UNDEF);
{if ("" != null) return null ;}
      break;
      }
    case L_TRIPLE:{
      n = TripleTermData();
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[78] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

// ---- Reifier, various cases.
// May return null.
  final public Node Reifier() throws ParseException {Token tok = null ; Node reifId = null ;
    tok = jj_consume_token(TILDE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case ANON:{
      reifId = VarOrReifierId();
      break;
      }
    default:
      jj_la1[79] = jj_gen;
      ;
    }
{if ("" != null) return reifId;}
    throw new Error("Missing return statement in function");
}

// // No variables.
// Node ReifierData() : { Token tok = null ; Node reifId = null ; }
// {
//     tok = <TILDE>
//     (reifId = ReifierId() )?
//     { return reifId; }
// }
// 
// Node ReifierId() : { Node n = null ; String iri ; } 
// {
//   // No variable
//   ( iri = iri()           { return createNode(iri) ; }
//   | n = BlankNode()       { return n ; }
//   )
// }
// 
// Node VarOrReifierId() : { Node n = null; }
// {
//    ( n = Var()        { return n; }
//    | n = ReifierId()  { return n; }
//    )
// }
  final public Node VarOrReifierId() throws ParseException {Node n = null; String iri = null;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      n = Var();
{if ("" != null) return n;}
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
{if ("" != null) return createNode(iri) ;}
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      n = BlankNode();
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[80] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Element MinusGraphPattern() throws ParseException {Element el ;
    jj_consume_token(MINUS_P);
    el = GroupGraphPattern();
{if ("" != null) return new ElementMinus(el) ;}
    throw new Error("Missing return statement in function");
}

// Element UnionGraphPattern() : { Element el ; }
// {
//     <UNION>
//     el = GroupGraphPattern()
//     { return new ElementUnion(el) ; }
// }
// SPARQL 1.0: {pattern} UNION {pattern} UNION {pattern} ... :: 
// SPARQL 1.1 may introduce: { pattern UNION pattern UNION ... }
// G (union G)* can be a single group pattern
// or a group pattern as part of an union.
  final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ;
    el = GroupGraphPattern();
    label_19:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case UNION:{
        ;
        break;
        }
      default:
        jj_la1[81] = jj_gen;
        break label_19;
      }
      jj_consume_token(UNION);
if ( el2 == null )
      {
        el2 = new ElementUnion() ;
        el2.addElement(el) ;
      }
      el = GroupGraphPattern();
el2.addElement(el) ;
    }
{if ("" != null) return (el2==null)? el : el2 ;}
    throw new Error("Missing return statement in function");
}

  final public Element Filter() throws ParseException {Expr c ;
    jj_consume_token(FILTER);
    c = Constraint();
{if ("" != null) return new ElementFilter(c) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr Constraint() throws ParseException {Expr c ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LPAREN:{
      c = BrackettedExpression();
      break;
      }
    case TRIPLE:
    case IS_TRIPLE:
    case SUBJECT:
    case PREDICATE:
    case OBJECT:
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:
    case BOUND:
    case COALESCE:
    case IF:
    case BNODE:
    case IRI:
    case URI:
    case STR:
    case STRLANG:
    case STRLANGDIR:
    case STRDT:
    case DTYPE:
    case LANG:
    case LANGMATCHES:
    case LANGDIR:
    case IS_URI:
    case IS_IRI:
    case IS_BLANK:
    case IS_LITERAL:
    case IS_NUMERIC:
    case HAS_LANG:
    case HAS_LANGDIR:
    case REGEX:
    case SAME_TERM:
    case RAND:
    case ABS:
    case CEIL:
    case FLOOR:
    case ROUND:
    case CONCAT:
    case SUBSTR:
    case STRLEN:
    case REPLACE:
    case UCASE:
    case LCASE:
    case ENCODE_FOR_URI:
    case CONTAINS:
    case STRSTARTS:
    case STRENDS:
    case STRBEFORE:
    case STRAFTER:
    case YEAR:
    case MONTH:
    case DAY:
    case HOURS:
    case MINUTES:
    case SECONDS:
    case TIMEZONE:
    case TZ:
    case NOW:
    case UUID:
    case STRUUID:
    case MD5:
    case SHA1:
    case SHA256:
    case SHA384:
    case SHA512:{
      c = BuiltInCall();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      c = FunctionCall();
      break;
      }
    default:
      jj_la1[82] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return c ;}
    throw new Error("Missing return statement in function");
}

  final public Expr FunctionCall() throws ParseException {String fname ; Args a ;
    fname = iri();
    a = ArgList();
if ( AggregateRegistry.isRegistered(fname) ) {
         // aggregates
         if ( ! getAllowAggregatesInExpressions() )
            throwParseException("Aggregate expression not legal at this point : "+fname, token.beginLine, token.beginColumn) ;
         Aggregator agg = AggregatorFactory.createCustom(fname, a) ;
         Expr exprAgg = getQuery().allocAggregate(agg) ;
         {if ("" != null) return exprAgg ;}
     }
     {if ("" != null) return new E_Function(fname, a) ;}
    throw new Error("Missing return statement in function");
}

  final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case NIL:{
      jj_consume_token(NIL);
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        t = jj_consume_token(DISTINCT);
args.distinct = true ;
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
if ( ! getAllowAggregatesInExpressions() )
              throwParseException("Aggregate expression not legal at this point",
                                 beginLine, beginColumn) ;
        break;
        }
      default:
        jj_la1[83] = jj_gen;
        ;
      }
      expr = Expression();
args.add(expr) ;
      label_20:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case COMMA:{
          ;
          break;
          }
        default:
          jj_la1[84] = jj_gen;
          break label_20;
        }
        jj_consume_token(COMMA);
        expr = Expression();
args.add(expr) ;
      }
      jj_consume_token(RPAREN);
      break;
      }
    default:
      jj_la1[85] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return args ;}
    throw new Error("Missing return statement in function");
}

  final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case NIL:{
      jj_consume_token(NIL);
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      expr = Expression();
exprList.add(expr) ;
      label_21:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case COMMA:{
          ;
          break;
          }
        default:
          jj_la1[86] = jj_gen;
          break label_21;
        }
        jj_consume_token(COMMA);
        expr = Expression();
exprList.add(expr) ;
      }
      jj_consume_token(RPAREN);
      break;
      }
    default:
      jj_la1[87] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return exprList ;}
    throw new Error("Missing return statement in function");
}

// -------- Construct patterns
  final public Template ConstructTemplate() throws ParseException {TripleCollectorBGP acc = new TripleCollectorBGP();
                                 Template t = new Template(acc.getBGP()) ;
setInConstructTemplate(true) ;
    jj_consume_token(LBRACE);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case LPAREN:
    case NIL:
    case LBRACKET:
    case ANON:
    case L_TRIPLE:
    case LT2:{
      ConstructTriples(acc);
      break;
      }
    default:
      jj_la1[88] = jj_gen;
      ;
    }
    jj_consume_token(RBRACE);
setInConstructTemplate(false) ;
      {if ("" != null) return t ;}
    throw new Error("Missing return statement in function");
}

  final public void ConstructTriples(TripleCollector acc) throws ParseException {
    TriplesSameSubject(acc);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case DOT:{
      jj_consume_token(DOT);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        ConstructTriples(acc);
        break;
        }
      default:
        jj_la1[89] = jj_gen;
        ;
      }
      break;
      }
    default:
      jj_la1[90] = jj_gen;
      ;
    }
}

// -------- Triple lists with property and object lists
// -------- Without paths: entry: TriplesSameSubject
  final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case NIL:
    case ANON:
    case L_TRIPLE:{
      s = VarOrTerm();
      PropertyListNotEmpty(s, acc);
      break;
      }
    case LPAREN:
    case LBRACKET:{
ElementPathBlock tempAcc = new ElementPathBlock() ;
      s = TriplesNode(tempAcc);
      PropertyList(s, tempAcc);
insert(acc, tempAcc) ;
      break;
      }
    case LT2:{
      ReifiedTripleBlock(acc);
      break;
      }
    default:
      jj_la1[91] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void PropertyList(Node s, TripleCollector acc) throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:
    case KW_A:{
      PropertyListNotEmpty(s, acc);
      break;
      }
    default:
      jj_la1[92] = jj_gen;
      ;
    }
}

  final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ;
    p = Verb();
    ObjectList(s, p, acc);
    label_22:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SEMICOLON:{
        ;
        break;
        }
      default:
        jj_la1[93] = jj_gen;
        break label_22;
      }
      jj_consume_token(SEMICOLON);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case VAR1:
      case VAR2:
      case KW_A:{
        /* TriG template: LOOKAHEAD(2) */
               p = Verb();
        ObjectList(s, p, acc);
        break;
        }
      default:
        jj_la1[94] = jj_gen;
        ;
      }
    }
}

  final public Node Verb() throws ParseException {Node p ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:{
      p = VarOrIri();
      break;
      }
    case KW_A:{
      jj_consume_token(KW_A);
p = nRDFtype ;
      break;
      }
    default:
      jj_la1[95] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

  final public void ObjectList(Node s, Node p, TripleCollector acc) throws ParseException {Node o ;
    Object(s, p, acc);
    label_23:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case COMMA:{
        ;
        break;
        }
      default:
        jj_la1[96] = jj_gen;
        break label_23;
      }
      jj_consume_token(COMMA);
      Object(s, p, acc);
    }
}

  final public void Object(Node s, Node p, TripleCollector acc) throws ParseException {Node o ;
ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
    o = GraphNode(tempAcc);
insert(tempAcc, mark, s, p, o) ; insert(acc, tempAcc) ;
    Annotation(acc, s, p, o);
}

// -------- BGPs with paths.
// -------- Entry point: TriplesSameSubjectPath
  final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case NIL:
    case ANON:
    case L_TRIPLE:{
      s = VarOrTerm();
      PropertyListPathNotEmpty(s, acc);
      break;
      }
    case LPAREN:
    case LBRACKET:{
ElementPathBlock tempAcc = new ElementPathBlock() ;
      s = TriplesNodePath(tempAcc);
      PropertyListPath(s, tempAcc);
insert(acc, tempAcc) ;
      break;
      }
    case LT2:{
      ReifiedTripleBlockPath(acc);
      break;
      }
    default:
      jj_la1[97] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
}

  final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:
    case KW_A:
    case LPAREN:
    case BANG:
    case CARAT:{
      PropertyListPathNotEmpty(s, acc);
      break;
      }
    default:
      jj_la1[98] = jj_gen;
      ;
    }
}

  final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case KW_A:
    case LPAREN:
    case BANG:
    case CARAT:{
      path = VerbPath();
      break;
      }
    case VAR1:
    case VAR2:{
      p = VerbSimple();
      break;
      }
    default:
      jj_la1[99] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    ObjectListPath(s, p, path, acc);
    label_24:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SEMICOLON:{
        ;
        break;
        }
      default:
        jj_la1[100] = jj_gen;
        break label_24;
      }
      jj_consume_token(SEMICOLON);
path = null ; p = null ;
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case VAR1:
      case VAR2:
      case KW_A:
      case LPAREN:
      case BANG:
      case CARAT:{
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case IRIref:
        case PNAME_NS:
        case PNAME_LN:
        case KW_A:
        case LPAREN:
        case BANG:
        case CARAT:{
          path = VerbPath();
          break;
          }
        case VAR1:
        case VAR2:{
          p = VerbSimple();
          break;
          }
        default:
          jj_la1[101] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        ObjectListPath(s, p, path, acc);
        break;
        }
      default:
        jj_la1[102] = jj_gen;
        ;
      }
    }
}

  final public Path VerbPath() throws ParseException {Node p ; Path path ;
    path = Path();
{if ("" != null) return path ;}
    throw new Error("Missing return statement in function");
}

  final public Node VerbSimple() throws ParseException {Node p ;
    // "a" now allowed in paths.
      //( p = Var() | <KW_A> { p = nRDFtype ; } )
      p = Var();
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

  final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ;
    ObjectPath(s, p, path, acc);
    label_25:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case COMMA:{
        ;
        break;
        }
      default:
        jj_la1[103] = jj_gen;
        break label_25;
      }
      jj_consume_token(COMMA);
      ObjectPath(s, p, path, acc);
    }
}

  final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ;
ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
    o = GraphNodePath(tempAcc);
insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ;
    AnnotationPath(acc, s, p, path, o);
}

// End paths stuff.
// -------- Paths
// Weakest outermost
  final public Path Path() throws ParseException {Path p ;
    p = PathAlternative();
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

  final public Path PathAlternative() throws ParseException {Path p1 , p2 ;
    p1 = PathSequence();
    label_26:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case VBAR:{
        ;
        break;
        }
      default:
        jj_la1[104] = jj_gen;
        break label_26;
      }
      jj_consume_token(VBAR);
      p2 = PathSequence();
p1 = PathFactory.pathAlt(p1, p2) ;
    }
{if ("" != null) return p1 ;}
    throw new Error("Missing return statement in function");
}

  final public Path PathSequence() throws ParseException {Path p1 , p2 ;
    p1 = PathEltOrInverse();
    label_27:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SLASH:{
        ;
        break;
        }
      default:
        jj_la1[105] = jj_gen;
        break label_27;
      }
      jj_consume_token(SLASH);
      p2 = PathEltOrInverse();
p1 = PathFactory.pathSeq(p1, p2) ;
    }
{if ("" != null) return p1;}
    throw new Error("Missing return statement in function");
}

// Path unit element, no inverse
  final public Path PathElt() throws ParseException {String str ; Node n ; Path p ;
    p = PathPrimary();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case PLUS:
    case STAR:
    case QMARK:{
      p = PathMod(p);
      break;
      }
    default:
      jj_la1[106] = jj_gen;
      ;
    }
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

// Path unit element, including inverse.
  final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case KW_A:
    case LPAREN:
    case BANG:{
      p = PathElt();
      break;
      }
    case CARAT:{
      jj_consume_token(CARAT);
      p = PathElt();
p = PathFactory.pathInverse(p) ;
      break;
      }
    default:
      jj_la1[107] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

  final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case QMARK:{
      jj_consume_token(QMARK);
{if ("" != null) return PathFactory.pathZeroOrOne(p) ;}
      break;
      }
    case STAR:{
      jj_consume_token(STAR);
{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;}
      break;
      }
    case PLUS:{
      jj_consume_token(PLUS);
{if ("" != null) return PathFactory.pathOneOrMore1(p) ;}
      break;
      }
    default:
      jj_la1[108] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      str = iri();
n = createNode(str) ; p = PathFactory.pathLink(n) ;
      break;
      }
    case KW_A:{
      jj_consume_token(KW_A);
p = PathFactory.pathLink(nRDFtype) ;
      break;
      }
    case BANG:{
      jj_consume_token(BANG);
      p = PathNegatedPropertySet();
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      p = Path();
      jj_consume_token(RPAREN);
      break;
      }
    default:
      jj_la1[109] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return p ;}
    throw new Error("Missing return statement in function");
}

  final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ;
pNegSet = new P_NegPropSet() ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case KW_A:
    case CARAT:{
      p = PathOneInPropertySet();
pNegSet.add(p) ;
      break;
      }
    case LPAREN:{
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case KW_A:
      case CARAT:{
        p = PathOneInPropertySet();
pNegSet.add(p) ;
        label_28:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case VBAR:{
            ;
            break;
            }
          default:
            jj_la1[110] = jj_gen;
            break label_28;
          }
          jj_consume_token(VBAR);
          p = PathOneInPropertySet();
pNegSet.add(p) ;
        }
        break;
        }
      default:
        jj_la1[111] = jj_gen;
        ;
      }
      jj_consume_token(RPAREN);
      break;
      }
    default:
      jj_la1[112] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return pNegSet ;}
    throw new Error("Missing return statement in function");
}

  final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      str = iri();
n = createNode(str) ; {if ("" != null) return new P_Link(n) ;}
      break;
      }
    case KW_A:{
      jj_consume_token(KW_A);
{if ("" != null) return new P_Link(nRDFtype) ;}
      break;
      }
    case CARAT:{
      jj_consume_token(CARAT);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:{
        str = iri();
n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;}
        break;
        }
      case KW_A:{
        jj_consume_token(KW_A);
{if ("" != null) return new P_ReverseLink(nRDFtype) ;}
        break;
        }
      default:
        jj_la1[113] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    default:
      jj_la1[114] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

// -------- Triple expansions
// Anything that can stand in a node slot and which is
// a number of triples
  final public Node TriplesNode(TripleCollector acc) throws ParseException {Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LPAREN:{
      n = Collection(acc);
{if ("" != null) return n ;}
      break;
      }
    case LBRACKET:{
      n = BlankNodePropertyList(acc);
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[115] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ;
    t = jj_consume_token(LBRACKET);
Node n = createBNode( t.beginLine, t.beginColumn) ;
    PropertyListNotEmpty(n, acc);
    jj_consume_token(RBRACKET);
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

  final public Node TriplesNodePath(TripleCollector acc) throws ParseException {Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LPAREN:{
      n = CollectionPath(acc);
{if ("" != null) return n ;}
      break;
      }
    case LBRACKET:{
      n = BlankNodePropertyListPath(acc);
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[116] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ;
    t = jj_consume_token(LBRACKET);
Node n = createBNode( t.beginLine, t.beginColumn) ;
    PropertyListPathNotEmpty(n, acc);
    jj_consume_token(RBRACKET);
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

// ------- RDF collections
  final public Node Collection(TripleCollector acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
    t = jj_consume_token(LPAREN);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
    label_29:
    while (true) {
Node cell = createListNode( beginLine, beginColumn) ;
      if ( listHead == nRDFnil )
         listHead = cell ;
      if ( lastCell != null )
        insert(acc, lastCell, nRDFrest, cell) ;
      mark = acc.mark() ;
      n = GraphNode(acc);
insert(acc, mark, cell, nRDFfirst, n) ;
      lastCell = cell ;
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        ;
        break;
        }
      default:
        jj_la1[117] = jj_gen;
        break label_29;
      }
    }
    jj_consume_token(RPAREN);
if ( lastCell != null )
       insert(acc, lastCell, nRDFrest, nRDFnil) ;
     {if ("" != null) return listHead ;}
    throw new Error("Missing return statement in function");
}

  final public Node CollectionPath(TripleCollector acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
    t = jj_consume_token(LPAREN);
int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
    label_30:
    while (true) {
Node cell = createListNode( beginLine, beginColumn) ;
      if ( listHead == nRDFnil )
         listHead = cell ;
      if ( lastCell != null )
        insert(acc, lastCell, nRDFrest, cell) ;
      mark = acc.mark() ;
      n = GraphNodePath(acc);
insert(acc, mark, cell, nRDFfirst, n) ;
      lastCell = cell ;
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case BLANK_NODE_LABEL:
      case VAR1:
      case VAR2:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case NIL:
      case LBRACKET:
      case ANON:
      case L_TRIPLE:
      case LT2:{
        ;
        break;
        }
      default:
        jj_la1[118] = jj_gen;
        break label_30;
      }
    }
    jj_consume_token(RPAREN);
if ( lastCell != null )
       insert(acc, lastCell, nRDFrest, nRDFnil) ;
     {if ("" != null) return listHead ;}
    throw new Error("Missing return statement in function");
}

// ---- RDF-star Annotation Syntax
// Allow paths. Query graph patterns.
  final public void AnnotationPath(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException {Node reifId = null ;
    label_31:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case L_ANN:
      case TILDE:{
        ;
        break;
        }
      default:
        jj_la1[119] = jj_gen;
        break label_31;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case TILDE:{
p = preConditionReifier(s, p, path, o, token.beginLine, token.beginColumn);
        reifId = Reifier();
reifId = insertTripleReifier(acc, reifId, s, p, o, token.beginLine, token.beginColumn) ;
setReifierId(reifId);
        break;
        }
      case L_ANN:{
p = preConditionReifier(s, p, path, o, token.beginLine, token.beginColumn);
      reifId = getOrAllocReifierId(acc, s, p, o, token.beginLine, token.beginColumn);
clearReifierId();
        AnnotationBlockPath(acc, reifId);
        break;
        }
      default:
        jj_la1[120] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
clearReifierId();
}

  final public void AnnotationBlockPath(TripleCollector acc, Node reifId) throws ParseException {
    jj_consume_token(L_ANN);
    PropertyListPathNotEmpty(reifId, acc);
    jj_consume_token(R_ANN);
}

// ---- RDF-star Annotation Syntax
// No paths. Construct templates.
  final public void Annotation(TripleCollector acc, Node s, Node p, Node o) throws ParseException {Node reifId = null ;
    label_32:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case L_ANN:
      case TILDE:{
        ;
        break;
        }
      default:
        jj_la1[121] = jj_gen;
        break label_32;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case TILDE:{
p = preConditionReifier(s, p,null, o, token.beginLine, token.beginColumn);
        reifId = Reifier();
reifId = insertTripleReifier(acc, reifId, s, p, o, token.beginLine, token.beginColumn) ;
setReifierId(reifId);
        break;
        }
      case L_ANN:{
p = preConditionReifier(s, p, null, o, token.beginLine, token.beginColumn);
      reifId = getOrAllocReifierId(acc, s, p, o, token.beginLine, token.beginColumn);
clearReifierId();
        AnnotationBlock(acc, reifId);
        break;
        }
      default:
        jj_la1[122] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
}

  final public void AnnotationBlock(TripleCollector acc, Node reifId) throws ParseException {
    jj_consume_token(L_ANN);
    PropertyListNotEmpty(reifId, acc);
    jj_consume_token(R_ANN);
}

// -------- Nodes in a graph pattern or template
// Object position RDF term, element of a list
// No paths in TriplesNode
  final public Node GraphNode(TripleCollector acc) throws ParseException {Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case NIL:
    case ANON:
    case L_TRIPLE:{
      n = VarOrTerm();
{if ("" != null) return n ;}
      break;
      }
    case LPAREN:
    case LBRACKET:{
      n = TriplesNode(acc);
{if ("" != null) return n ;}
      break;
      }
    case LT2:{
      n = ReifiedTriple(acc);
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[123] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

// Object position RDF term. NEW-SYNTAX Rename?
  final public Node GraphNodePath(TripleCollector acc) throws ParseException {Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case BLANK_NODE_LABEL:
    case VAR1:
    case VAR2:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case NIL:
    case ANON:
    case L_TRIPLE:{
      n = VarOrTerm();
{if ("" != null) return n ;}
      break;
      }
    case LPAREN:
    case LBRACKET:{
      n = TriplesNodePath(acc);
{if ("" != null) return n ;}
      break;
      }
    case LT2:{
      n = ReifiedTriple(acc);
{if ("" != null) return n ;}
      break;
      }
    default:
      jj_la1[124] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node VarOrTerm() throws ParseException {Node n = null ; String iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
{if ("" != null) return createNode(iri) ;}
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      n = BlankNode();
      break;
      }
    case NIL:{
      jj_consume_token(NIL);
{if ("" != null) return nRDFnil ;}
      break;
      }
    case L_TRIPLE:{
      n = TripleTerm();
{if ("" != null) return n;}
      break;
      }
    default:
      jj_la1[125] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node ReifiedTriple(TripleCollector acc) throws ParseException {Node reifId = null ; Token tok ; Node s; Node p ; Node o ;
    tok = jj_consume_token(LT2);
    s = ReifiedTripleSubject(acc);
    p = Verb();
    o = ReifiedTripleObject(acc);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case TILDE:{
      reifId = Reifier();
      break;
      }
    default:
      jj_la1[126] = jj_gen;
      ;
    }
reifId = insertTripleReifier(acc, reifId, s, p, o, tok.beginLine, tok.beginColumn) ;
    jj_consume_token(GT2);
{if ("" != null) return reifId;}
    throw new Error("Missing return statement in function");
}

  final public Node ReifiedTripleSubject(TripleCollector acc) throws ParseException {Node s; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      s = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
s = createNode(iri) ;
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      s = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      s = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      s = BooleanLiteral();
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      s = BlankNode();
      break;
      }
    case LT2:{
      s = ReifiedTriple(acc);
      break;
      }
    case L_TRIPLE:{
      s = TripleTerm();
      break;
      }
    default:
      jj_la1[127] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return s;}
    throw new Error("Missing return statement in function");
}

  final public Node ReifiedTripleObject(TripleCollector acc) throws ParseException {Node o; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      o = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
o = createNode(iri) ;
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      o = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      o = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      o = BooleanLiteral();
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      o = BlankNode();
      break;
      }
    case LT2:{
      o = ReifiedTriple(acc);
      break;
      }
    case L_TRIPLE:{
      o = TripleTerm();
      break;
      }
    default:
      jj_la1[128] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return o;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTerm() throws ParseException {Node n = null ; Token openToken ; String iri ; Node s , p , o ;
    openToken = jj_consume_token(L_TRIPLE);
    // @@ Alt name. ttSubject()?
        s = TripleTermSubject();
    p = Verb();
    o = TripleTermObject();
n = createTripleTerm(s, p, o, openToken.beginLine, openToken.beginColumn);
    jj_consume_token(R_TRIPLE);
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTermSubject() throws ParseException {Node n; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri) ;
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      n = BlankNode();
      break;
      }
    case L_TRIPLE:{
      n = TripleTerm();
{if ("" != null) return n;}
      break;
      }
    default:
      jj_la1[129] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTermObject() throws ParseException {Node n; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri) ;
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
      break;
      }
    case BLANK_NODE_LABEL:
    case ANON:{
      n = BlankNode();
      break;
      }
    case L_TRIPLE:{
      n = TripleTerm();
{if ("" != null) return n;}
      break;
      }
    default:
      jj_la1[130] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTermData() throws ParseException {Node n = null ; Token openToken ; String iri ; Node s , p , o ;
    openToken = jj_consume_token(L_TRIPLE);
    // @@ Alt name? ttDataValueTerm
        s = TripleTermDataSubject();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
p = createNode(iri) ;
      break;
      }
    case KW_A:{
      jj_consume_token(KW_A);
p = nRDFtype ;
      break;
      }
    default:
      jj_la1[131] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    o = TripleTermDataObject();
n = createTripleTerm(s, p, o, openToken.beginLine, openToken.beginColumn);
    jj_consume_token(R_TRIPLE);
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTermDataSubject() throws ParseException {Node n = null; String iri;
    iri = iri();
n = createNode(iri) ;
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node TripleTermDataObject() throws ParseException {Node n = null; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri) ;
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
      break;
      }
    case L_TRIPLE:{
      n = TripleTermData();
      break;
      }
    default:
      jj_la1[132] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

// // VarOrTerm except no var, no bnodes
// // @@ Rename?
// Node DataValueTerm() : {  Node n = null ; String iri ; Node s , p , o ; }
// {
//   iri = iri()            { return createNode(iri) ; }
// | n = RDFLiteral()       { return n ; }
// | n = NumericLiteral()   { return n ; }
// | n = BooleanLiteral()   { return n ; }
// | n = TripleTermData()   { return n; }
// }
// e.g. Property (if no bNodes) + DESCRIBE
  final public Node VarOrIri() throws ParseException {Node n = null ; String iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri) ;
      break;
      }
    default:
      jj_la1[133] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

// e.g. INSERT DATA { GRAPH ... }
  final public Var Var() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case VAR1:{
      t = jj_consume_token(VAR1);
      break;
      }
    case VAR2:{
      t = jj_consume_token(VAR2);
      break;
      }
    default:
      jj_la1[134] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;}
    throw new Error("Missing return statement in function");
}

// -------- Constraint syntax
  final public Expr Expression() throws ParseException {Expr expr ;
    expr = ConditionalOrExpression();
{if ("" != null) return expr ;}
    throw new Error("Missing return statement in function");
}

  final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ;
    expr1 = ConditionalAndExpression();
    label_33:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SC_OR:{
        ;
        break;
        }
      default:
        jj_la1[135] = jj_gen;
        break label_33;
      }
      jj_consume_token(SC_OR);
      expr2 = ConditionalAndExpression();
expr1 = new E_LogicalOr(expr1, expr2) ;
    }
{if ("" != null) return expr1 ;}
    throw new Error("Missing return statement in function");
}

  final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ;
    expr1 = ValueLogical();
    label_34:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SC_AND:{
        ;
        break;
        }
      default:
        jj_la1[136] = jj_gen;
        break label_34;
      }
      jj_consume_token(SC_AND);
      expr2 = ValueLogical();
expr1 = new E_LogicalAnd(expr1, expr2) ;
    }
{if ("" != null) return expr1 ;}
    throw new Error("Missing return statement in function");
}

  final public Expr ValueLogical() throws ParseException {Expr expr ;
    expr = RelationalExpression();
{if ("" != null) return expr ;}
    throw new Error("Missing return statement in function");
}

  final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ;
    expr1 = NumericExpression();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case NOT:
    case IN:
    case EQ:
    case NE:
    case GT:
    case LT:
    case LE:
    case GE:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case EQ:{
        jj_consume_token(EQ);
        expr2 = NumericExpression();
expr1 = new E_Equals(expr1, expr2) ;
        break;
        }
      case NE:{
        jj_consume_token(NE);
        expr2 = NumericExpression();
expr1 = new E_NotEquals(expr1, expr2) ;
        break;
        }
      case LT:{
        jj_consume_token(LT);
        expr2 = NumericExpression();
expr1 = new E_LessThan(expr1, expr2) ;
        break;
        }
      case GT:{
        jj_consume_token(GT);
        expr2 = NumericExpression();
expr1 = new E_GreaterThan(expr1, expr2) ;
        break;
        }
      case LE:{
        jj_consume_token(LE);
        expr2 = NumericExpression();
expr1 = new E_LessThanOrEqual(expr1, expr2) ;
        break;
        }
      case GE:{
        jj_consume_token(GE);
        expr2 = NumericExpression();
expr1 = new E_GreaterThanOrEqual(expr1, expr2) ;
        break;
        }
      case IN:{
        jj_consume_token(IN);
        a = ExpressionList();
expr1 = new E_OneOf(expr1, a) ;
        break;
        }
      case NOT:{
        jj_consume_token(NOT);
        jj_consume_token(IN);
        a = ExpressionList();
expr1 = new E_NotOneOf(expr1, a) ;
        break;
        }
      default:
        jj_la1[137] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    default:
      jj_la1[138] = jj_gen;
      ;
    }
{if ("" != null) return expr1 ;}
    throw new Error("Missing return statement in function");
}

  final public Expr NumericExpression() throws ParseException {Expr expr ;
    expr = AdditiveExpression();
{if ("" != null) return expr ;}
    throw new Error("Missing return statement in function");
}

  final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ;
    expr1 = MultiplicativeExpression();
    label_35:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case PLUS:
      case MINUS:{
        ;
        break;
        }
      default:
        jj_la1[139] = jj_gen;
        break label_35;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case PLUS:{
        jj_consume_token(PLUS);
        expr2 = MultiplicativeExpression();
expr1 = new E_Add(expr1, expr2) ;
        break;
        }
      case MINUS:{
        jj_consume_token(MINUS);
        expr2 = MultiplicativeExpression();
expr1 = new E_Subtract(expr1, expr2) ;
        break;
        }
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:{
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case INTEGER_POSITIVE:
        case DECIMAL_POSITIVE:
        case DOUBLE_POSITIVE:{
          n = NumericLiteralPositive();
n = stripSign(n) ;
         expr2 = asExpr(n) ;
         addition = true ;
          break;
          }
        case INTEGER_NEGATIVE:
        case DECIMAL_NEGATIVE:
        case DOUBLE_NEGATIVE:{
          n = NumericLiteralNegative();
n = stripSign(n) ;
         expr2 = asExpr(n) ;
         addition = false ;
          break;
          }
        default:
          jj_la1[140] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        label_36:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case STAR:
          case SLASH:{
            ;
            break;
            }
          default:
            jj_la1[141] = jj_gen;
            break label_36;
          }
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case STAR:{
            jj_consume_token(STAR);
            expr3 = UnaryExpression();
expr2 = new E_Multiply(expr2, expr3) ;
            break;
            }
          case SLASH:{
            jj_consume_token(SLASH);
            expr3 = UnaryExpression();
expr2 = new E_Divide(expr2, expr3) ;
            break;
            }
          default:
            jj_la1[142] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
          }
        }
if ( addition )
         expr1 = new E_Add(expr1, expr2) ;
      else
         expr1 = new E_Subtract(expr1, expr2) ;
        break;
        }
      default:
        jj_la1[143] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
{if ("" != null) return expr1 ;}
    throw new Error("Missing return statement in function");
}

  final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ;
    expr1 = UnaryExpression();
    label_37:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case STAR:
      case SLASH:{
        ;
        break;
        }
      default:
        jj_la1[144] = jj_gen;
        break label_37;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case STAR:{
        jj_consume_token(STAR);
        expr2 = UnaryExpression();
expr1 = new E_Multiply(expr1, expr2) ;
        break;
        }
      case SLASH:{
        jj_consume_token(SLASH);
        expr2 = UnaryExpression();
expr1 = new E_Divide(expr1, expr2) ;
        break;
        }
      default:
        jj_la1[145] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
{if ("" != null) return expr1 ;}
    throw new Error("Missing return statement in function");
}

  final public Expr UnaryExpression() throws ParseException {Expr expr ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case BANG:{
      jj_consume_token(BANG);
      expr = UnaryExpression();
{if ("" != null) return new E_LogicalNot(expr) ;}
      break;
      }
    case PLUS:{
      jj_consume_token(PLUS);
      expr = PrimaryExpression();
{if ("" != null) return new E_UnaryPlus(expr) ;}
      break;
      }
    case MINUS:{
      jj_consume_token(MINUS);
      expr = PrimaryExpression();
{if ("" != null) return new E_UnaryMinus(expr) ;}
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:
    case VAR1:
    case VAR2:
    case TRIPLE:
    case IS_TRIPLE:
    case SUBJECT:
    case PREDICATE:
    case OBJECT:
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:
    case BOUND:
    case COALESCE:
    case IF:
    case BNODE:
    case IRI:
    case URI:
    case STR:
    case STRLANG:
    case STRLANGDIR:
    case STRDT:
    case DTYPE:
    case LANG:
    case LANGMATCHES:
    case LANGDIR:
    case IS_URI:
    case IS_IRI:
    case IS_BLANK:
    case IS_LITERAL:
    case IS_NUMERIC:
    case HAS_LANG:
    case HAS_LANGDIR:
    case REGEX:
    case SAME_TERM:
    case RAND:
    case ABS:
    case CEIL:
    case FLOOR:
    case ROUND:
    case CONCAT:
    case SUBSTR:
    case STRLEN:
    case REPLACE:
    case UCASE:
    case LCASE:
    case ENCODE_FOR_URI:
    case CONTAINS:
    case STRSTARTS:
    case STRENDS:
    case STRBEFORE:
    case STRAFTER:
    case YEAR:
    case MONTH:
    case DAY:
    case HOURS:
    case MINUTES:
    case SECONDS:
    case TIMEZONE:
    case TZ:
    case NOW:
    case UUID:
    case STRUUID:
    case MD5:
    case SHA1:
    case SHA256:
    case SHA384:
    case SHA512:
    case TRUE:
    case FALSE:
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:
    case LPAREN:
    case L_TRIPLE:{
      expr = PrimaryExpression();
{if ("" != null) return expr ;}
      break;
      }
    default:
      jj_la1[146] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LPAREN:{
      expr = BrackettedExpression();
{if ("" != null) return expr ;}
      break;
      }
    case TRIPLE:
    case IS_TRIPLE:
    case SUBJECT:
    case PREDICATE:
    case OBJECT:
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:
    case BOUND:
    case COALESCE:
    case IF:
    case BNODE:
    case IRI:
    case URI:
    case STR:
    case STRLANG:
    case STRLANGDIR:
    case STRDT:
    case DTYPE:
    case LANG:
    case LANGMATCHES:
    case LANGDIR:
    case IS_URI:
    case IS_IRI:
    case IS_BLANK:
    case IS_LITERAL:
    case IS_NUMERIC:
    case HAS_LANG:
    case HAS_LANGDIR:
    case REGEX:
    case SAME_TERM:
    case RAND:
    case ABS:
    case CEIL:
    case FLOOR:
    case ROUND:
    case CONCAT:
    case SUBSTR:
    case STRLEN:
    case REPLACE:
    case UCASE:
    case LCASE:
    case ENCODE_FOR_URI:
    case CONTAINS:
    case STRSTARTS:
    case STRENDS:
    case STRBEFORE:
    case STRAFTER:
    case YEAR:
    case MONTH:
    case DAY:
    case HOURS:
    case MINUTES:
    case SECONDS:
    case TIMEZONE:
    case TZ:
    case NOW:
    case UUID:
    case STRUUID:
    case MD5:
    case SHA1:
    case SHA256:
    case SHA384:
    case SHA512:{
      expr = BuiltInCall();
{if ("" != null) return expr ;}
      break;
      }
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      expr = iriOrFunction();
{if ("" != null) return expr ;}
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
{if ("" != null) return asExpr(n) ;}
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
{if ("" != null) return asExpr(n) ;}
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
{if ("" != null) return asExpr(n) ;}
      break;
      }
    case VAR1:
    case VAR2:{
      n = Var();
{if ("" != null) return asExpr(n) ;}
      break;
      }
    case L_TRIPLE:{
      n = ExprTripleTerm();
{if ("" != null) return asExpr(n) ;}
      break;
      }
    default:
      jj_la1[147] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

// Node ExprVarOrTerm() : { Node n; String s;}
// {
//   ( s = iri() { n = createNode(s); }
//   | n = RDFLiteral()
//   | n = NumericLiteral()
//   | n = BooleanLiteral()
//   | n = Var()
//   | n = ExprTripleTerm()
//   )
//   { return n; }
// }
  final public Node ExprTripleTerm() throws ParseException {Token t ; Node s,p,o,n;
    t = jj_consume_token(L_TRIPLE);
    s = ExprTripleTermSubject();
    p = Verb();
    o = ExprTripleTermObject();
n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn);
    jj_consume_token(R_TRIPLE);
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node ExprTripleTermSubject() throws ParseException {Node n; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri);
      break;
      }
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    default:
      jj_la1[148] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Node ExprTripleTermObject() throws ParseException {Node n; String iri;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:
    case PNAME_NS:
    case PNAME_LN:{
      iri = iri();
n = createNode(iri);
      break;
      }
    case STRING_LITERAL1:
    case STRING_LITERAL2:
    case STRING_LITERAL_LONG1:
    case STRING_LITERAL_LONG2:{
      n = RDFLiteral();
      break;
      }
    case INTEGER:
    case DECIMAL:
    case DOUBLE:
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteral();
      break;
      }
    case TRUE:
    case FALSE:{
      n = BooleanLiteral();
      break;
      }
    case VAR1:
    case VAR2:{
      n = Var();
      break;
      }
    case L_TRIPLE:{
      n = ExprTripleTerm();
      break;
      }
    default:
      jj_la1[149] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n;}
    throw new Error("Missing return statement in function");
}

  final public Expr BrackettedExpression() throws ParseException {Expr expr ;
    jj_consume_token(LPAREN);
    expr = Expression();
    jj_consume_token(RPAREN);
{if ("" != null) return expr ;}
    throw new Error("Missing return statement in function");
}

  final public Expr BuiltInCall() throws ParseException {Expr expr ;
                       Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ;
                       Node gn ; ExprList a ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case COUNT:
    case MIN:
    case MAX:
    case SUM:
    case AVG:
    case SAMPLE:
    case GROUP_CONCAT:{
      expr = Aggregate();
{if ("" != null) return expr ;}
      break;
      }
    case STR:{
      jj_consume_token(STR);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_Str(expr) ;}
      break;
      }
    case LANG:{
      jj_consume_token(LANG);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_Lang(expr) ;}
      break;
      }
    case LANGMATCHES:{
      jj_consume_token(LANGMATCHES);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_LangMatches(expr1, expr2) ;}
      break;
      }
    case LANGDIR:{
      jj_consume_token(LANGDIR);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_LangDir(expr) ;}
      break;
      }
    case DTYPE:{
      jj_consume_token(DTYPE);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_Datatype(expr) ;}
      break;
      }
    case BOUND:{
      jj_consume_token(BOUND);
      jj_consume_token(LPAREN);
      gn = Var();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_Bound(new ExprVar(gn)) ;}
      break;
      }
    case IRI:{
      jj_consume_token(IRI);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return makeFunction_IRI(expr) ;}
      break;
      }
    case URI:{
      jj_consume_token(URI);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return makeFunction_URI(expr) ;}
      break;
      }
    case BNODE:{
      jj_consume_token(BNODE);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case LPAREN:{
        jj_consume_token(LPAREN);
        expr1 = Expression();
        jj_consume_token(RPAREN);
{if ("" != null) return makeFunction_BNode(expr1) ;}
        break;
        }
      case NIL:{
        jj_consume_token(NIL);
{if ("" != null) return makeFunction_BNode() ;}
        break;
        }
      default:
        jj_la1[150] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    case RAND:{
      jj_consume_token(RAND);
      jj_consume_token(NIL);
{if ("" != null) return new E_Random() ;}
      break;
      }
    case ABS:{
      jj_consume_token(ABS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_NumAbs(expr1) ;}
      break;
      }
    case CEIL:{
      jj_consume_token(CEIL);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_NumCeiling(expr1) ;}
      break;
      }
    case FLOOR:{
      jj_consume_token(FLOOR);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_NumFloor(expr1) ;}
      break;
      }
    case ROUND:{
      jj_consume_token(ROUND);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_NumRound(expr1) ;}
      break;
      }
    case CONCAT:{
      jj_consume_token(CONCAT);
      a = ExpressionList();
{if ("" != null) return new E_StrConcat(a) ;}
      break;
      }
    case SUBSTR:{
      expr = SubstringExpression();
{if ("" != null) return expr ;}
      break;
      }
    case STRLEN:{
      jj_consume_token(STRLEN);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrLength(expr1) ;}
      break;
      }
    case REPLACE:{
      expr = StrReplaceExpression();
{if ("" != null) return expr ;}
      break;
      }
    case UCASE:{
      jj_consume_token(UCASE);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrUpperCase(expr1) ;}
      break;
      }
    case LCASE:{
      jj_consume_token(LCASE);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrLowerCase(expr1) ;}
      break;
      }
    case ENCODE_FOR_URI:{
      jj_consume_token(ENCODE_FOR_URI);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrEncodeForURI(expr1) ;}
      break;
      }
    case CONTAINS:{
      jj_consume_token(CONTAINS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrContains(expr1, expr2) ;}
      break;
      }
    case STRSTARTS:{
      jj_consume_token(STRSTARTS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;}
      break;
      }
    case STRENDS:{
      jj_consume_token(STRENDS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;}
      break;
      }
    case STRBEFORE:{
      jj_consume_token(STRBEFORE);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrBefore(expr1, expr2) ;}
      break;
      }
    case STRAFTER:{
      jj_consume_token(STRAFTER);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrAfter(expr1, expr2) ;}
      break;
      }
    case YEAR:{
      jj_consume_token(YEAR);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeYear(expr1) ;}
      break;
      }
    case MONTH:{
      jj_consume_token(MONTH);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeMonth(expr1) ;}
      break;
      }
    case DAY:{
      jj_consume_token(DAY);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeDay(expr1) ;}
      break;
      }
    case HOURS:{
      jj_consume_token(HOURS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeHours(expr1) ;}
      break;
      }
    case MINUTES:{
      jj_consume_token(MINUTES);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeMinutes(expr1) ;}
      break;
      }
    case SECONDS:{
      jj_consume_token(SECONDS);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeSeconds(expr1) ;}
      break;
      }
    case TIMEZONE:{
      jj_consume_token(TIMEZONE);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeTimezone(expr1) ;}
      break;
      }
    case TZ:{
      jj_consume_token(TZ);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_DateTimeTZ(expr1) ;}
      break;
      }
    case NOW:{
      jj_consume_token(NOW);
      jj_consume_token(NIL);
{if ("" != null) return new E_Now() ;}
      break;
      }
    case UUID:{
      jj_consume_token(UUID);
      jj_consume_token(NIL);
{if ("" != null) return new E_UUID() ;}
      break;
      }
    case STRUUID:{
      jj_consume_token(STRUUID);
      jj_consume_token(NIL);
{if ("" != null) return new E_StrUUID() ;}
      break;
      }
    case MD5:{
      jj_consume_token(MD5);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_MD5(expr1) ;}
      break;
      }
    case SHA1:{
      jj_consume_token(SHA1);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_SHA1(expr1) ;}
      break;
      }
    case SHA256:{
      jj_consume_token(SHA256);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_SHA256(expr1) ;}
      break;
      }
    case SHA384:{
      jj_consume_token(SHA384);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_SHA384(expr1) ;}
      break;
      }
    case SHA512:{
      jj_consume_token(SHA512);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_SHA512(expr1) ;}
      break;
      }
    case COALESCE:{
      jj_consume_token(COALESCE);
      a = ExpressionList();
{if ("" != null) return new E_Coalesce(a) ;}
      break;
      }
    case IF:{
      jj_consume_token(IF);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(COMMA);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_If(expr, expr1, expr2) ;}
      break;
      }
    case STRLANG:{
      jj_consume_token(STRLANG);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrLang(expr1, expr2) ;}
      break;
      }
    case STRLANGDIR:{
      jj_consume_token(STRLANGDIR);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(COMMA);
      expr3 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrLangDir(expr1, expr2, expr3) ;}
      break;
      }
    case STRDT:{
      jj_consume_token(STRDT);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_StrDatatype(expr1, expr2) ;}
      break;
      }
    case SAME_TERM:{
      jj_consume_token(SAME_TERM);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_SameTerm(expr1, expr2) ;}
      break;
      }
    case IS_IRI:{
      jj_consume_token(IS_IRI);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsIRI(expr) ;}
      break;
      }
    case IS_URI:{
      jj_consume_token(IS_URI);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsURI(expr) ;}
      break;
      }
    case IS_BLANK:{
      jj_consume_token(IS_BLANK);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsBlank(expr) ;}
      break;
      }
    case IS_LITERAL:{
      jj_consume_token(IS_LITERAL);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsLiteral(expr) ;}
      break;
      }
    case IS_NUMERIC:{
      jj_consume_token(IS_NUMERIC);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsNumeric(expr) ;}
      break;
      }
    case HAS_LANG:{
      jj_consume_token(HAS_LANG);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_HasLang(expr) ;}
      break;
      }
    case HAS_LANGDIR:{
      jj_consume_token(HAS_LANGDIR);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_HasLangDir(expr) ;}
      break;
      }
    case REGEX:{
      // Regular expression matcher
          expr = RegexExpression();
{if ("" != null) return expr ;}
      break;
      }
    case EXISTS:{
      expr = ExistsFunc();
{if ("" != null) return expr ;}
      break;
      }
    case NOT:{
      expr = NotExistsFunc();
{if ("" != null) return expr ;}
      break;
      }
    case IS_TRIPLE:{
      jj_consume_token(IS_TRIPLE);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_IsTriple(expr) ;}
      break;
      }
    case TRIPLE:{
      jj_consume_token(TRIPLE);
      jj_consume_token(LPAREN);
      expr1 = Expression();
      jj_consume_token(COMMA);
      expr2 = Expression();
      jj_consume_token(COMMA);
      expr3 = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_TripleFn(expr1, expr2, expr3) ;}
      break;
      }
    case SUBJECT:{
      jj_consume_token(SUBJECT);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_TripleSubject(expr) ;}
      break;
      }
    case PREDICATE:{
      jj_consume_token(PREDICATE);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_TriplePredicate(expr) ;}
      break;
      }
    case OBJECT:{
      jj_consume_token(OBJECT);
      jj_consume_token(LPAREN);
      expr = Expression();
      jj_consume_token(RPAREN);
{if ("" != null) return new E_TripleObject(expr) ;}
      break;
      }
    default:
      jj_la1[151] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ;
    jj_consume_token(REGEX);
    jj_consume_token(LPAREN);
    expr = Expression();
    jj_consume_token(COMMA);
    patExpr = Expression();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case COMMA:{
      jj_consume_token(COMMA);
      flagsExpr = Expression();
      break;
      }
    default:
      jj_la1[152] = jj_gen;
      ;
    }
    jj_consume_token(RPAREN);
{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ;
    jj_consume_token(SUBSTR);
    jj_consume_token(LPAREN);
    expr1 = Expression();
    jj_consume_token(COMMA);
    expr2 = Expression();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case COMMA:{
      jj_consume_token(COMMA);
      expr3 = Expression();
      break;
      }
    default:
      jj_la1[153] = jj_gen;
      ;
    }
    jj_consume_token(RPAREN);
{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ;
    jj_consume_token(REPLACE);
    jj_consume_token(LPAREN);
    expr1 = Expression();
    jj_consume_token(COMMA);
    expr2 = Expression();
    jj_consume_token(COMMA);
    expr3 = Expression();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case COMMA:{
      jj_consume_token(COMMA);
      expr4 = Expression();
      break;
      }
    default:
      jj_la1[154] = jj_gen;
      ;
    }
    jj_consume_token(RPAREN);
{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr ExistsFunc() throws ParseException {Element el ;
    jj_consume_token(EXISTS);
    el = GroupGraphPattern();
{if ("" != null) return createExprExists(el) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr NotExistsFunc() throws ParseException {Element el ;
    jj_consume_token(NOT);
    jj_consume_token(EXISTS);
    el = GroupGraphPattern();
{if ("" != null) return createExprNotExists(el) ;}
    throw new Error("Missing return statement in function");
}

  final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ;
                     Expr expr = null ; Expr expr2 = null ;
                     boolean distinct = false ;
                     ExprList ordered = new ExprList() ;
                     Token t ;
startAggregate();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case COUNT:{
      t = jj_consume_token(COUNT);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[155] = jj_gen;
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case STAR:{
        jj_consume_token(STAR);
        break;
        }
      case IRIref:
      case PNAME_NS:
      case PNAME_LN:
      case VAR1:
      case VAR2:
      case TRIPLE:
      case IS_TRIPLE:
      case SUBJECT:
      case PREDICATE:
      case OBJECT:
      case EXISTS:
      case NOT:
      case COUNT:
      case MIN:
      case MAX:
      case SUM:
      case AVG:
      case SAMPLE:
      case GROUP_CONCAT:
      case BOUND:
      case COALESCE:
      case IF:
      case BNODE:
      case IRI:
      case URI:
      case STR:
      case STRLANG:
      case STRLANGDIR:
      case STRDT:
      case DTYPE:
      case LANG:
      case LANGMATCHES:
      case LANGDIR:
      case IS_URI:
      case IS_IRI:
      case IS_BLANK:
      case IS_LITERAL:
      case IS_NUMERIC:
      case HAS_LANG:
      case HAS_LANGDIR:
      case REGEX:
      case SAME_TERM:
      case RAND:
      case ABS:
      case CEIL:
      case FLOOR:
      case ROUND:
      case CONCAT:
      case SUBSTR:
      case STRLEN:
      case REPLACE:
      case UCASE:
      case LCASE:
      case ENCODE_FOR_URI:
      case CONTAINS:
      case STRSTARTS:
      case STRENDS:
      case STRBEFORE:
      case STRAFTER:
      case YEAR:
      case MONTH:
      case DAY:
      case HOURS:
      case MINUTES:
      case SECONDS:
      case TIMEZONE:
      case TZ:
      case NOW:
      case UUID:
      case STRUUID:
      case MD5:
      case SHA1:
      case SHA256:
      case SHA384:
      case SHA512:
      case TRUE:
      case FALSE:
      case INTEGER:
      case DECIMAL:
      case DOUBLE:
      case INTEGER_POSITIVE:
      case DECIMAL_POSITIVE:
      case DOUBLE_POSITIVE:
      case INTEGER_NEGATIVE:
      case DECIMAL_NEGATIVE:
      case DOUBLE_NEGATIVE:
      case STRING_LITERAL1:
      case STRING_LITERAL2:
      case STRING_LITERAL_LONG1:
      case STRING_LITERAL_LONG2:
      case LPAREN:
      case L_TRIPLE:
      case BANG:
      case PLUS:
      case MINUS:{
        expr = Expression();
        break;
        }
      default:
        jj_la1[156] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      jj_consume_token(RPAREN);
if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; }
      if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; }
      break;
      }
    case SUM:{
      t = jj_consume_token(SUM);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[157] = jj_gen;
        ;
      }
      expr = Expression();
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createSum(distinct, expr) ;
      break;
      }
    case MIN:{
      t = jj_consume_token(MIN);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[158] = jj_gen;
        ;
      }
      expr = Expression();
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createMin(distinct, expr) ;
      break;
      }
    case MAX:{
      t = jj_consume_token(MAX);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[159] = jj_gen;
        ;
      }
      expr = Expression();
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createMax(distinct, expr) ;
      break;
      }
    case AVG:{
      t = jj_consume_token(AVG);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[160] = jj_gen;
        ;
      }
      expr = Expression();
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createAvg(distinct, expr) ;
      break;
      }
    case SAMPLE:{
      t = jj_consume_token(SAMPLE);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[161] = jj_gen;
        ;
      }
      expr = Expression();
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createSample(distinct, expr) ;
      break;
      }
    case GROUP_CONCAT:{
      t = jj_consume_token(GROUP_CONCAT);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case DISTINCT:{
        t = jj_consume_token(DISTINCT);
distinct = true ;
        break;
        }
      default:
        jj_la1[162] = jj_gen;
        ;
      }
      expr = Expression();
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case SEMICOLON:{
        jj_consume_token(SEMICOLON);
        jj_consume_token(SEPARATOR);
        jj_consume_token(EQ);
        sep = String();
        break;
        }
      default:
        jj_la1[163] = jj_gen;
        ;
      }
      jj_consume_token(RPAREN);
agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ;
      break;
      }
    default:
      jj_la1[164] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
if ( ! getAllowAggregatesInExpressions() )
        // Do late so we have the token for line/column
        throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ;
    if ( getAggregateDepth() > 1 )
        throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ;
Expr exprAgg = getQuery().allocAggregate(agg) ;
    finishAggregate();
    {if ("" != null) return exprAgg ;}
    throw new Error("Missing return statement in function");
}

// See also FunctionCall.
// The case of "q:name()" or "q:agg()" or just "q:name"
// by expanding out FunctionCall()
  final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ;
    iri = iri();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LPAREN:
    case NIL:{
      a = ArgList();
      break;
      }
    default:
      jj_la1[165] = jj_gen;
      ;
    }
if ( a == null )
       {if ("" != null) return asExpr(createNode(iri)) ;}
    if ( AggregateRegistry.isRegistered(iri) ) {
         // aggregates
         if ( ! getAllowAggregatesInExpressions() )
            throwParseException("Aggregate expression not legal at this point : "+iri, token.beginLine, token.beginColumn) ;
         Aggregator agg = AggregatorFactory.createCustom(iri, a) ;
         Expr exprAgg = getQuery().allocAggregate(agg) ;
         {if ("" != null) return exprAgg ;}
      }
    {if ("" != null) return new E_Function(iri, a) ;}
    throw new Error("Missing return statement in function");
}

  final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; String uri = null ;
    lex = String();
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case LANG_DIR:
    case DATATYPE:{
      switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
      case LANG_DIR:{
        t = jj_consume_token(LANG_DIR);
{if ("" != null) return createLiteralLang(lex, t.image, token.beginLine, token.beginColumn);}
        break;
        }
      case DATATYPE:{
        jj_consume_token(DATATYPE);
        uri = iri();
{if ("" != null) return createLiteralDT(lex, uri, token.beginLine, token.beginColumn);}
        break;
        }
      default:
        jj_la1[166] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
      }
    default:
      jj_la1[167] = jj_gen;
      ;
    }
{if ("" != null) return createLiteralString(lex, token.beginLine, token.beginColumn) ;}
    throw new Error("Missing return statement in function");
}

  final public Node NumericLiteral() throws ParseException {Node n ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INTEGER:
    case DECIMAL:
    case DOUBLE:{
      n = NumericLiteralUnsigned();
      break;
      }
    case INTEGER_POSITIVE:
    case DECIMAL_POSITIVE:
    case DOUBLE_POSITIVE:{
      n = NumericLiteralPositive();
      break;
      }
    case INTEGER_NEGATIVE:
    case DECIMAL_NEGATIVE:
    case DOUBLE_NEGATIVE:{
      n = NumericLiteralNegative();
      break;
      }
    default:
      jj_la1[168] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
{if ("" != null) return n ;}
    throw new Error("Missing return statement in function");
}

  final public Node NumericLiteralUnsigned() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INTEGER:{
      t = jj_consume_token(INTEGER);
{if ("" != null) return createLiteralInteger(t.image) ;}
      break;
      }
    case DECIMAL:{
      t = jj_consume_token(DECIMAL);
{if ("" != null) return createLiteralDecimal(t.image) ;}
      break;
      }
    case DOUBLE:{
      t = jj_consume_token(DOUBLE);
{if ("" != null) return createLiteralDouble(t.image) ;}
      break;
      }
    default:
      jj_la1[169] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node NumericLiteralPositive() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INTEGER_POSITIVE:{
      t = jj_consume_token(INTEGER_POSITIVE);
{if ("" != null) return createLiteralInteger(t.image) ;}
      break;
      }
    case DECIMAL_POSITIVE:{
      t = jj_consume_token(DECIMAL_POSITIVE);
{if ("" != null) return createLiteralDecimal(t.image) ;}
      break;
      }
    case DOUBLE_POSITIVE:{
      t = jj_consume_token(DOUBLE_POSITIVE);
{if ("" != null) return createLiteralDouble(t.image) ;}
      break;
      }
    default:
      jj_la1[170] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node NumericLiteralNegative() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case INTEGER_NEGATIVE:{
      t = jj_consume_token(INTEGER_NEGATIVE);
{if ("" != null) return createLiteralInteger(t.image) ;}
      break;
      }
    case DECIMAL_NEGATIVE:{
      t = jj_consume_token(DECIMAL_NEGATIVE);
{if ("" != null) return createLiteralDecimal(t.image) ;}
      break;
      }
    case DOUBLE_NEGATIVE:{
      t = jj_consume_token(DOUBLE_NEGATIVE);
{if ("" != null) return createLiteralDouble(t.image) ;}
      break;
      }
    default:
      jj_la1[171] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node BooleanLiteral() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case TRUE:{
      jj_consume_token(TRUE);
{if ("" != null) return XSD_TRUE ;}
      break;
      }
    case FALSE:{
      jj_consume_token(FALSE);
{if ("" != null) return XSD_FALSE ;}
      break;
      }
    default:
      jj_la1[172] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public String String() throws ParseException {Token t ; String lex ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case STRING_LITERAL1:{
      t = jj_consume_token(STRING_LITERAL1);
lex = stripQuotes(t.image) ;
      break;
      }
    case STRING_LITERAL2:{
      t = jj_consume_token(STRING_LITERAL2);
lex = stripQuotes(t.image) ;
      break;
      }
    case STRING_LITERAL_LONG1:{
      t = jj_consume_token(STRING_LITERAL_LONG1);
lex = stripQuotes3(t.image) ;
      break;
      }
    case STRING_LITERAL_LONG2:{
      t = jj_consume_token(STRING_LITERAL_LONG2);
lex = stripQuotes3(t.image) ;
      break;
      }
    default:
      jj_la1[173] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
lex = unescapeStr(lex, t.beginLine, t.beginColumn) ;
      checkRDFString(lex, t.beginLine, t.beginColumn) ;
      {if ("" != null) return lex ;}
    throw new Error("Missing return statement in function");
}

  final public String iri() throws ParseException {String iri ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case IRIref:{
      iri = IRIREF();
{if ("" != null) return iri ;}
      break;
      }
    case PNAME_NS:
    case PNAME_LN:{
      iri = PrefixedName();
{if ("" != null) return iri ;}
      break;
      }
    default:
      jj_la1[174] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public String PrefixedName() throws ParseException {Token t ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case PNAME_LN:{
      t = jj_consume_token(PNAME_LN);
{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;}
      break;
      }
    case PNAME_NS:{
      t = jj_consume_token(PNAME_NS);
{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;}
      break;
      }
    default:
      jj_la1[175] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

  final public Node BlankNode() throws ParseException {Token t = null ;
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case BLANK_NODE_LABEL:{
      t = jj_consume_token(BLANK_NODE_LABEL);
{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;}
      break;
      }
    case ANON:{
      //  <LBRACKET> <RBRACKET> { return createBNode(t.beginLine, t.beginColumn) ; }
        t = jj_consume_token(ANON);
{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;}
      break;
      }
    default:
      jj_la1[176] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}

// IRIREF must be the last rule. The production of the HTML uses this as the
// signal to switch from rules to terminals.
  final public String IRIREF() throws ParseException {Token t ;
    t = jj_consume_token(IRIref);
{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;}
    throw new Error("Missing return statement in function");
}

  /** Generated Token Manager. */
  public SPARQLParser12TokenManager token_source;
  SimpleCharStream jj_input_stream;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private int jj_gen;
  final private int[] jj_la1 = new int[177];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static private int[] jj_la1_2;
  static private int[] jj_la1_3;
  static private int[] jj_la1_4;
  static private int[] jj_la1_5;
  static private int[] jj_la1_6;
  static {
	   jj_la1_init_0();
	   jj_la1_init_1();
	   jj_la1_init_2();
	   jj_la1_init_3();
	   jj_la1_init_4();
	   jj_la1_init_5();
	   jj_la1_init_6();
	}
	private static void jj_la1_init_0() {
	   jj_la1_0 = new int[] {0xe400000,0x380000,0x380000,0x0,0x0,0x1800000,0x1800000,0x6000,0x6000,0x6000,0x0,0x0,0x0,0x6e00,0x6e00,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x40000000,0x30000000,0x6e00,0x0,0x6e00,0xe00,0x6e00,0x0,0x6e00,0x6e00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0xe00,0x0,0x7e00,0x0,0x0,0x7e00,0x7e00,0x7e00,0x0,0x400000,0x7e00,0x0,0x0,0x7e00,0x7e00,0x0,0x0,0x0,0x6000,0xe00,0x6000,0x0,0x0,0xe00,0x0,0xe00,0x7e00,0x7e00,0x0,0xe00,0x800000,0x0,0x0,0x0,0x0,0x7e00,0x7e00,0x0,0x7e00,0x46e00,0x0,0x46e00,0x46e00,0x0,0x7e00,0x46e00,0x46e00,0x0,0x46e00,0x46e00,0x0,0x0,0x0,0x0,0x40e00,0x0,0x40e00,0x0,0x40e00,0x40e00,0x40e00,0x40e00,0x0,0x0,0x7e00,0x7e00,0x0,0x0,0x0,0x0,0x7e00,0x7e00,0x7e00,0x0,0x7e00,0x7e00,0x7e00,0x7e00,0x40e00,0xe00,0x6e00,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6e00,0x6e00,0x6e00,0x6e00,0x0,0x0,0x0,0x0,0x0,0x800000,0x6e00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0xc00,0x1000,};
	}
	private static void jj_la1_init_1() {
	   jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x400000,0x800000,0x0,0x0,0xfc1fc000,0x200000,0xfc1fc000,0xfc1fc000,0xfc1fc00c,0xc,0xfc1fc000,0xfc1fc00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x0,0x0,0x400,0xfc1fc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfc1fc000,0xfc1fc000,0x0,0x0,0x0,0xfc1fc000,0x0,0x0,0x0,0x0,0xfc1fc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfc000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
	}
	private static void jj_la1_init_2() {
	   jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbffffed,0x0,0xfbffffed,0xfbffffed,0xfbffffed,0x0,0xfbffffed,0xfbffffed,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbffffed,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbffffed,0xfbffffed,0x0,0x0,0x0,0xfbffffed,0x0,0x0,0x0,0x0,0xfbffffed,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
	}
	private static void jj_la1_init_3() {
	   jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dffffff,0x0,0x1dffffff,0x1dffffff,0x1dffffff,0x0,0x1dffffff,0x1dffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60000000,0x0,0x0,0x60000000,0x60000000,0x60000000,0x0,0x0,0x60000000,0x0,0x0,0x60000000,0x60000000,0x0,0x0,0x0,0x0,0x60000000,0x0,0x0,0x0,0x60000000,0x0,0x60000000,0x0,0x0,0x0,0x1dffffff,0x0,0x0,0x0,0x0,0x0,0x60000000,0x60000000,0x0,0x60000000,0x0,0x0,0x0,0x0,0x0,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60000000,0x60000000,0x0,0x0,0x0,0x0,0x60000000,0x60000000,0x60000000,0x0,0x60000000,0x60000000,0x60000000,0x60000000,0x0,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dffffff,0x7dffffff,0x0,0x60000000,0x0,0x1dffffff,0x0,0x0,0x0,0x0,0x7dffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60000000,0x0,0x0,0x0,0x0,};
	}
	private static void jj_la1_init_4() {
	   jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427ff,0x427ff,0x1000,0x4000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x40000,0x1,0x3,0x80000,0x0,0x0,0x10000,0x30000,0x7ee00000,0x0,0x0,0x7ee00000,0x7ee00000,0x7ee00000,0x0,0x0,0x7ee00000,0x0,0x0,0x7ee00000,0x7ee00000,0x0,0x0,0x1000,0x0,0x7ee00000,0x0,0x0,0x0,0x7ee00000,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ee00000,0x7ee00000,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ee00000,0x7ee00000,0x0,0x0,0x0,0x0,0x7ee00000,0x7ee00000,0x7ee00000,0x0,0x7ee00000,0x7ee00000,0x7ee00000,0x7ee00000,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x0,0x7e000000,0x7e000000,0x0,0x0,0x7e000000,0x0,0x0,0x7ee00000,0x7ee00000,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x0,0x7ee00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ee00000,0xe00000,0xe000000,0x70000000,0x0,0x0,0x0,0x0,0x0,};
	}
	private static void jj_la1_init_5() {
	   jj_la1_5 = new int[] {0x0,0x0,0x0,0x60,0x0,0x0,0x0,0x200,0x200,0x200,0x0,0x0,0x1000,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14014be0,0x0,0x80000,0x14014be0,0x14014be0,0x14014be0,0x80000,0x0,0x14014be0,0x1000,0x80000,0x14014be0,0x14014be0,0x80000,0x1000,0x0,0xa00,0x40001e0,0x0,0xa00,0xa00,0x40001e0,0xa00,0x40001e0,0x10000,0x10000,0x0,0x200,0x0,0x40000,0xa00,0x40000,0xa00,0x14014be0,0x14014be0,0x80000,0x14014be0,0x0,0x20000,0x0,0x0,0x40000,0x14014be0,0x200,0x200,0x20000,0x200,0x200,0x40000,0x0,0x0,0x0,0x200,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x4200,0x4200,0x14014be0,0x14014be0,0x40000000,0x40000000,0x40000000,0x40000000,0x14014be0,0x14014be0,0x40109e0,0x0,0x140101e0,0x140101e0,0x40101e0,0x40101e0,0x0,0x40001e0,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40003e0,0x40003e0,0x0,0x40001e0,0xa00,0x0,0x40000,0x40000,0x40000,0x0,0x40003e0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0xa00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e0,0x0,0x0,0x10000,};
	}
	private static void jj_la1_init_6() {
	   jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1002,0x1002,0x0,0x1002,0x1002,0x0,0x800,0x100,0x20a0,0x1002,0x20a0,0x2,0x800,0x1000,0x1000,0x0,0x1000,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x0,0x60,0x0,0x180,0x180,0x60,0x180,0x180,0x62,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
	}

  /** Constructor with InputStream. */
  public SPARQLParser12(java.io.InputStream stream) {
	  this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public SPARQLParser12(java.io.InputStream stream, String encoding) {
	 try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
	 token_source = new SPARQLParser12TokenManager(jj_input_stream);
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream) {
	  ReInit(stream, null);
  }
  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream, String encoding) {
	 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
	 token_source.ReInit(jj_input_stream);
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  /** Constructor. */
  public SPARQLParser12(java.io.Reader stream) {
	 jj_input_stream = new SimpleCharStream(stream, 1, 1);
	 token_source = new SPARQLParser12TokenManager(jj_input_stream);
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(java.io.Reader stream) {
	if (jj_input_stream == null) {
	   jj_input_stream = new SimpleCharStream(stream, 1, 1);
	} else {
	   jj_input_stream.ReInit(stream, 1, 1);
	}
	if (token_source == null) {
 token_source = new SPARQLParser12TokenManager(jj_input_stream);
	}

	 token_source.ReInit(jj_input_stream);
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  /** Constructor with generated Token Manager. */
  public SPARQLParser12(SPARQLParser12TokenManager tm) {
	 token_source = tm;
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(SPARQLParser12TokenManager tm) {
	 token_source = tm;
	 token = new Token();
	 jj_ntk = -1;
	 jj_gen = 0;
	 for (int i = 0; i < 177; i++) jj_la1[i] = -1;
  }

  private Token jj_consume_token(int kind) throws ParseException {
	 Token oldToken;
	 if ((oldToken = token).next != null) token = token.next;
	 else token = token.next = token_source.getNextToken();
	 jj_ntk = -1;
	 if (token.kind == kind) {
	   jj_gen++;
	   return token;
	 }
	 token = oldToken;
	 jj_kind = kind;
	 throw generateParseException();
  }


/** Get the next Token. */
  final public Token getNextToken() {
	 if (token.next != null) token = token.next;
	 else token = token.next = token_source.getNextToken();
	 jj_ntk = -1;
	 jj_gen++;
	 return token;
  }

/** Get the specific Token. */
  final public Token getToken(int index) {
	 Token t = token;
	 for (int i = 0; i < index; i++) {
	   if (t.next != null) t = t.next;
	   else t = t.next = token_source.getNextToken();
	 }
	 return t;
  }

  private int jj_ntk_f() {
	 if ((jj_nt=token.next) == null)
	   return (jj_ntk = (token.next=token_source.getNextToken()).kind);
	 else
	   return (jj_ntk = jj_nt.kind);
  }

  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  private int[] jj_expentry;
  private int jj_kind = -1;

  /** Generate ParseException. */
  public ParseException generateParseException() {
	 jj_expentries.clear();
	 boolean[] la1tokens = new boolean[217];
	 if (jj_kind >= 0) {
	   la1tokens[jj_kind] = true;
	   jj_kind = -1;
	 }
	 for (int i = 0; i < 177; i++) {
	   if (jj_la1[i] == jj_gen) {
		 for (int j = 0; j < 32; j++) {
		   if ((jj_la1_0[i] & (1<<j)) != 0) {
			 la1tokens[j] = true;
		   }
		   if ((jj_la1_1[i] & (1<<j)) != 0) {
			 la1tokens[32+j] = true;
		   }
		   if ((jj_la1_2[i] & (1<<j)) != 0) {
			 la1tokens[64+j] = true;
		   }
		   if ((jj_la1_3[i] & (1<<j)) != 0) {
			 la1tokens[96+j] = true;
		   }
		   if ((jj_la1_4[i] & (1<<j)) != 0) {
			 la1tokens[128+j] = true;
		   }
		   if ((jj_la1_5[i] & (1<<j)) != 0) {
			 la1tokens[160+j] = true;
		   }
		   if ((jj_la1_6[i] & (1<<j)) != 0) {
			 la1tokens[192+j] = true;
		   }
		 }
	   }
	 }
	 for (int i = 0; i < 217; i++) {
	   if (la1tokens[i]) {
		 jj_expentry = new int[1];
		 jj_expentry[0] = i;
		 jj_expentries.add(jj_expentry);
	   }
	 }
	 int[][] exptokseq = new int[jj_expentries.size()][];
	 for (int i = 0; i < jj_expentries.size(); i++) {
	   exptokseq[i] = jj_expentries.get(i);
	 }
	 return new ParseException(token, exptokseq, tokenImage);
  }

  private boolean trace_enabled;

/** Trace enabled. */
  final public boolean trace_enabled() {
	 return trace_enabled;
  }

  /** Enable tracing. */
  final public void enable_tracing() {
  }

  /** Disable tracing. */
  final public void disable_tracing() {
  }

 }
