Package cz.cvut.kbss.jopa.query.sparql
Class TokenStreamSparqlQueryHolder
java.lang.Object
cz.cvut.kbss.jopa.query.sparql.TokenStreamSparqlQueryHolder
- All Implemented Interfaces:
QueryHolder
-
Method Summary
Modifier and TypeMethodDescriptionAssembles the query, using any parameter values specified, and returns it as a string.void
clearParameter
(Parameter<?> parameter) Clears any previously set value of the specified parameter.void
Clears any previously set parameter values in this query.int
Gets the currently set first result position.int
Gets the currently set maximum number of results to retrieveParameter<?>
getParameter
(int position) Gets a parameter with the specified position.getParameter
(String name) Gets a parameter with the specified name.Gets a collection of parameters in the query.getParameterValue
(Parameter<?> parameter) Gets value bound to the specified parameter.Gets the list of query parameters that appear in the SELECT projection clause (in the order in which they are declared).getQuery()
Gets the original query string.Gets a collection of parameters in the query.Gets the type of this query.boolean
hasLimit()
boolean
boolean
hasParameter
(int position) Checks whether the query has a parameter at the specified position.boolean
hasParameter
(String name) Checks whether the query has a parameter with the specified name.void
setAssemblyModifier
(SparqlAssemblyModifier modifier) void
setFirstResult
(int startPosition) Sets the position of the first result to retrieve.void
setMaxResults
(int maxResults) Sets the maximum number of results the query should retrieve.<T> void
setParameter
(Parameter<T> parameter, Object value) Sets value of the specified parameter in the query.<T> void
setParameter
(Parameter<T> parameter, String value, String language) Sets value of the specified parameter in the query.<T> void
setUntypedParameter
(Parameter<T> parameter, Object value) Sets value of the specified parameter in the query.
-
Method Details
-
setAssemblyModifier
-
getQuery
Description copied from interface:QueryHolder
Gets the original query string.- Specified by:
getQuery
in interfaceQueryHolder
- Returns:
- Gets the original unparsed query
-
getParameters
Description copied from interface:QueryHolder
Gets a collection of parameters in the query.- Specified by:
getParameters
in interfaceQueryHolder
- Returns:
- Parameter objects
-
getQueryParameters
Description copied from interface:QueryHolder
Gets a collection of parameters in the query.This returns the same set as
QueryHolder.getParameters()
, but it returns more specific typeQueryParameter
.- Specified by:
getQueryParameters
in interfaceQueryHolder
- Returns:
- Parameter objects
-
getProjectedQueryParameters
Description copied from interface:QueryHolder
Gets the list of query parameters that appear in the SELECT projection clause (in the order in which they are declared).- Specified by:
getProjectedQueryParameters
in interfaceQueryHolder
- Returns:
- Projected query parameters
-
hasParameter
Description copied from interface:QueryHolder
Checks whether the query has a parameter with the specified name.- Specified by:
hasParameter
in interfaceQueryHolder
- Parameters:
name
- Parameter name- Returns:
true
if the query has a matching parameter,false
otherwise
-
hasParameter
public boolean hasParameter(int position) Description copied from interface:QueryHolder
Checks whether the query has a parameter at the specified position.- Specified by:
hasParameter
in interfaceQueryHolder
- Parameters:
position
- Parameter position- Returns:
true
if the query has a matching parameter,false
otherwise
-
getParameter
Description copied from interface:QueryHolder
Gets a parameter with the specified name.- Specified by:
getParameter
in interfaceQueryHolder
- Parameters:
name
- Parameter name- Returns:
- Parameter object
-
getParameter
Description copied from interface:QueryHolder
Gets a parameter with the specified position.- Specified by:
getParameter
in interfaceQueryHolder
- Parameters:
position
- Parameter position- Returns:
- Parameter object
-
getParameterValue
Description copied from interface:QueryHolder
Gets value bound to the specified parameter.- Specified by:
getParameterValue
in interfaceQueryHolder
- Parameters:
parameter
- Parameter- Returns:
- parameter value
-
setParameter
Description copied from interface:QueryHolder
Sets value of the specified parameter in the query.If a value was already specified for the parameter, it is overwritten by the new one. This version expresses the value type information using XSD datatype in the query string.
- Specified by:
setParameter
in interfaceQueryHolder
- Type Parameters:
T
- Type of the parameter- Parameters:
parameter
- Parameter objectvalue
- Value to use- See Also:
-
setParameter
Description copied from interface:QueryHolder
Sets value of the specified parameter in the query.If a value was already specified for the parameter, it is overwritten by the new one.
- Specified by:
setParameter
in interfaceQueryHolder
- Type Parameters:
T
- Type of the parameter- Parameters:
parameter
- Parameter objectvalue
- String value to uselanguage
- Parameter language
-
setUntypedParameter
Description copied from interface:QueryHolder
Sets value of the specified parameter in the query.If a value was already specified for the parameter, it is overwritten by the new one. This version inserts the string representation of the value directly into the query, without any type information.
- Specified by:
setUntypedParameter
in interfaceQueryHolder
- Parameters:
parameter
- Parameter objectvalue
- Value to use- See Also:
-
setFirstResult
public void setFirstResult(int startPosition) Description copied from interface:QueryHolder
Sets the position of the first result to retrieve.- Specified by:
setFirstResult
in interfaceQueryHolder
- Parameters:
startPosition
- The position to set, starting at 0
-
getFirstResult
public int getFirstResult()Description copied from interface:QueryHolder
Gets the currently set first result position.- Specified by:
getFirstResult
in interfaceQueryHolder
- Returns:
- the first result position, 0 if none was set
-
hasOffset
public boolean hasOffset() -
setMaxResults
public void setMaxResults(int maxResults) Description copied from interface:QueryHolder
Sets the maximum number of results the query should retrieve.- Specified by:
setMaxResults
in interfaceQueryHolder
- Parameters:
maxResults
- The maximum number of results
-
getMaxResults
public int getMaxResults()Description copied from interface:QueryHolder
Gets the currently set maximum number of results to retrieve- Specified by:
getMaxResults
in interfaceQueryHolder
- Returns:
- Maximum results value,
Integer.MAX_VALUE
when none was set
-
hasLimit
public boolean hasLimit() -
clearParameter
Description copied from interface:QueryHolder
Clears any previously set value of the specified parameter.- Specified by:
clearParameter
in interfaceQueryHolder
- Parameters:
parameter
- Parameter object
-
clearParameters
public void clearParameters()Description copied from interface:QueryHolder
Clears any previously set parameter values in this query.- Specified by:
clearParameters
in interfaceQueryHolder
-
assembleQuery
Description copied from interface:QueryHolder
Assembles the query, using any parameter values specified, and returns it as a string.- Specified by:
assembleQuery
in interfaceQueryHolder
- Returns:
- Assembled query
-
getQueryType
Description copied from interface:QueryHolder
Gets the type of this query.- Specified by:
getQueryType
in interfaceQueryHolder
- Returns:
- Query type
-
getQueryAttributes
-