Package org.eclipse.rdf4j.query.parser
Class QueryPrologLexer
- java.lang.Object
-
- org.eclipse.rdf4j.query.parser.QueryPrologLexer
-
public class QueryPrologLexer extends Object
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
Nested Classes Modifier and Type Class Description static class
QueryPrologLexer.Token
static class
QueryPrologLexer.TokenType
-
Constructor Summary
Constructors Constructor Description QueryPrologLexer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static QueryPrologLexer.Token
getRestOfQueryToken(String input)
Tokenizes the input string on prolog elements and returns the final Token.static List<QueryPrologLexer.Token>
lex(String input)
Tokenizes a syntactically legal input SPARQL query on prolog elements.
-
-
-
Method Detail
-
lex
public static List<QueryPrologLexer.Token> lex(String input)
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
public static QueryPrologLexer.Token getRestOfQueryToken(String input)
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.
-
-