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.
|
java.lang.String |
getBaseUri() |
SPARQLBindings |
getBindings()
Get the child SPARQLBindings instance (normally
populated by calls to withBinding methods).
|
QueryDefinition |
getConstrainingQueryDefinition() |
java.lang.String[] |
getDefaultGraphUris() |
java.lang.Boolean |
getIncludeDefaultRulesets() |
java.lang.String[] |
getNamedGraphUris() |
int |
getOptimizeLevel() |
SPARQLRuleset[] |
getRulesets() |
java.lang.String |
getSparql()
Get the SPARQL query or update statement
|
GraphPermissions |
getUpdatePermissions()
Get any permissions set on this instance.
|
java.lang.String[] |
getUsingGraphUris() |
java.lang.String[] |
getUsingNamedGraphUris() |
void |
setBaseUri(java.lang.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(java.lang.String... uris)
Set the URI of the graph or graphs to use as the
default graph.
|
void |
setIncludeDefaultRulesets(java.lang.Boolean include)
Set whether to include database-default
inference or not.
|
void |
setNamedGraphUris(java.lang.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(java.lang.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(java.lang.String... uris)
Set the URI of the graph or graphs to address as
part of a SPARQL update operation.
|
void |
setUsingNamedGraphUris(java.lang.String... uris)
Set the URI of a named graph or graphs to
address as part of a SPARQL update operation.
|
SPARQLQueryDefinition |
withBinding(java.lang.String name,
java.lang.String value)
Bind a variable of type iri.
|
SPARQLQueryDefinition |
withBinding(java.lang.String name,
java.lang.String value,
java.util.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(java.lang.String name,
java.lang.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(java.lang.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(java.lang.String sparql)
Set the SPARQL query or update statement
|
SPARQLQueryDefinition |
withSparql(TextWriteHandle sparql)
Set the SPARQL query or update statement
|
SPARQLQueryDefinition |
withUpdatePermission(java.lang.String role,
Capability capability)
Calls
setUpdatePermissions(com.marklogic.client.semantics.GraphPermissions)
then returns this instance for method chaining. |
getCollections,
getDirectory,
setCollections,
setDirectory
getOptionsName,
getResponseTransform,
setOptionsName,
setResponseTransform
void setSparql(java.lang.String sparql)
sparql
- the SPARQL statementvoid setSparql(TextWriteHandle sparql)
sparql
- the SPARQL statementjava.lang.String getSparql()
SPARQLQueryDefinition withSparql(java.lang.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(java.lang.String name, java.lang.String value)
Bind a variable of type iri.
name
- the bound variable namevalue
- the iri valueSPARQLQueryDefinition withBinding(java.lang.String name, java.lang.String value, RDFTypes type)
Bind a variable of specified type.
name
- the bound variable namevalue
- the value of the literaltype
- the literal typeSPARQLQueryDefinition withBinding(java.lang.String name, java.lang.String value, java.util.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(java.lang.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 rolejava.lang.String getBaseUri()
void setBaseUri(java.lang.String uri)
uri
- the base urijava.lang.String[] getDefaultGraphUris()
void setDefaultGraphUris(java.lang.String... uris)
uris
- the default graph urisjava.lang.String[] getNamedGraphUris()
void setNamedGraphUris(java.lang.String... uris)
uris
- the named graph urisjava.lang.String[] getUsingGraphUris()
void setUsingGraphUris(java.lang.String... uris)
uris
- the graph urisjava.lang.String[] getUsingNamedGraphUris()
void setUsingNamedGraphUris(java.lang.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(java.lang.Boolean include)
include
- whether to include or notjava.lang.Boolean getIncludeDefaultRulesets()
SPARQLQueryDefinition withIncludeDefaultRulesets(java.lang.Boolean include)
include
- whether to include or notint getOptimizeLevel()
void setOptimizeLevel(int level)
level
- the optimization levelCopyright © 2024 MarkLogic Corporation. All Rights Reserved.