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)
sparql - the SPARQL statementvoid setSparql(TextWriteHandle sparql)
sparql - the SPARQL statementString getSparql()
SPARQLQueryDefinition withSparql(String sparql)
sparql - the SPARQL statementSPARQLQueryDefinition withSparql(TextWriteHandle sparql)
sparql - the SPARQL statementvoid setBindings(SPARQLBindings bindings)
bindings - bindings to set as the child SPARQLBindings instanceSPARQLBindings getBindings()
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()
SPARQLQueryDefinition withUpdatePermission(String role, Capability capability)
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)
uri - the base uriString[] getDefaultGraphUris()
void setDefaultGraphUris(String... uris)
uris - the default graph urisString[] getNamedGraphUris()
void setNamedGraphUris(String... uris)
uris - the named graph urisString[] getUsingGraphUris()
void setUsingGraphUris(String... uris)
uris - the graph urisString[] getUsingNamedGraphUris()
void setUsingNamedGraphUris(String... uris)
uris - the named graph urisvoid setConstrainingQueryDefinition(QueryDefinition query)
query - the constraining queryQueryDefinition getConstrainingQueryDefinition()
SPARQLQueryDefinition withConstrainingQuery(QueryDefinition query)
query - the query to use to constrainvoid setRulesets(SPARQLRuleset... ruleset)
ruleset - the names of the rulesets to useSPARQLRuleset[] getRulesets()
SPARQLQueryDefinition withRuleset(SPARQLRuleset ruleset)
ruleset - the name of the ruleset to usevoid setIncludeDefaultRulesets(Boolean include)
include - whether to include or notBoolean getIncludeDefaultRulesets()
SPARQLQueryDefinition withIncludeDefaultRulesets(Boolean include)
include - whether to include or notint getOptimizeLevel()
void setOptimizeLevel(int level)
level - the optimization levelCopyright © 2013-2016 MarkLogic Corporation.