op:pattern( $subjects as item()+, $predicates as item()+, $objects as item()+, [$systemCols as map:map*] ) as map:map
This function builds the parameters for the op:from-triples function. The result is passed to op:from-triples to project rows from the graph of triples. The columns in a pattern become the columns of the row. The literals in a pattern are used to match triples. You should specify at least one literal in each pattern, usually the predicate. Where a column appears in more than one pattern, the matched triples are joined to form the row. You can specify optional triples with a op:join-left-outer with a separate op:from-triples.
Parameters | |
---|---|
$subjects | One column or one or more literal values, such as the literal returned by a sem:iri call. |
$predicates | One column or one or more literal values, such as the literal returned by a sem.iri call. |
$objects | One column or one or more literal values, such as the literal returned by a sem:iri call. |
$systemCols | Specifies the result of an op:fragment-id-col or op:graph-col function to add columns for the fragment id or graph iri. |
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()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.