Package com.complexible.common.rdf.query
Class SPARQLUtil
java.lang.Object
com.complexible.common.rdf.query.SPARQLUtil
Collection of utility methods for working with SPARQL strings
- Since:
- 1.2
- Version:
- 6.0
- Author:
- Evren Sirin, Michael Grove, Edgar Rodriguez-Diaz
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildRemoveQuery(Statement theStmtPattern) Builds a SPARQL Update remove query based on a Statement PatterngetNamespaces(String theQuery) Creates an iterable of namespaces by parsing the prefix declarations in a query string but does so lazily.static SPARQLUtil.QueryTypeReturn the type of SPARQL query contained in the string.static booleanisWriteOnlyUpdate(String theQuery) Checks if the given SPARQL query is a write-only update operation (no read/WHERE component).static StringremoveSPARQLQueryProlog(String theQuery) Forked from Sesame'sQueryParserUtil#removeSPARQLQueryPrologto use pre-compiled Patterns.static StringtoQuery(String theQuery, String reasoningSchema, long theOffset, long theLimit, Map<String, Value> theBindings, Dataset theDataset)
-
Field Details
-
PLAN_HEADER
- See Also:
-
NO_LIMIT
public static final long NO_LIMIT- See Also:
-
NO_OFFSET
public static final long NO_OFFSET- See Also:
-
-
Method Details
-
getType
Return the type of SPARQL query contained in the string. This is based on the code from the SesameQueryParserUtilclass.- Parameters:
theQuery- the query string- Returns:
- the type of the SPARQL query in the string
-
isWriteOnlyUpdate
Checks if the given SPARQL query is a write-only update operation (no read/WHERE component). Write-only operations include: INSERT DATA, DELETE DATA, LOAD, CLEAR, DROP, CREATE, COPY, MOVE, ADD.- Parameters:
theQuery- the query string- Returns:
- true if the query is a write-only update with no read component, false otherwise
-
toQuery
-
removeSPARQLQueryProlog
Forked from Sesame'sQueryParserUtil#removeSPARQLQueryPrologto use pre-compiled Patterns.- Parameters:
theQuery- the original query string- Returns:
- the query string w/o the prolog
-
getNamespaces
Creates an iterable of namespaces by parsing the prefix declarations in a query string but does so lazily. -
buildRemoveQuery
Builds a SPARQL Update remove query based on a Statement Pattern- Parameters:
theStmtPattern- the Statement SPOC pattern to fill up the SPARQL query- Returns:
- the Query string
-