MarkLogic Server 11.0 Product Documentation
cts.triples

cts.triples(
   [subject as (String | Number | Boolean | null | Array | Object)[]],
   [predicate as (String | Number | Boolean | null | Array | Object)[]],
   [object as (String | Number | Boolean | null | Array | Object)[]],
   [operator as String[]],
   [options as String[]],
   [query as cts.query?],
   [forest-ids as (Number|String)[]]
) as Sequence

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.

Parameters
subject 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.
predicate 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.
object 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.
operator 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 "=".

Operators include:

"sameTerm"
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.
"<"
Match range index values less than $value.
"<="
Match range index values less than or equal to $value.
">"
Match range index values greater than $value.
">="
Match range index values greater than or equal to $value.
"="
Match range index values equal to $value.
"!="
Match range index values not equal to $value.
options Options. The default is ().

Options include:

"order-pso"
Return results ordered by predicate, then subject, then object.
"order-sop"
Return results ordered by subject, then object, then predicate.
"order-ops"
Return results ordered by object, then predicate, then subject.
"quads"
Return quads that include values for the named graph that the triples are in. Requires the collection lexicon enabled.
"any"
Values from any fragment should be included.
"document"
Values from document fragments should be included.
"properties"
Values from properties fragments should be included.
"locks"
Values from locks fragments should be included.
"fragment-frequency"
Frequency should be the number of fragments with an included value. This option is used with cts:frequency.
"item-frequency"
Frequency should be the number of occurrences of an included value. This option is used with cts:frequency.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
"too-many-positions-error"
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.
"eager"
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.
"lazy"
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.
"concurrent"
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).
query Only include values in fragments selected by the cts:query, 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 "unfiltered" cts.search operations. If a string is entered, the string is treated as a cts:word-query of the specified string.
forest-ids 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 ().

Usage Notes

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".

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".

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.

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".

Example

cts.triples(sem.iri("http://subject"), sem.iri("http://predicate"), "object");
=>
 The triples with the given subject, predicate, and object.
Powered by MarkLogic Server | Terms of Use | Privacy Policy