Loading TOC...


   [$options as xs:string*],
   [$query as cts:query?]
) as sem:store


The sem:store function defines a set of criteria, that when evaluated, selects a set of triples to be passed in to sem:sparql(), sem:sparql-update(), or sem:sparql-values() as part of the options argument. The sem:store constructor queries from the current database's triple index, restricted by the options and the cts:query argument (for instance, "triples in documents matching this query").

This function is a built-in.

options Options as a sequence of string values. Available options are:
Values from any fragment should be included.
Values from document fragments should be included.
Values from properties fragments should be included.
Values from locks fragments should be included.
Word positions should be checked when resolving the query.
Word positions should not be checked when resolving the query.
"size=number of MB"
The maximum size of the memory used to cache inferred triples. This defaults to the default inference size set for the app-server. If the value provided is bigger than the maximum inference size set for the App Server, an error is raised [XDMP-INFSIZE].
Don't apply the database's default rulesets to the sem:store.
read-write: Read-lock documents containing triples being accessed, write-lock documents being updated; write: Only write-lock documents being updated. Default is locking=read-write. Locking is ignored in query transaction.
query Only include triples in fragments selected by the cts:query. The triples 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.

Usage Notes

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

Options for "any", "document", "properties", "locks", "checked", or "unchecked" must be specified as part of sem:store, not as part of sem:sparql, sem:sparql-update, or sem:sparql-values.


xquery version "1.0-ml";

import module namespace sem = "http://marklogic.com/semantics"
      at "/MarkLogic/semantics.xqy";

sem:store((), cts:word-query("Alfa Romeo"))
Returns a sem:store() containing all of the triples that exist in documents
that match a query for "Alfa Romeo".

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.