<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sem.sparqlValues.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sem.sparqlValues</api:function-name><api:suggest>sem.sparqlvalues</api:suggest><api:suggest>sem</api:suggest><api:suggest>sparqlvalues</api:suggest><api:function-link mode="xquery" fullname="sem:sparql-values">/apidoc/8.0/sem:sparql-values.xml</api:function-link><api:function mode="javascript" name="sparqlValues" lib="sem" category="Semantics" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sem" namespace="http://marklogic.com/semantics" fullname="sem.sparqlValues"><api:summary>
		This function executes a SPARQL SELECT query using
		passed-in bindings participating as a starting point for 
		the query.
	</api:summary><api:params><api:param name="sparql" type="xs:string"><api:param-description>
		  The SPARQL query to be executed. Must be a SELECT query 
		  form.
	  </api:param-description><api:param-name>sparql</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="values" type="map:map*"><api:param-description>
		  A map containing initial bindings for variables 
		  used in the query.  Unlike <code xmlns="http://www.w3.org/1999/xhtml">sem:sparql</code>, a 
		  sequence of bindings is acceptable and will be processed 
		  as the equivalent of an outermost VALUES block in the query.
	  </api:param-description><api:param-name>values</api:param-name><api:param-type>Object[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
      Query options. Valid options values include:
      <blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
          <dt>
		    <b>"base=<em>IRI</em>"</b>
          </dt>
          <dd>
            The initial base IRI for the query.
          </dd>
          <dt>
            <b>"default-graph=<em>IRI</em>*"</b>
          </dt>
          <dd>
		  Add the named graph or graphs specified by the IRI to the default 
		  graph for the query.
          </dd>
          <dt>
            <b>"named-graph=<em>IRI</em>*"</b>
          </dt>
          <dd>
		  Add the named graph or graphs specified by the IRI to the list of 
		  named graphs available in the query.
          </dd>
          <dt>
		  <b>"optimize=<em>N</em>"</b>
          </dt>
          <dd>
		  Sets the optimization level to use. Levels of 0 (off), 
		  1, and 2 are recognized. Default is 1.	
          </dd>
         </dl>
      </blockquote>
    </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="store" type="item()*" optional="true"><api:param-description>
		Options for "any", "document", "properties", "locks", "checked", and 
		"unchecked" must be specified as part of <a href="./sem:store" xmlns="http://www.w3.org/1999/xhtml">
		<code>sem:store</code></a> not as part of <code xmlns="http://www.w3.org/1999/xhtml">sem:sparql-values</code>.  
		This parameter is designed to take <code xmlns="http://www.w3.org/1999/xhtml">sem:store*</code>, but is 
		typed as an <code xmlns="http://www.w3.org/1999/xhtml">item()*</code> for backward compatibility. The default 
		for <code xmlns="http://www.w3.org/1999/xhtml">sem:store</code> is the triples that can be inferred from 
		the rulesets. 
		<p xmlns="http://www.w3.org/1999/xhtml">
		The locking option specified in <code>sem:store</code> will be used 
		by <code>sem:sparql-values</code>. The default locking option for 
		<code>sem:store</code> is <code>read-write</code>; read-lock documents 
		containing triples being accessed, write-lock documents being modified. 
		Locking can also be set to <code>write</code>; only write-lock documents 
		being modified. The <code>sem:sparql-values</code> operation will run 
		with the locking option specified in <code>sem:store</code>. Locking is 
		ignored in a query transaction. 
		</p>
		<p xmlns="http://www.w3.org/1999/xhtml"> 
		If <code>sem:store</code> is a <code>cts:query</code>, 
		<code>sem:store</code> will use the default locking option (<code>read-write</code>).
		</p>
		<p xmlns="http://www.w3.org/1999/xhtml">
		If a <code>sem:store</code> value is not supplied then the default 
		<code>sem:store</code> for the statement will be used, and the default 
		locking is <code>read-write</code>. This has the same configuration 
		as calling <code>sem:store()</code> with all arguments omitted, 
		which will access the current database's triple index, using 
		the default rulesets  configured for that database.
        </p>
	</api:param-description><api:param-name>store</api:param-name><api:param-type>ValueIterator</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml"> If $values is an empty sequence, nothing is returned. </p>
  <p xmlns="http://www.w3.org/1999/xhtml"> A variable can be in both bindings and the VALUES clause. </p>
  <p xmlns="http://www.w3.org/1999/xhtml"> The binding variable must occur in either the SELECT clause
      or the triple patterns, otherwise an "Undefined variable" 
	  exception is thrown. </p>
  <p xmlns="http://www.w3.org/1999/xhtml">The <code>sem:sparql-values</code> 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. </p>
   </api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require("/MarkLogic/semantics.xqy");

var 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);

    </pre>
  </api:example></api:function></api:function-page>