That sounds like a use-case for sem:predicate-for-subject-object(), which does not yet exist. It wouldn't be very difficult to build, though.
-- Mike On 27 May 2011, at 14:43 , Shah, Mehul (LNG-NPV) wrote: > With this Semantic examples, is there a function / XQuery to do following: > > Find all the paths between A and B nodes; paths indicates any predicate > values (friend, manager, student...etc). > > Thanks. > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Shah, Mehul > (LNG-NPV) > Sent: Friday, May 27, 2011 1:23 PM > To: General MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Semantic data and xquery help > > Thanks Mike! > > -mehul. > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Michael Blakeley > Sent: Thursday, May 26, 2011 11:34 PM > To: General MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Semantic data and xquery help > > Mehul, I believe the problem is that you are setting a filter that doesn't > match anything. Instead, use an empty sequence filter. That is, use () not ''. > > Here is how I would set this up: > > (: insert :) > import module namespace sem="http://marklogic.com/semantic" > at "semantic.xqy"; > > let $ifo := 'is-friend-of' > return ( > sem:tuple-insert('a', $ifo, 'b', ()), > sem:tuple-insert('b', $ifo, 'c', ()), > sem:tuple-insert('c', $ifo, 'd', ()), > sem:tuple-insert('c', $ifo, 'e', ()) > ) > => () > > (: foaf :) > import module namespace sem="http://marklogic.com/semantic" > at "semantic.xqy"; > > xdmp:set($sem:DEBUG, true()), > let $ifo := 'is-friend-of' > let $m := map:map() > let $do := sem:transitive-closure($m, 'b', 6, $ifo, true(), ()) > return $m > => > <map:map xmlns:map="http://marklogic.com/xdmp/map" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <map:entry key="e"> > <map:value xsi:type="xs:integer">4</map:value> > </map:entry> > <map:entry key="c"> > <map:value xsi:type="xs:integer">5</map:value> > </map:entry> > <map:entry key="d"> > <map:value xsi:type="xs:integer">4</map:value> > </map:entry> > <map:entry key="b"> > <map:value xsi:type="xs:integer">6</map:value> > </map:entry> > </map:map> > > -- Mike > > On 26 May 2011, at 10:04 , Shah, Mehul (LNG-NPV) wrote: > >> I am trying semantic example from >> http://marklogic.github.com/semantic/#DOCUMENT_FORMAT and >> http://marklogic.github.com/semantic/function-reference.html >> >> Does anyone have good sample data for this with N-triplets; and example >> semantic queries (using sem: functions) working on that. >> >> >> I manually created triplets like this. >> <A> <is friend of> <B> >> <B> <is friend of> <C> >> <C> <is friend of> <D> >> <C> <is friend of> <E> >> >> I tried to use following Xquery function: >> xquery version "1.0-ml"; >> >> import module namespace sem="http://marklogic.com/semantic" >> at "semantic.xqy"; >> >> let $m := map:map() >> sem:transitive-closure( $m, 'A', 3, 'is friend of', true(), "") >> return $m >> >> Output (it simply reflects my input starting node and generations): >> map:map( >> <map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:map="http://marklogic.com/xdmp/map"> >> <map:entry key="A"> >> <map:value xsi:type="xs:integer">5</map:value> >> </map:entry> >> </map:map>) >> >> >> >> I would like to get few working examples for FOAF(friend of friend) and some >> joins. >> >> >> Thanks, >> Mehul. >> >> >> >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
