/*
 * DO NOT EDIT THIS FILE!
 *
 * Parser generated by BisonGen on Mon Oct 29 11:36:41 2007.
 */


Query ::= Prolog QueryTypes

QueryTypes ::= SelectQuery
             | ConstructQuery
             | DescribeQuery
             | AskQuery

DescribeQuery ::= DESCRIBE VAR_REFERENCES DataSetClauseList WhereClause SolutionModifier
                | DESCRIBE VAR_REFERENCES SolutionModifier
                | DESCRIBE VAR_REFERENCES DataSetClauseList SolutionModifier
                | DESCRIBE VAR_REFERENCES WhereClause SolutionModifier

ConstructQuery ::= CONSTRUCT LEFT_CURLY Triples RIGHT_CURLY DataSetClauseList WhereClause SolutionModifier
                 | CONSTRUCT LEFT_CURLY Triples RIGHT_CURLY WhereClause SolutionModifier

Prolog ::= BaseDecl PrefixDeclList
         | BaseDecl
         | PrefixDeclList
         |

PrefixDeclList ::= PrefixDecl
                 | PrefixDeclList PrefixDecl

PrefixDecl ::= PREFIX PNAME_NS LESS_THAN Q_IRI_CONTENT GREATER_THAN
             | PREFIX PNAME_NS LESS_THAN GREATER_THAN

BaseDecl ::= BASE LESS_THAN Q_IRI_CONTENT GREATER_THAN

AskQuery ::= ASK WhereClause
           | ASK DataSetClauseList WhereClause

SelectQuery ::= SELECT VAR_REFERENCES WhereClause SolutionModifier
              | SELECT VAR_REFERENCES DataSetClauseList WhereClause SolutionModifier
              | SELECT DISTINCT VAR_REFERENCES WhereClause SolutionModifier
              | SELECT DISTINCT VAR_REFERENCES DataSetClauseList WhereClause SolutionModifier

VAR_REFERENCES ::= VariableReferenceList
                 | ASTERISK

VariableReferenceList ::= Var
                        | VariableReferenceList Var

IRIref ::= LESS_THAN Q_IRI_CONTENT GREATER_THAN
         | PrefixedName

PrefixedName ::= PNAME_NS
               | PNAME_LN

DataSetClauseList ::= DataSetClause
                    | DataSetClauseList DataSetClause

DataSetClause ::= FROM IRIref
                | FROM NAMED IRIref

WhereClause ::= WHERE GroupGraphPattern
              | GroupGraphPattern

SolutionModifier ::=
                   | OrderClause
                   | OrderClause LimitClause
                   | OrderClause LimitClause OffsetClause
                   | OrderClause OffsetClause LimitClause
                   | LimitClause OffsetClause
                   | OrderClause OffsetClause
                   | OffsetClause
                   | LimitClause

OrderClause ::= ORDER BY OrderConditionList

OrderConditionList ::= OrderCondition
                     | OrderConditionList OrderCondition

OrderCondition ::= ASC LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
                 | DESC LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
                 | FunctionCall
                 | BuiltInCall
                 | LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
                 | Var

LimitClause ::= LIMIT NumericLiteral

OffsetClause ::= OFFSET NumericLiteral

GroupGraphPattern ::= LEFT_CURLY RIGHT_CURLY
                    | LEFT_CURLY Triples GraphPatternList RIGHT_CURLY
                    | LEFT_CURLY Triples RIGHT_CURLY
                    | LEFT_CURLY GraphPatternList RIGHT_CURLY

GraphPatternList ::= GraphPattern
                   | GraphPatternList GraphPattern

GraphPattern ::= Filter Triples
               | Filter DOT Triples
               | Filter DOT
               | Filter
               | GraphPatternNotTriples Triples
               | GraphPatternNotTriples DOT Triples
               | GraphPatternNotTriples
               | GraphPatternNotTriples DOT

GraphPatternNotTriples ::= OPTIONAL GroupGraphPattern
                         | GroupGraphPattern
                         | GroupGraphPattern AlternativeGroupGraphPatterns
                         | GRAPH Var GroupGraphPattern
                         | GRAPH BlankNode GroupGraphPattern
                         | GRAPH IRIref GroupGraphPattern

AlternativeGroupGraphPatterns ::= UNION GroupGraphPattern
                                | AlternativeGroupGraphPatterns UNION GroupGraphPattern

ConditionalOrExpression ::= ConditionalAndExpression
                          | ConditionalAndExpression ConditionalAndExpressionList

ConditionalAndExpressionList ::= DOUBLE_PIPE ConditionalAndExpression
                               | ConditionalAndExpressionList DOUBLE_PIPE ConditionalAndExpression

ConditionalAndExpression ::= RelationalExpression ValueLogicalList
                           | RelationalExpression

ValueLogicalList ::= DOUBLE_AMPERSAND RelationalExpression
                   | ValueLogicalList DOUBLE_AMPERSAND RelationalExpression

RelationalExpression ::= AdditiveExpression
                       | AdditiveExpression EQUALITY_OP AdditiveExpression
                       | AdditiveExpression NOT_EQUAL AdditiveExpression
                       | AdditiveExpression LESS_THAN AdditiveExpression
                       | AdditiveExpression GREATER_THAN AdditiveExpression
                       | AdditiveExpression LESS_THAN_EQUAL AdditiveExpression
                       | AdditiveExpression GREATER_THAN_EQUAL AdditiveExpression

AdditiveExpression ::= MultiplicativeExpression
                     | MultiplicativeExpression MultiplicativeExpressionList

MultiplicativeExpressionList ::= PLUS MultiplicativeExpression
                               | MINUS MultiplicativeExpression
                               | MultiplicativeExpressionList MINUS MultiplicativeExpression
                               | MultiplicativeExpressionList PLUS MultiplicativeExpression

MultiplicativeExpression ::= UnaryExpression
                           | UnaryExpression UnaryExpressionList

UnaryExpressionList ::= ASTERISK UnaryExpression
                      | FORWARDSLASH UnaryExpression
                      | UnaryExpressionList ASTERISK UnaryExpression
                      | UnaryExpressionList FORWARDSLASH UnaryExpression

UnaryExpression ::= BANG PrimaryExpression
                  | PLUS PrimaryExpression
                  | MINUS PrimaryExpression
                  | PrimaryExpression

BuiltInCall ::= STR LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | LANG LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | LANGMATCHES LEFT_PAREN ConditionalOrExpression COMMA ConditionalOrExpression RIGHT_PAREN
              | DATATYPE LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | BOUND LEFT_PAREN Var RIGHT_PAREN
              | isIRI LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | isURI LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | isBLANK LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | isLITERAL LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
              | RegexExpression

RegexExpression ::= REGEX LEFT_PAREN ConditionalOrExpression COMMA ConditionalOrExpression RIGHT_PAREN
                  | REGEX LEFT_PAREN ConditionalOrExpression COMMA ConditionalOrExpression COMMA ConditionalOrExpression RIGHT_PAREN

FunctionCall ::= IRIref LEFT_PAREN ArgumentList RIGHT_PAREN
               | IRIref NIL

ArgumentList ::= ConditionalOrExpression
               | ConditionalOrExpression COMMA ArgumentList

PrimaryExpression ::= LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
                    | BuiltInCall
                    | IRIref
                    | FunctionCall
                    | RDFLiteral
                    | NumericLiteral
                    | BooleanLiteral
                    | BlankNode
                    | Var

Filter ::= FILTER LEFT_PAREN ConditionalOrExpression RIGHT_PAREN
         | FILTER BuiltInCall
         | FILTER FunctionCall

Triples ::= Triples DOT TriplesSameSubject
          | Triples DOT
          | TriplesSameSubject

TriplesSameSubject ::= Var PropertyListNotEmpty
                     | GraphTerm PropertyListNotEmpty
                     | LEFT_SQUARE PropertyListNotEmpty RIGHT_SQUARE PropertyList
                     | Collection PropertyListNotEmpty
                     | Collection

PropertyList ::= PropertyListNotEmpty
               |

PropertyListNotEmpty ::= Verb ObjectList
                       | Verb ObjectList SEMICOLON PropertyList

ObjectList ::= GraphNode
             | ObjectList COMMA GraphNode

GraphNode ::= Var
            | TriplesNode
            | GraphTerm

Verb ::= Var
       | IRIref
       | A

TriplesNode ::= Collection
              | LEFT_SQUARE PropertyList RIGHT_SQUARE

Collection ::= LEFT_PAREN GraphNodeList RIGHT_PAREN

GraphNodeList ::= GraphNode
                | GraphNodeList GraphNode

Var ::= VARNAME

GraphTerm ::= IRIref
            | RDFLiteral
            | NumericLiteral
            | PLUS NumericLiteral
            | MINUS NumericLiteral
            | BooleanLiteral
            | BlankNode
            | NIL

NumericLiteral ::= INTEGER
                 | DECIMAL
                 | DOUBLE

RDFLiteral ::= String
             | String LANGTAG
             | String DOUBLE_HAT IRIref

BooleanLiteral ::= TRUE
                 | FALSE

String ::= STRING_LITERAL_DELIMETER_1 STRING_LITERAL1 STRING_LITERAL_DELIMETER_1
         | STRING_LITERAL_DELIMETER_3 STRING_LITERAL2 STRING_LITERAL_DELIMETER_3
         | STRING_LITERAL_DELIMETER_2 STRING_LITERAL_LONG1 STRING_LITERAL_DELIMETER_2
         | STRING_LITERAL_DELIMETER_4 STRING_LITERAL_LONG2 STRING_LITERAL_DELIMETER_4
         | STRING_LITERAL_DELIMETER_1 STRING_LITERAL_DELIMETER_1
         | STRING_LITERAL_DELIMETER_3 STRING_LITERAL_DELIMETER_3
         | STRING_LITERAL_DELIMETER_2 STRING_LITERAL_DELIMETER_2
         | STRING_LITERAL_DELIMETER_4 STRING_LITERAL_DELIMETER_4

BlankNode ::= ANON
            | BLANK_NODE_LABEL
