sorry; seem to have lost some of that email somehow :s

correction:
then changed the transitivity options to T_DISTINCT, and removed
T_DIRECTION , removing it lets the optimizer pick what's best.

also here are some docs:

inference rules and reasoning in virtuoso:
http://docs.openlinksw.com/virtuoso/rdfsparqlrule.html

sql transitivity docs, virtuoso being what it is these are also good for
sparql of course - just specify in and out via filter as you are doing:
http://docs.openlinksw.com/virtuoso/transitivityinsQL.html

a blog from Orri on the subject of SQL transitivity that relates:
http://www.openlinksw.com/weblog/oerling/?id=1433

some tutorials demoing transitivity:
http://virtuoso.openlinksw.com/presentations/SPARQL_Tutorials/SPARQL_Tutorials_Part_3/SPARQL_Tutorials_Part_3.html#

regards!

Nathan wrote:
> give this one a go :)
> 
> SELECT ?x ?predicate ?y ?via ?dist ?path WHERE
> {
> { SELECT * WHERE { ?x rdf:type <http://bio2rdf.org/ns/obo#term> . ?x
> ?predicate ?y . filter( isURI(?y) ) . ?y rdf:type
> <http://bio2rdf.org/ns/obo#term> } }
> OPTION ( TRANSITIVE, T_DISTINCT, T_NO_CYCLES, t_in(?x), t_out(?y),
> t_min(1), t_max(4), t_step('path_id') as ?path, t_step(?x) as ?via,
> t_step('step_no') AS ?dist )
> . FILTER ( ?x = <http://bio2rdf.org/fma:27890> )
> }
> 
> changed it a bit:
> initial select you can see easily, just builds a set of all terms with
> links to other terms, then options to T_DISTINCT, and removed (let the
> optimizer pick what's best) - also changed the filter to hit fma:27890
> which I know links to 15 other terms thus should give a decent results set.
> 
> this little query shows us all the things with the most links:
> SELECT DISTINCT ?x count(?y) as ?c WHERE { ?x rdf:type
> <http://bio2rdf.org/ns/obo#term> . ?x ?predicate ?y . filter( isURI(?y)
> ) . ?y rdf:type <http://bio2rdf.org/ns/obo#term> } group by ?x order by
> desc(?c) limit 100
> 
> good for testing t_in start points :)
> 
> do hope that helps,
> 
> regards,
> 
> Nathan
> 
> Peter Ansell wrote:
>> How do I find arbitrary paths out from one URI to all other URI's it is 
>> linked to without specifying the predicate? I can make the following query 
>> work, but if I don't specify the predicate the query fails
>>
>> The following works, which is very nice, but I would like to have both the 
>> predicate and the object as unknowns.
>>
>> SELECT ?x ?y ?via ?dist ?path WHERE
>> {
>> { SELECT * WHERE { ?x <http://bio2rdf.org/ns/obo#is_a> ?y } }
>> OPTION ( TRANSITIVE, T_NO_CYCLES, t_in(?x), t_out(?y), t_min(1), t_max(6),
>> t_step('path_id') as ?path, t_step(?x) as ?via, t_step('step_no') AS
>> ?dist, T_DIRECTION 1 )
>> . FILTER ( ?x =
>> <http://bio2rdf.org/po:0009045> && isURI(?y))
>> }
>>
>> The following fails, even though I put in the filter to make sure that all 
>> possible ?y values would be URI's
>>
>> SELECT ?x ?predicate ?y ?via ?dist ?path WHERE
>> {
>> { SELECT * WHERE { ?x ?predicate ?y } }
>> OPTION ( TRANSITIVE, T_NO_CYCLES, t_in(?x), t_out(?y), t_min(1), t_max(6),
>> t_step('path_id') as ?path, t_step(?x) as ?via, t_step('step_no') AS
>> ?dist, T_DIRECTION 1 )
>> . FILTER ( ?x =
>> <http://bio2rdf.org/po:0009045> && isURI(?y))
>> }
>>
>> Thanks,
>>
>> Peter
>>
>>
>> ----- Original Message ----
>>> From: Nathan <[email protected]>
>>> Cc: Virtuoso Users List <[email protected]>
>>> Sent: Wed, 3 February, 2010 9:23:10 AM
>>> Subject: Re: [Virtuoso-users] Get all paths between two URIs with 
>>> transitivity..
>>>
>>> Nathan wrote:
>>>> Hi,
>>>>
>>>> Please see: http://bit.ly/9Gli76
>>>>
>>>> it always seems to show the T_SHORTEST_ONLY (shortest path) between two
>>>> nodes; any way to see all paths?
>>>>
>>>> SELECT ?x ?y ?via ?dist WHERE
>>>> {
>>>>  { SELECT * WHERE { ?x skos:broader ?y } }
>>>>  OPTION ( TRANSITIVE, t_distinct, t_in(?x), t_out(?y), t_max(10),
>>>> t_step(?x) as ?via, t_step('step_no') AS ?dist ) .
>>>>  FILTER ( ?x =
>>>> && ?y =
>>>>   )
>>>> }
>>>>
>>> I'm getting good at doing this.. figured it out; T_DISTINCT was limiting
>>> the results, thus I removed it, added in T_NO_CYCLES and then forced the
>>> direct to be the right way using T_DIRECTION 1, (which speeded up the
>>> query massively & stopped it running out of memory) - new query is as
>>> follows:
>>>
>>> SELECT ?x ?y ?via ?dist ?path WHERE
>>> {
>>> { SELECT * WHERE { ?x skos:broader ?y } }
>>> OPTION ( TRANSITIVE, T_NO_CYCLES, t_in(?x), t_out(?y), t_max(6),
>>> t_step('path_id') as ?path, t_step(?x) as ?via, t_step('step_no') AS
>>> ?dist, T_DIRECTION 1 )
>>> . FILTER ( ?x =
>>> && ?y =
>>> )
>>> }
>>>
>>> also has additional max steps / distance of 6 and path identifier added
>>> in so we can analyse each specific route.
>>>
>>> loving virtuoso! - still trying to get to the following end; so if you
>>> know a quicker way, do let me know.
>>>
>>> ps: docs on transitivity here:
>>> http://docs.openlinksw.com/virtuoso/transitivityinsQL.html
>>>
>>> nathan
>>>
>>>> whilst an "issue" this is only an interim query en-route to what I'm
>>>> trying to do; in reality what I want to do is find all paths between
>>>> multiple nodes and a route node which i specify (all paths between
>>>> ?category in(x,y,z) and Category:Main_topic_classifications) then find
>>>> the intersections with the shortest route; ie that if you follow the
>>>> skos:broader of the cat tree up you'll find that Category:Semantic_Web
>>>> and Category:HTML intersect at Category:World_Wide_Web so that one can
>>>> infer that when something has these two categories it is in the broader
>>>> topic of World_Wide_Web.
>>>>
>>>> If the aforementioned isn't an easy hit then just how to find all paths
>>>> will do the trick and I can UNION up some results and filter to get what
>>>> I want.
>>>>
>>>> Many Regards,
>>>>
>>>> Nathan
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>> Stay online with enterprise data centers and the best network in the 
>>>> business
>>>> Choose flexible plans and management services without long-term contracts
>>>> Personal 24x7 support from experience hosting pros just a phone call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Virtuoso-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>>>
>>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the 
>>> business
>>> Choose flexible plans and management services without long-term contracts
>>> Personal 24x7 support from experience hosting pros just a phone call away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Virtuoso-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>
>>
>>       
>> __________________________________________________________________________________
>> Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and 
>> for free at PLUS7. www.tv.yahoo.com.au/plus7
>>
>>
>>
> 
> 


Reply via email to