I tend to think a new function is needed, because you said that you have the subjects and objects but want the predicate values. The predicate range index already exists for that, but there isn't a good accessor function yet. You could probably patch it yourself: if so, please create a pull request when you do.
Very little of the semantic library works without range indexes. So if it isn't throwing errors, it's probably configured correctly. I can't comment on SPARQL, sorry. But http://semtech2011.semanticweb.com/sessionPop.cfm?confid=62&proposalid=4015 might interest you. -- Mike On 31 May 2011, at 16:15 , Shah, Mehul (LNG-NPV) wrote: > Hi Mike/Jason, > > I really am not sure if sem:predicate-for-subject-object() is needed for > this, may be existing function for sem:object-for-subject-predicate() should > still work... I guess, need to do traversal of network starting at a given > node and identifying end and any cyclic situations? > > Do you/someone have/created any code related to this problem, that can be > shared? > > > Few related questions: > 1. Is there any information on how much MarkLogic can handle and some > indication on performance? > Say I have 1 million documents, with each document having some relation to > another 100 documents > How ML might perform to run sem:transitive-closure() function with 6 > generations deep > How ML might perform if I want to find all possible paths between document-A > and document-B. > > 2. If I have setup range-index for an element, is it same single range-index > definition that can work either I have that element (i.e. <s>, <o>, <p>) in > document or property? How do I verify a particular range index is working? > > 3. Is there any tool for SPARQL to XQuery conversion? Any future ML plan for > SPARQL support? > > > Thanks, > Mehul. > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Michael Blakeley > Sent: Friday, May 27, 2011 8:33 PM > To: General MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Semantic data and xquery help > > 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 > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
