Package com.complexible.common.rdf.query
Class SPARQLUtil
- java.lang.Object
-
- com.complexible.common.rdf.query.SPARQLUtil
-
public final class SPARQLUtil extends java.lang.Object
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 Modifier and Type Class Description static class
SPARQLUtil.QueryType
-
Field Summary
Fields Modifier and Type Field Description static long
NO_LIMIT
static long
NO_OFFSET
static java.lang.String
PLAN_HEADER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
buildRemoveQuery(Statement theStmtPattern)
Builds a SPARQL Update remove query based on a Statement Patternstatic java.lang.Iterable<Namespace>
getNamespaces(java.lang.String theQuery)
Creates an iterable of namespaces by parsing the prefix declarations in a query string but does so lazily.static SPARQLUtil.QueryType
getType(java.lang.String theQuery)
Return the type of SPARQL query contained in the string.static java.lang.String
removeSPARQLQueryProlog(java.lang.String theQuery)
Forked from Sesame'sQueryParserUtil#removeSPARQLQueryProlog
to use pre-compiled Patterns.static java.lang.String
toQuery(java.lang.String theQuery, java.lang.String reasoningSchema, long theOffset, long theLimit, java.util.Map<java.lang.String,Value> theBindings, Dataset theDataset)
-
-
-
Field Detail
-
PLAN_HEADER
public static final java.lang.String PLAN_HEADER
- See Also:
- Constant Field Values
-
NO_LIMIT
public static final long NO_LIMIT
- See Also:
- Constant Field Values
-
NO_OFFSET
public static final long NO_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public static SPARQLUtil.QueryType getType(java.lang.String theQuery)
Return the type of SPARQL query contained in the string. This is based on the code from the SesameQueryParserUtil
class.- Parameters:
theQuery
- the query string- Returns:
- the type of the SPARQL query in the string
-
toQuery
@Nonnull public static java.lang.String toQuery(@Nonnull java.lang.String theQuery, java.lang.String reasoningSchema, long theOffset, long theLimit, @Nonnull java.util.Map<java.lang.String,Value> theBindings, @Nonnull Dataset theDataset)
-
removeSPARQLQueryProlog
public static java.lang.String removeSPARQLQueryProlog(java.lang.String theQuery)
Forked from Sesame'sQueryParserUtil#removeSPARQLQueryProlog
to use pre-compiled Patterns.- Parameters:
theQuery
- the original query string- Returns:
- the query string w/o the prolog
-
getNamespaces
public static java.lang.Iterable<Namespace> getNamespaces(java.lang.String theQuery)
Creates an iterable of namespaces by parsing the prefix declarations in a query string but does so lazily.
-
buildRemoveQuery
public static java.lang.String buildRemoveQuery(Statement theStmtPattern)
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
-
-