public interface SPARQLQueryDefinition extends QueryDefinition
Represents a SPARQL query.
For details about RDF, SPARQL, and semantics in MarkLogic see the Semantics Developer’s Guide.
| Modifier and Type | Method and Description |
|---|---|
SPARQLQueryDefinition |
clearBindings()
Remove all variable bindings from the child SPARQLBindings instance.
|
String |
getBaseUri() |
SPARQLBindings |
getBindings()
Get the child SPARQLBindings instance (normally populated by calls to withBinding methods).
|
QueryDefinition |
getConstrainingQueryDefinition() |
String[] |
getDefaultGraphUris() |
Boolean |
getIncludeDefaultRulesets() |
String[] |
getNamedGraphUris() |
int |
getOptimizeLevel() |
SPARQLRuleset[] |
getRulesets() |
String |
getSparql()
Get the SPARQL query or update statement
|
GraphPermissions |
getUpdatePermissions()
Get any permissions set on this instance.
|
String[] |
getUsingGraphUris() |
String[] |
getUsingNamedGraphUris() |
void |
setBaseUri(String uri)
set the base IRI for the query
|
void |
setBindings(SPARQLBindings bindings)
Set the child SPARQLBindings instance.
|
void |
setConstrainingQueryDefinition(QueryDefinition query)
Set the search query used to constrain the set of documents included in the SPARQL query.
|
void |
setDefaultGraphUris(String... uris)
Set the URI of the graph or graphs to use as the default graph.
|
void |
setIncludeDefaultRulesets(Boolean include)
Set whether to include database-default inference or not.
|
void |
setNamedGraphUris(String... uris)
Set the URI of a named graph or graphs to include in the query or update operation.
|
void |
setOptimizeLevel(int level)
Set a number indicating how much time for the query engine to spend analyzing a query.
|
void |
setRulesets(SPARQLRuleset... ruleset)
Set the name of rulesets to include for inferring triples.
|
void |
setSparql(String sparql)
Set the SPARQL query or update statement
|
void |
setSparql(TextWriteHandle sparql)
Set the SPARQL query or update statement
|
void |
setUpdatePermissions(GraphPermissions permissions)
For use with
SPARQL update,
where specified permissions will apply to any records created by the
update. |
void |
setUsingGraphUris(String... uris)
Set the URI of the graph or graphs to address as part of a SPARQL update operation.
|
void |
setUsingNamedGraphUris(String... uris)
Set the URI of a named graph or graphs to address as part of a SPARQL update operation.
|
SPARQLQueryDefinition |
withBinding(String name,
String value)
Bind a variable of type iri.
|
SPARQLQueryDefinition |
withBinding(String name,
String value,
Locale languageTag)
Bind a variable of type
http://www.w3.org/1999/02/22-rdf-syntax-ns#langString with the specified
language tag.
|
SPARQLQueryDefinition |
withBinding(String name,
String value,
RDFTypes type)
Bind a variable of specified type.
|
SPARQLQueryDefinition |
withConstrainingQuery(QueryDefinition query)
Set the search query used to constrain the set of documents included in the SPARQL query.
|
SPARQLQueryDefinition |
withIncludeDefaultRulesets(Boolean include)
Set whether to include database-default inference or not.
|
SPARQLQueryDefinition |
withRuleset(SPARQLRuleset ruleset)
Set the name of rulesets to include for inferring triples.
|
SPARQLQueryDefinition |
withSparql(String sparql)
Set the SPARQL query or update statement
|
SPARQLQueryDefinition |
withSparql(TextWriteHandle sparql)
Set the SPARQL query or update statement
|
SPARQLQueryDefinition |
withUpdatePermission(String role,
Capability capability)
Calls
setUpdatePermissions(com.marklogic.client.semantics.GraphPermissions) then returns this instance for method chaining. |
getCollections, getDirectory, getOptionsName, getResponseTransform, setCollections, setDirectory, setOptionsName, setResponseTransformvoid setSparql(String sparql)
Set the SPARQL query or update statement
sparql - the SPARQL statementvoid setSparql(TextWriteHandle sparql)
Set the SPARQL query or update statement
sparql - the SPARQL statementString getSparql()
Get the SPARQL query or update statement
SPARQLQueryDefinition withSparql(String sparql)
Set the SPARQL query or update statement
sparql - the SPARQL statementSPARQLQueryDefinition withSparql(TextWriteHandle sparql)
Set the SPARQL query or update statement
sparql - the SPARQL statementvoid setBindings(SPARQLBindings bindings)
Set the child SPARQLBindings instance.
bindings - bindings to set as the child SPARQLBindings instanceSPARQLBindings getBindings()
Get the child SPARQLBindings instance (normally populated by calls to withBinding methods).
SPARQLQueryDefinition withBinding(String name, String value)
Bind a variable of type iri.
name - the bound variable namevalue - the iri valueSPARQLQueryDefinition withBinding(String name, String value, RDFTypes type)
Bind a variable of specified type.
name - the bound variable namevalue - the value of the literaltype - the literal typeSPARQLQueryDefinition withBinding(String name, String value, Locale languageTag)
Bind a variable of type
http://www.w3.org/1999/02/22-rdf-syntax-ns#langString with the specified
language tag. Note that we call Locale.toLanguageTag()
to get compliant IETF BCP 47 language tags.
name - the bound variable namevalue - the value as a stringlanguageTag - the language and regional modifiers compliant with BCP-47SPARQLQueryDefinition clearBindings()
Remove all variable bindings from the child SPARQLBindings instance.
void setUpdatePermissions(GraphPermissions permissions)
For use with SPARQL update,
where specified permissions will apply to any records created by the
update. Create a GraphPermissions builder object with the specified
role and capabilities.
For example:
String sparqlUpdate = "INSERT DATA { <a> <b> <c> }";
SPARQLQueryDefinition qdef = sparqlMgr.newQueryDefinition(sparqlUpdate);
qdef.setUpdatePermissions(sparqlMgr.permission("rest-reader", Capability.UPDATE));
sparqlMgr.executeUpdate(qdef);permissions - the permissions (use SPARQLQueryManager.permission(java.lang.String, com.marklogic.client.semantics.Capability...) to create)GraphPermissions getUpdatePermissions()
Get any permissions set on this instance. This does not get any info from the database.
SPARQLQueryDefinition withUpdatePermission(String role, Capability capability)
Calls setUpdatePermissions(com.marklogic.client.semantics.GraphPermissions) then returns this instance for method chaining.
role - the name of the role receiving these capabilitiescapability - the capabilities (READ, UPDATE, or EXECUTE) granted to this roleString getBaseUri()
void setBaseUri(String uri)
set the base IRI for the query
uri - the base uriString[] getDefaultGraphUris()
void setDefaultGraphUris(String... uris)
Set the URI of the graph or graphs to use as the default graph. Use with SPARQL query only. If this parameter is used with SPARQL Update, it will cause an exception.
uris - the default graph urisString[] getNamedGraphUris()
void setNamedGraphUris(String... uris)
Set the URI of a named graph or graphs to include in the query or update operation. Use with SPARQL query only. If this parameter is used with SPARQL Update, it will cause an exception.
uris - the named graph urisString[] getUsingGraphUris()
void setUsingGraphUris(String... uris)
Set the URI of the graph or graphs to address as part of a SPARQL update operation. Use with SPARQL Update only. If this parameter is used with SPARQL query, it will cause an exception.
uris - the graph urisString[] getUsingNamedGraphUris()
void setUsingNamedGraphUris(String... uris)
Set the URI of a named graph or graphs to address as part of a SPARQL update operation. Use with SPARQL Update only. If this parameter is used with SPARQL query, it will cause an exception.
uris - the named graph urisvoid setConstrainingQueryDefinition(QueryDefinition query)
Set the search query used to constrain the set of documents included in the SPARQL query. Only meant to query unmanaged triples. The behavior is unspecified if used to query managed triples.
query - the constraining queryQueryDefinition getConstrainingQueryDefinition()
SPARQLQueryDefinition withConstrainingQuery(QueryDefinition query)
Set the search query used to constrain the set of documents included in the SPARQL query. Only meant to query unmanaged triples. The behavior is unspecified if used to query managed triples.
query - the query to use to constrainvoid setRulesets(SPARQLRuleset... ruleset)
Set the name of rulesets to include for inferring triples. Ruleset names can be those of the built-in rulesets, or user-managed rulesets stored in the schemas database.
ruleset - the names of the rulesets to useSPARQLRuleset[] getRulesets()
SPARQLQueryDefinition withRuleset(SPARQLRuleset ruleset)
Set the name of rulesets to include for inferring triples. Ruleset names can be those of the built-in rulesets, or user-managed rulesets stored in the schemas database.
ruleset - the name of the ruleset to usevoid setIncludeDefaultRulesets(Boolean include)
Set whether to include database-default inference or not. Default is true.
include - whether to include or notBoolean getIncludeDefaultRulesets()
SPARQLQueryDefinition withIncludeDefaultRulesets(Boolean include)
Set whether to include database-default inference or not. Default is true.
include - whether to include or notint getOptimizeLevel()
void setOptimizeLevel(int level)
Set a number indicating how much time for the query engine to spend analyzing a query. (See sem:sparql in the server-side XQuery API docs)
level - the optimization levelCopyright © 2013-2017 MarkLogic Corporation.