<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.triples.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.triples</api:function-name><api:suggest>cts.triples</api:suggest><api:suggest>cts</api:suggest><api:suggest>triples</api:suggest><api:function-link mode="xquery" fullname="cts:triples">/apidoc/8.0/cts:triples.xml</api:function-link><api:function mode="javascript" name="triples" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Lexicon" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.triples"><api:summary>
  Returns values from the triple index. If subject, predicate, and object are
  given, then only triples with those given component values are returned. Triples can be
  returned in any of the sort orders present in the triple index.
</api:summary><api:params><api:param name="subject" type="xs:anyAtomicType*" optional="true"><api:param-description>
     The subjects to look up. When multiple values are specified, the query matches if any value matches. When the empty sequence is specified, then triples with any subject are matched.
  </api:param-description><api:param-name>subject</api:param-name><api:param-type>(String | Number | Boolean | null)[]</api:param-type></api:param><api:param name="predicate" type="xs:anyAtomicType*" optional="true"><api:param-description>
     The predicates to look up. When multiple values are specified, the query matches if any value matches. When the empty sequence is specified, then triples with any subject are matched.
  </api:param-description><api:param-name>predicate</api:param-name><api:param-type>(String | Number | Boolean | null)[]</api:param-type></api:param><api:param name="object" type="xs:anyAtomicType*" optional="true"><api:param-description>
     The objects to look up. When multiple values are specified, the query matches if any value matches. When the empty sequence is specified, then triples with any subject are matched.
  </api:param-description><api:param-name>object</api:param-name><api:param-type>(String | Number | Boolean | null)[]</api:param-type></api:param><api:param name="operator" type="xs:string*" optional="true"><api:param-description>
    If a single string is provided it is treated as the operator for the $object values. If a sequence
    of three strings are provided, they give the operators for $subject, $predicate and $object in turn.
    The default operator is "=".
    <p xmlns="http://www.w3.org/1999/xhtml">
      Operators include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
        <dt>"sameTerm"</dt>
        <dd>Match triple index values which are the same RDF term as $value.
        This compares aspects of values that are ignored in XML Schema comparison semantics,
        like timezone and derived type of $value.</dd>
        <dt>"&lt;"</dt>
        <dd>Match range index values less than $value.</dd>
        <dt>"&lt;="</dt>
        <dd>Match range index values less than or equal to $value.</dd>
        <dt>"&gt;"</dt>
        <dd>Match range index values greater than $value.</dd>
        <dt>"&gt;="</dt>
        <dd>Match range index values greater than or equal to $value.</dd>
        <dt>"="</dt>
        <dd>Match range index values equal to $value.</dd>
        <dt>"!="</dt>
        <dd>Match range index values not equal to $value.</dd>
      </dl></blockquote>
  </api:param-description><api:param-name>operator</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    Options.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">
      Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
        <dt>"order-pso"</dt>
        <dd>Return results ordered by predicate, then subject, then object.</dd>
        <dt>"order-sop"</dt>
        <dd>Return results ordered by subject, then object, then predicate.</dd>
        <dt>"order-ops"</dt>
        <dd>Return results ordered by object, then predicate, then subject.</dd>
        <dt>"quads"</dt>
        <dd>Return quads that include values for the named graph that the
        triples are in. Requires the collection lexicon enabled.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.
	To get accurate results from <code>item-frequency</code> with
	<code>cts:triples</code>, enable the
	<code>triple positions</code> index.
	</dd>
	<dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"too-many-positions-error"</dt>
        <dd>If too much memory is needed to perform positions calculations
        to check whether a document matches a query, 
        return an XDMP-TOOMANYPOSITIONS error, 
        instead of accepting the document as a match.</dd>
        <dt>"eager"</dt>
        <dd>Perform work concurrently whilst returning triples from the index -
        buffering some results into memory.
        This usually takes the shortest time when returning a complete
        result.</dd>
        <dt>"lazy"</dt>
        <dd>Perform only some the work concurrently before returning 
        the first triple from the index, and most of the work
        sequentially while iterating through the rest of the triples.
        This usually takes the shortest time when returning a partial result.
        </dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon
        processing occurs.  This is especially useful in cases where multiple
        lexicon calls occur in the same query (for example, resolving many
        facets in a single query).</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="query" type="cts:query?" optional="true"><api:param-description>
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>,
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query,
    but instead selected in the same manner as <a href="#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.  If a string
   is entered, the string is treated as a <code xmlns="http://www.w3.org/1999/xhtml">cts:word-query</code> of the
   specified string.
  </api:param-description><api:param-name>query</api:param-name><api:param-type>cts.query?</api:param-type></api:param><api:param name="forest-ids" type="xs:unsignedLong*" optional="true"><api:param-description>
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </api:param-description><api:param-name>forest-ids</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "eager" or "lazy" may be specified
  in the options parameter.  If neither "eager" nor "lazy"
  is specified, then the default is "lazy".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks"
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "order-pso", "order-sop", or "order-ops"
  options may be specified in the options parameter.
  If none is specified, then the default is chosen to most efficiently retrieve
  the required values.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter.
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts.triples(sem.iri("http://subject"), sem.iri("http://predicate"), "object");
=&gt; 
 The triples with the given subject, predicate, and object.
</pre></api:example></api:function></api:function-page>