Loading TOC...

sem:transitive-closure

sem:transitive-closure(
   $seeds as sem:iri*,
   $predicates as sem:iri*,
   $limit as xs:integer
) as sem:iri*

Summary

From a starting set of seeds, follow a given set of predicates, to a given depth, and return all unique node IRIs.

Parameters
$seeds A set of seed IRIs.
$predicates A set of predicates to follow.
$limit A limit of how many predicates to follow.

Example

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";

sem:transitive-closure(
    sem:iri("http://www.w3.org/People/Berners-Lee/card#i"),
    sem:iri("http://xmlns.com/foaf/0.1/knows"),
    9)
=>
http://www.w3.org/People/Berners-Lee/card#i
    

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