Package org.eclipse.rdf4j.query.parser
Class QueryPrologLexer
java.lang.Object
org.eclipse.rdf4j.query.parser.QueryPrologLexer
A simple lexer that tokenizes a syntactically legal input SPARQL query string on prolog items (prefixes, base
declarations, IRIs, comments, and syntactical tokens such as keywords, opening and closing brackets, and hashes).
- Author:
- Jeen Broekstra
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic QueryPrologLexer.Token
getRestOfQueryToken
(String input) Tokenizes the input string on prolog elements and returns the final Token.static List
<QueryPrologLexer.Token> Tokenizes a syntactically legal input SPARQL query on prolog elements.
-
Constructor Details
-
QueryPrologLexer
public QueryPrologLexer()
-
-
Method Details
-
lex
Tokenizes a syntactically legal input SPARQL query on prolog elements. The last token in the returned list is of typeQueryPrologLexer.TokenType.REST_OF_QUERY
and contains the SPARQL query string minus the prolog.- Parameters:
input
- a syntactically legal SPARQL query string- Returns:
- a list with tokens for each prolog element. If the input string is syntactically legal SPARQL, the final
returned token is guaranteed to be of type
QueryPrologLexer.TokenType.REST_OF_QUERY
and to contain the SPARQL query string minus the prolog. If the input string is not syntactically legal SPARQL, the method will still return normally but no guarantees about the returned list are made.
-
getRestOfQueryToken
Tokenizes the input string on prolog elements and returns the final Token. If the input string is a syntactically legal SPARQL query, this Token will be of typeQueryPrologLexer.TokenType.REST_OF_QUERY
and contain the query string minus prolog.- Parameters:
input
- a syntactically legal SPARQL string- Returns:
- if the input is syntactically legal SPARQL, a Token containing the query string without prolog. If the input is not syntactically legal, the method will still exist normally, but no guarantees are made about the returned object.
-