sem.sparqlValues( sparql as String, values as Object[], [options as String[]], [store as Sequence] ) as Sequence
This function executes a SPARQL SELECT query using passed-in bindings participating as a starting point for the query.
Parameters | |
---|---|
sparql | The SPARQL query to be executed. Must be a SELECT query form. |
values |
A map containing initial bindings for variables
used in the query. Unlike sem:sparql , a
sequence of bindings is acceptable and will be processed
as the equivalent of an outermost VALUES block in the query.
|
options |
Query options. Valid options values include:
|
store |
Options for "any", "document", "properties", "locks", "checked", and
"unchecked", which used to be part of the sem:sparql-values
signature, must be specified as part of
sem:store , not as part of
sem:sparql-values .
This parameter is designed to take sem:store* , but is
typed as an item()* for backward compatibility. The default
for sem:store is the current database's triple index, restricted by the options and the cts:query argument (for instance, "triples in documents matching this query").
The locking option specified in
If a |
If $values is an empty sequence, nothing is returned.
A variable can be in both bindings and the VALUES clause.
The binding variable must occur in either the SELECT clause or the triple patterns, otherwise an "Undefined variable" exception is thrown.
The sem:sparql-values
function performs a join
(SPARQL style, natural join) between the bindings returned
from the SELECT expression and the bindings passed in as
an argument, therefore the results reflect this join.
const sem = require("/MarkLogic/semantics.xqy"); const bindings = [ {"s": sem.iri("http://example.net/foaf.rdf#Lenovo_T61")}, {"s": sem.iri("http://example.net/foaf.rdf#Nokia_N80")} ]; sem.sparqlValues("select * where { ?s ?p ?o }", bindings);