You can use the sem:transitive-closure function from the sem library to walk the graph relations where s => o and o=>s. From there you can collect all the subjects and use that as a query.
http://docs.marklogic.com/sem:transitive-closure 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) Another option is the my transitive library that I am actively maintaining on github that provides some higher level API aligned with XPATH like function calls https://github.com/garyvidal/ml-libraries/tree/master/transitive >Sir, > >Is there any way we can get the paths between two entities in a semantic graph. > >For example, > >If <a> isA <alphabet> , <b> isA <alphabet> then the path is <a> <-> <alphabet> ><-> <b>. > >Same way for <a> partOf <OddWord> partOf <AllWords> , <a> partOf <EvenWord> >partOf <AllWords> .... the path is <a> <-> <OddWord> <-> <AllWords> <-> ><EvenWord> <b> > >Any way we can use semantic query construct to fetch the path like this.. > >It is a finding paths in a graph as we studies in Data Structures with the >context of semantic graphs. _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general