Tracks whether we are inside a DELETE block (DELETE DATA, DELETE WHERE, or DeleteClause). Per grammar note 7, blank node syntax is not allowed in these contexts, which means anonymous reifiers and annotation blocks without a named reifier are disallowed.
Tracks whether the current verb in a PropertyListPathNotEmpty is a simple path (IRI or 'a') vs a complex property path expression. Per spec note 16, annotations and reifiers are only permitted when the verb is a simple path.
[37] Add ::= 'ADD' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault
[125] AdditiveExpression ::= MultiplicativeExpression ('+' MultiplicativeExpression | '-' MultiplicativeExpression | (NumericLiteralPositive | NumericLiteralNegative) (('' UnaryExpression) | ('/' UnaryExpression))?)
[137] Aggregate ::= 'COUNT' '(' 'DISTINCT'? ('*' | Expression) ')' | 'SUM' '(' 'DISTINCT'? Expression ')' | 'MIN' '(' 'DISTINCT'? Expression ')' | 'MAX' '(' 'DISTINCT'? Expression ')' | 'AVG' '(' 'DISTINCT'? Expression ')' | 'SAMPLE' '(' 'DISTINCT'? Expression ')' | 'GROUP_CONCAT' '(' 'DISTINCT'? Expression (';' 'SEPARATOR' '=' String)? ')'
[109] Annotation ::= (Reifier | AnnotationBlock)*
In delete contexts (DELETE DATA, DELETE WHERE, DeleteClause), annotation blocks without a preceding named reifier are rejected because they create anonymous reifiers (blank nodes), which are disallowed per grammar note 7.
[110] AnnotationBlock ::= '{|' PropertyListNotEmpty '|}'
[108] AnnotationBlockPath ::= '{|' PropertyListPathNotEmpty '|}'
[107] AnnotationPath ::= (Reifier | AnnotationBlockPath)*
Per spec note 16: annotations and reifiers are only permitted when the predicate is a simple path (IRI, 'a', or variable), not for complex path expressions (sequence, alternative, inverse, modifiers, negation, grouping).
[74] ArgList ::= NIL | '(' 'DISTINCT'? Expression (',' Expression)* ')'
[14] AskQuery ::= 'ASK' DatasetClause* WhereClause SolutionModifier
[5] BaseDecl ::= 'BASE' IRIREF
[63] Bind ::= 'BIND' '(' Expression 'AS' Var ')'
[148] BlankNode ::= BLANK_NODE_LABEL | ANON
BlankNodePropertyList ::= '[' PropertyListNotEmpty ']'
BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']'
[144] BooleanLiteral ::= 'true' | 'false'
[129] BrackettedExpression ::= '(' Expression ')'
[131] BuiltInCall - dispatches to sub-groups to stay within Chevrotain's CONSUME index limits
Date/time built-ins: YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS, TIMEZONE, TZ, NOW
Hash built-ins: MD5, SHA1, SHA256, SHA384, SHA512
Miscellaneous built-ins: COALESCE, IF, UUID, STRUUID
Numeric built-ins: ABS, CEIL, FLOOR, ROUND, RAND
RDF 1.2 built-ins: isTRIPLE, TRIPLE, SUBJECT, PREDICATE, OBJECT, hasLANG, hasLANGDIR
String built-ins part 1: STRLEN, UCASE, LCASE, ENCODE_FOR_URI, CONTAINS, STRSTARTS, CONCAT
String built-ins part 2: STRENDS, STRBEFORE, STRAFTER
String built-ins part 3: STRLANG, STRLANGDIR, STRDT
Term accessor built-ins: STR, LANG, LANGDIR, DATATYPE, IRI, URI, BNODE
Test built-ins: sameTerm, isIRI, isURI, isBLANK, isLITERAL, isNUMERIC
[34] Clear ::= 'CLEAR' 'SILENT'? GraphRefAll
Collection ::= '(' GraphNode+ ')'
CollectionPath ::= '(' GraphNodePath+ ')'
[121] ConditionalAndExpression ::= ValueLogical ('&&' ValueLogical)*
[120] ConditionalOrExpression ::= ConditionalAndExpression ('||' ConditionalAndExpression)*
[72] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall
[12] ConstructQuery ::= 'CONSTRUCT' (ConstructTemplate DatasetClause* WhereClause SolutionModifier | DatasetClause* 'WHERE' '{' TriplesTemplate? '}' SolutionModifier)
[76] ConstructTemplate ::= '{' ConstructTriples? '}'
[77] ConstructTriples ::= TriplesSameSubject ('.' ConstructTriples?)?
[39] Copy ::= 'COPY' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault
[36] Create ::= 'CREATE' 'SILENT'? GraphRef
[65] DataBlock ::= InlineDataOneVar | InlineDataFull
[68] DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF' | TripleTermData
[15] DatasetClause ::= 'FROM' (DefaultGraphClause | NamedGraphClause)
[16] DefaultGraphClause ::= SourceSelector
[44] DeleteClause ::= 'DELETE' QuadPattern
[41] DeleteData ::= 'DELETE' 'DATA' QuadData
[42] DeleteWhere ::= 'DELETE' 'WHERE' QuadPattern
[13] DescribeQuery ::= 'DESCRIBE' (VarOrIri+ | '') DatasetClause WhereClause? SolutionModifier
[35] Drop ::= 'DROP' 'SILENT'? GraphRefAll
An array of recognition exceptions that occurred during parsing. This can be used to identify and handle any syntax errors in the input document.
[135] ExistsFunc ::= 'EXISTS' GroupGraphPattern
[119] Expression ::= ConditionalOrExpression
[75] ExpressionList ::= NIL | '(' Expression (',' Expression)* ')'
[137] ExprTripleTerm ::= '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>'
[139] ExprTripleTermObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm
[138] ExprTripleTermSubject ::= iri | Var
[71] Filter ::= 'FILTER' Constraint
[73] FunctionCall ::= iri ArgList
[61] GraphGraphPattern ::= 'GRAPH' VarOrIri GroupGraphPattern
[113] GraphNode ::= VarOrTerm | TriplesNode | ReifiedTriple
[114] GraphNodePath ::= VarOrTerm | TriplesNodePath | ReifiedTriple
[86] Object ::= GraphNode Annotation
[47] GraphOrDefault ::= 'DEFAULT' | 'GRAPH'? iri
[58] GraphPatternNotTriples ::= GroupOrUnionGraphPattern | OptionalGraphPattern | MinusGraphPattern | GraphGraphPattern | ServiceGraphPattern | Filter | Bind | InlineData | ReifiedTripleBlockPath
[48] GraphRef ::= 'GRAPH' iri
[49] GraphRefAll ::= GraphRef | 'DEFAULT' | 'NAMED' | 'ALL'
GraphTerm ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL | TripleTerm
[21] GroupClause ::= 'GROUP' 'BY' GroupCondition+
[22] GroupCondition ::= BuiltInCall | FunctionCall | '(' Expression ('AS' Var)? ')' | Var
[55] GroupGraphPattern ::= '{' (SubSelect | GroupGraphPatternSub) '}'
[56] GroupGraphPatternSub ::= TriplesBlock? (GraphPatternNotTriples '.'? TriplesBlock?)*
[70] GroupOrUnionGraphPattern ::= GroupGraphPattern ('UNION' GroupGraphPattern)*
[23] HavingClause ::= 'HAVING' HavingCondition+
[24] HavingCondition ::= Constraint
[64] InlineData ::= 'VALUES' DataBlock
[67] InlineDataFull ::= (NIL | '(' Var* ')') '{' ('(' DataBlockValue* ')' | NIL)* '}'
[66] InlineDataOneVar ::= Var '{' DataBlockValue* '}'
[45] InsertClause ::= 'INSERT' QuadPattern
[40] InsertData ::= 'INSERT' 'DATA' QuadData
[146] iri ::= IRIREF | PrefixedName
[138] iriOrFunction ::= iri ArgList?
[28] LimitClause ::= 'LIMIT' INTEGER
[27] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause?
Literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
[33] Load ::= 'LOAD' 'SILENT'? iri ('INTO' GraphRef)?
[69] MinusGraphPattern ::= 'MINUS' GroupGraphPattern
[43] Modify ::= ('WITH' iri)? (DeleteClause InsertClause? | InsertClause) UsingClause* 'WHERE' GroupGraphPattern
[38] Move ::= 'MOVE' 'SILENT'? GraphOrDefault 'TO' GraphOrDefault
[126] MultiplicativeExpression ::= UnaryExpression (('' UnaryExpression) | ('/' UnaryExpression))
[17] NamedGraphClause ::= 'NAMED' SourceSelector
A map of prefixes to their namespace IRI.
[136] NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern
[124] NumericExpression ::= AdditiveExpression
[140] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative
[143] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE
[142] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE
[141] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE
[85] ObjectList ::= Object (',' Object)*
[92] ObjectListPath ::= ObjectPath (',' ObjectPath)*
[93] ObjectPath ::= GraphNodePath AnnotationPath
[29] OffsetClause ::= 'OFFSET' INTEGER
[60] OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern
[25] OrderClause ::= 'ORDER' 'BY' OrderCondition+
[26] OrderCondition ::= (('ASC' | 'DESC') BrackettedExpression) | (Constraint | Var)
[91] Path ::= PathAlternative
[92] PathAlternative ::= PathSequence ('|' PathSequence)*
[94] PathElt ::= PathPrimary PathMod?
[95] PathEltOrInverse ::= PathElt | '^' PathElt
[96] PathMod ::= '?' | '*' | '+'
[98] PathNegatedPropertySet ::= PathOneInPropertySet | '(' (PathOneInPropertySet ('|' PathOneInPropertySet)*)? ')'
[99] PathOneInPropertySet ::= iri | 'a' | '^' (iri | 'a')
[97] PathPrimary ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')'
[93] PathSequence ::= PathEltOrInverse ('/' PathEltOrInverse)*
[6] PrefixDecl ::= 'PREFIX' PNAME_NS IRIREF
[147] PrefixedName ::= PNAME_LN | PNAME_NS
[128] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm
[4] Prologue ::= (BaseDecl | PrefixDecl | VersionDecl)*
[79] PropertyList ::= PropertyListNotEmpty?
[80] PropertyListNotEmpty ::= Verb ObjectList (';' (Verb ObjectList)?)*
[85] PropertyListPath ::= PropertyListPathNotEmpty?
[86] PropertyListPathNotEmpty ::= (VerbPath | VerbSimple) ObjectListPath (';' ((VerbPath | VerbSimple) ObjectListPath)?)*
Per spec note 16: annotations and reifiers are only permitted when the predicate is a simple path (IRI, 'a', or variable). Inside annotation blocks, complex paths in verb position produce an error after parsing.
[51] QuadData ::= '{' Quads '}'
[50] QuadPattern ::= '{' Quads '}'
[52] Quads ::= TriplesTemplate? (QuadsNotTriples '.'? TriplesTemplate?)*
[53] QuadsNotTriples ::= 'GRAPH' VarOrIri '{' TriplesTemplate? '}'
[2] Query ::= Prologue (SelectQuery | ConstructQuery | DescribeQuery | AskQuery) ValuesClause Note: Prologue is factored out into queryOrUpdate.
Query body after prologue: (SelectQuery | ConstructQuery | DescribeQuery | AskQuery) ValuesClause
[1] QueryUnit ::= Query [30] UpdateUnit ::= Update Combined entry point that tries Query first, then Update.
[139] RDFLiteral ::= String (LANG_DIR | '^^' iri)?
Flag indicating the Parser is at the recording phase. Can be used to implement methods similar to BaseParser.ACTION Or any other logic to requires knowledge of the recording phase. See:
[132] RegexExpression ::= 'REGEX' '(' Expression ',' Expression (',' Expression)? ')'
[102] ReifiedTriple ::= '<<' ReifiedTripleSubject Verb ReifiedTripleObject Reifier? '>>'
[58] ReifiedTripleBlock ::= ReifiedTriple PropertyList
[59] ReifiedTripleBlockPath ::= ReifiedTriple PropertyListPath
[118] ReifiedTripleObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm Note: Unlike VarOrTerm, this does NOT include NIL.
[118] ReifiedTripleObjectPath ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriplePath | TripleTerm Note: Unlike VarOrTerm, this does NOT include NIL.
[103] ReifiedTriplePath ::= '<<' ReifiedTripleSubject VerbPath ReifiedTripleObjectPath Reifier? '>>'
[101] ReifiedTriplePathBlock ::= ReifiedTriplePath PropertyListPathNotEmpty
[117] ReifiedTripleSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | ReifiedTriple | TripleTerm Note: Unlike VarOrTerm, this does NOT include NIL.
[111] Reifier ::= '~' VarOrReifierId?
[123] RelationalExpression ::= NumericExpression ('=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList)?
[11] SelectClause ::= 'SELECT' ('DISTINCT' | 'REDUCED')? ((Var | ('(' Expression 'AS' Var ')'))+ | '*')
[9] SelectQuery ::= SelectClause DatasetClause* WhereClause SolutionModifier
Semantic errors collected during parsing (e.g., UndefinedNamespacePrefixError).
[62] ServiceGraphPattern ::= 'SERVICE' 'SILENT'? VarOrIri GroupGraphPattern
[20] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses?
[18] SourceSelector ::= iri
[145] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE
[134] StrReplaceExpression ::= 'REPLACE' '(' Expression ',' Expression ',' Expression (',' Expression)? ')'
[10] SubSelect ::= SelectClause WhereClause SolutionModifier ValuesClause
[133] SubstringExpression ::= 'SUBSTR' '(' Expression ',' Expression (',' Expression)? ')'
[57] TriplesBlock ::= TriplesSameSubjectPath ('.' TriplesBlock?)?
TriplesNode ::= Collection | BlankNodePropertyList
TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath
[78] TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList | ReifiedTripleBlock
[84] TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath | ReifiedTripleBlockPath
[54] TriplesTemplate ::= TriplesSameSubject ('.' TriplesTemplate?)?
[113] TripleTerm ::= '<<(' TripleTermSubject Verb TripleTermObject ')>>'
[116] TripleTermData ::= '<<(' TripleTermDataSubject (iri | 'a') TripleTermDataObject ')>>'
[124] TripleTermDataObject ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | TripleTermData
[123] TripleTermDataSubject ::= iri
[121] TripleTermObject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm
[120] TripleTermSubject ::= Var | iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | TripleTerm
[135] UnaryExpression ::= '!' UnaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression
[31] Update ::= Prologue (Update1 (';' Update)? )? Note: Prologue is factored out into queryOrUpdate.
[32] Update1 ::= Load | Clear | Drop | Add | Move | Copy | Create | InsertData | DeleteData | DeleteWhere | Modify
Update body after prologue: (Update1 (';' Update)?)?
[46] UsingClause ::= 'USING' (iri | 'NAMED' iri)
[122] ValueLogical ::= RelationalExpression
ValuesClause ::= ('VALUES' DataBlock)?
Var ::= VAR1 | VAR2
VarOrIri ::= Var | iri
[112] VarOrReifierId ::= Var | iri | BlankNode
VarOrTerm ::= Var | GraphTerm
[81] Verb ::= VarOrIri | 'a'
[87] VerbPath ::= Path
[88] VerbSimple ::= Var
[7] VersionDecl ::= 'VERSION' VersionSpecifier
[8] VersionSpecifier ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE
[19] WhereClause ::= 'WHERE'? GroupGraphPattern
An array of tokens that were created by the lexer and used as input for the parser. This can be used to inspect the tokens that were processed during parsing, and to identify any issues with the tokenization process.
An array of tokens that were created by the lexer and used as input for the parser. This can be used to inspect the tokens that were processed during parsing, and to identify any issues with the tokenization process.
Parses a set of tokens created by the lexer into a concrete syntax tree (CST) representing the parsed document.
A set of tokens created by the lexer.
Whether to throw an error if any parsing errors are detected. Defaults to true.
A concrete syntax tree (CST) object.
Resets the parser state, should be overridden for custom parsers which "carry" additional state. When overriding, remember to also invoke the super implementation!
A SPARQL 1.2 compliant parser. Based on the SPARQL 1.2 grammar: https://www.w3.org/TR/sparql12-query/#sparqlGrammar