MarkLogic 10 Product Documentation
op:from-triples

op:from-triples(
   $patterns as map:map+,
   [$qualifier as xs:string?],
   [$graphIris as xs:anyAtomicType*],
   [$options as map:map?]
) as map:map

Summary

Reads rows by matching patterns in the triple index.

The rows have a column for each column name in the patterns. While each column will have a consistent datatype for all rows from a view, the columns of rows from a graph may have varying data types, which could affect joins.

This function creates a row set without a limit. Use op:limit or op:offset-limit to set a limit.

Parameters
$patterns One or more pattern definitions returned by the op:pattern function.
$qualifier Specifies a name for qualifying the column names. By default, triple rows have no qualification. Use cases for the qualifier include self joins. Using an empty string removes all qualification from the column names.
$graphIris A list of graph IRIs to restrict the results to triples in the specified graphs. The sem:default-graph-iri function returns the iri that identifies the default graph.
$options Options consisting of key-value pairs that set options. At present, the options consist of dedup which can take an on|off value to enable or disable deduplication. Deduplication is off by default.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $resource := op:prefixer("http://dbpedia.org/resource/")
let $foaf     := op:prefixer("http://xmlns.com/foaf/0.1/")
let $onto     := op:prefixer("http://dbpedia.org/ontology/")
let $person   := op:col("person")

return op:from-triples((
   op:pattern($person, $onto("birthPlace"), $resource("Brooklyn")),
   op:pattern($person, $foaf("name"), op:col("name"))))
   => op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy