Package com.franz.agraph.repository
Class AGQuery
java.lang.Object
org.eclipse.rdf4j.query.impl.AbstractOperation
org.eclipse.rdf4j.query.impl.AbstractQuery
com.franz.agraph.repository.AGQuery
- Direct Known Subclasses:
AGBooleanQuery
,AGGraphQuery
,AGTupleQuery
,AGUpdate
An abstract query class common to Boolean, Graph and Tuple Queries.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.rdf4j.query.Query
Query.QueryType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default entailment regime to use when inferences are included.static final String
An entailment regime that includes hasValue, someValuesFrom and allValuesFrom reasoning in addition to RDFS++ entailment.static final String
The default query planner for SPARQL.static final String
A query planner for SPARQL that processes queries without doing any reordering of clauses or optimization, useful if the user knows the best order for processing the query. -
Constructor Summary
ConstructorDescriptionAGQuery
(AGRepositoryConnection con, QueryLanguage ql, String queryString, String baseURI) -
Method Summary
Modifier and TypeMethodDescriptionanalyze()
Returns the query analysis for the query.void
Evaluates the query and saves the results to a file.void
Evaluates the query and saves the results to a file.void
Evaluates the query and saves the results to a file.void
Evaluates the query and saves the results to a file.Gets the baseURI for this query.Binding[]
Deprecated.internal use onlyGets the entailment regime being used when including inferences with this query.static String
getFranzOptionPrefixString
(String option, String value) Returns a String of the form "PREFIX franzOption_OPTION: <franz:VALUE> " suitable for appending to a SPARQL query.Gets the query language for this query.int
getLimit()
Gets the limit on the number of solutions for this query.getName()
Gets the savedName for the query.int
Gets the offset, the number of solutions to skip for this query.Gets the query planner that processes the query.Gets the query string for this query.int
hashCode()
boolean
Gets the flag for checkVariables.boolean
Gets the loggingEnabled setting for this query.boolean
Gets the prepared flag for the query.void
setCheckVariables
(boolean checkVariables) A boolean that defaults to false, indicating whether an error should be raised when a SPARQL query selects variables that are not mentioned in the query body.void
Deprecated.internal use onlyvoid
setEntailmentRegime
(String entailmentRegime) Sets the entailment regime to use when including inferences with this query.void
setIncludeInferred
(boolean includeInferred) Determine whether evaluation results of this query should include inferred statements (if any inferred statements are present in the repository).void
setLimit
(int limit) Sets the limit.void
setLoggingEnabled
(boolean loggingEnabled) Sets the loggingEnabled parameter for this query.void
setOffset
(int offset) Sets the offset.void
setPlanner
(String planner) Sets the query planner to use when processing the query.void
setPrepared
(boolean prepared) Sets the prepared flag for the query.void
setSaveName
(String name) Sets the name to use when saving this query with the server's saved query service.stream()
Evaluates the query and returns the result as an input stream.Evaluates the query and returns the result as an input stream.toString()
Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractQuery
getMaxQueryTime, setMaxQueryTime
Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractOperation
clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setMaxExecutionTime
Methods inherited from interface org.eclipse.rdf4j.query.Operation
clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setMaxExecutionTime
-
Field Details
-
SPARQL_COVERAGE_PLANNER
The default query planner for SPARQL.- See Also:
-
SPARQL_IDENTITY_PLANNER
A query planner for SPARQL that processes queries without doing any reordering of clauses or optimization, useful if the user knows the best order for processing the query.- See Also:
-
RDFS_PLUS_PLUS
The default entailment regime to use when inferences are included.- See Also:
-
RESTRICTION
An entailment regime that includes hasValue, someValuesFrom and allValuesFrom reasoning in addition to RDFS++ entailment.- See Also:
-
-
Constructor Details
-
AGQuery
-
-
Method Details
-
getFranzOptionPrefixString
Returns a String of the form "PREFIX franzOption_OPTION: <franz:VALUE> " suitable for appending to a SPARQL query. VALUE is encoded per the rules for percent-encoding the query part of a URI (namely that the space char ' ' encoded as '%20' instead of '+'.- Parameters:
option
- the name of a valid AllegroGraph SPARQL Query Optionvalue
- String value to be encoded as the value of the prefixOption- Returns:
- String the generated prefix.
- See Also:
-
setIncludeInferred
public void setIncludeInferred(boolean includeInferred) Determine whether evaluation results of this query should include inferred statements (if any inferred statements are present in the repository). The default setting is 'false'.- Specified by:
setIncludeInferred
in interfaceOperation
- Overrides:
setIncludeInferred
in classAbstractOperation
- Parameters:
includeInferred
- indicates whether inferred statements should included in the result.- See Also:
-
getEntailmentRegime
Gets the entailment regime being used when including inferences with this query.- Returns:
- String the name of the entailment regime
-
setEntailmentRegime
Sets the entailment regime to use when including inferences with this query. Default is 'rdfs++'.- Parameters:
entailmentRegime
- indicates the entailment regime to use when reasoning- See Also:
-
getLanguage
Gets the query language for this query.- Returns:
- the query language
-
getQueryString
Gets the query string for this query.- Returns:
- the query string
-
isLoggingEnabled
public boolean isLoggingEnabled()Gets the loggingEnabled setting for this query.- Returns:
- Boolean true if logging is enabled, else false
-
setLoggingEnabled
public void setLoggingEnabled(boolean loggingEnabled) Sets the loggingEnabled parameter for this query.Default is false.
- Parameters:
loggingEnabled
- boolean indicating whether logging is enabled
-
getBaseURI
Gets the baseURI for this query.- Returns:
- the base URI
-
getPlanner
Gets the query planner that processes the query.- Returns:
- the planner name
-
setPlanner
Sets the query planner to use when processing the query.- Parameters:
planner
- the planner name
-
getEngine
Deprecated.internal use only- Returns:
- String the name of the engine used to perform this query
-
setEngine
Deprecated.internal use onlyThis method is not for general use - configure server agraph.cfg QueryEngine instead.- Parameters:
engine
- the name of the query engine to use for this query- See Also:
-
setSaveName
Sets the name to use when saving this query with the server's saved query service.- Parameters:
name
- the saved name
-
getName
Gets the savedName for the query.- Returns:
- the saved name
-
isPrepared
public boolean isPrepared()Gets the prepared flag for the query.- Returns:
- the prepared flag
-
setPrepared
public void setPrepared(boolean prepared) Sets the prepared flag for the query.- Parameters:
prepared
- the prepared flag
-
download
Evaluates the query and saves the results to a file.Output format is determined by the server.
- Parameters:
file
- Output path.- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
download
Evaluates the query and saves the results to a file.Output format is determined by the server.
- Parameters:
file
- Output path.- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
download
Evaluates the query and saves the results to a file.- Parameters:
file
- Output path.mimeType
- MIME type that will be requested from the server (i.e. output format).- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
download
Evaluates the query and saves the results to a file.- Parameters:
file
- Output path.mimeType
- MIME type that will be requested from the server (i.e. output format).- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
stream
Evaluates the query and returns the result as an input stream.Note that it is important to close the returned stream, to avoid resource leaks.
- Parameters:
mimeType
- MIME type that will be requested from the server (i.e. output format).- Returns:
- An input stream containing response data. The caller MUST close this stream to release connection resources.
- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
stream
Evaluates the query and returns the result as an input stream.The output format will be chosen by the server.
- Returns:
- An input stream containing response data. The caller MUST close this stream to release connection resources.
- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
analyze
Returns the query analysis for the query.The query is not evaluated.
- Returns:
- the query analysis as a string
- Throws:
QueryEvaluationException
- if there is an error while evaluating query
-
isCheckVariables
public boolean isCheckVariables()Gets the flag for checkVariables.- Returns:
- the checkVariables flag
-
setCheckVariables
public void setCheckVariables(boolean checkVariables) A boolean that defaults to false, indicating whether an error should be raised when a SPARQL query selects variables that are not mentioned in the query body.- Parameters:
checkVariables
- the checkVariables flag
-
getBindingsArray
-
toString
-
getLimit
public int getLimit()Gets the limit on the number of solutions for this query.- Returns:
- limit
-
setLimit
public void setLimit(int limit) Sets the limit.By default, the value is -1, meaning no constraint is imposed.
- Parameters:
limit
- the max number of solutions to collect for this query
-
getOffset
public int getOffset()Gets the offset, the number of solutions to skip for this query.- Returns:
- offset
-
setOffset
public void setOffset(int offset) Sets the offset.- Parameters:
offset
- the number of solutions to skip for this queryBy default, the value is -1, meaning no constraint is imposed.
-
hashCode
public int hashCode()
-