Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] SPARQL for distance

Martin O'Connor martin.oconnor at stanford.edu
Wed Mar 25 13:48:53 PDT 2009


I'm also not fully sure what you are getting at, but you could use the 
swrlm:eval SWRL built-in [1] to calculate the distance between pairs of 
individuals, e.g.,

Person(?p1) ^ Person(?p2) ^ differentFrom(?p1,?p2) ^
hasX(?p1,?x1) ^ hasY(?p1,?y1) ^ hasX(?p2,?x2) ^ hasY(?p2,?y2) ^
swrlm:eval(?d, "sqrt(pow(x1-x2, 2) + pow(y1-y2, 2))", ?x1, ?y1, ?x2, ?y2)
-> sqwrl:select(?p1, ?p2, ?d)

Martin

[1] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTabMathematicalBuiltIns

James Howison wrote:

>Yeah, I'm not entirely sure what you are getting at, concrete data  
>with real semantics in Turtle format usually helps.  Otherwise we're  
>left reconstructing what your data might look like on the basis of  
>your queries ...
>
>I could be well off base, but you might want to look at property  
>paths, a recent extension to the ARQ SPARQL syntax.
>
>http://seaborne.blogspot.com/2008/07/arq-property-paths.html
>
>I suspect, though, that you'd be better off with simpler queries,  
>after using OWL restrictions and/or SWRL rules to encode/introduce the  
>semantics that you are getting at.
>
>--J
>
>On 25 Mar 2009, at 4:16 PM, Pitonyak, Andrew D wrote:
>
>  
>
>>I want to obtain all "triples" of distance one, two, or three from a  
>>set of individuals.  For example, the following two queries provide  
>>the set of distance one and then distance two from two individuals.  
>>I was hoping for an easier way...
>>
>>For distance 1, I can use things such as:
>>
>>SELECT DISTINCT ?x ?y ?z
>>WHERE {
>> ?x ?y ?z
>> FILTER (
>>   STR(?x) = "http://wow#Person1" ||
>>   STR(?z) = "http:// wow#Person1" ||
>>   STR(?x) = "http://wow#Person2" ||
>>   STR(?z) = "http:// wow#Person2"
>> )
>>}
>>
>>For distance two, I can use something such as:
>>
>>SELECT DISTINCT *
>>WHERE {
>> ?x ?y ?z .
>> ?z ?a ?c
>> FILTER (
>>   STR(?x) = "http://wow#Person1" ||
>>   STR(?z) = "http:// wow#Person1" ||
>>   STR(?x) = "http://wow#Person2" ||
>>   STR(?z) = "http:// wow#Person2"
>> )
>>}
>>
>>
>>--
>>Andrew Pitonyak
>>_______________________________________________
>>protege-owl mailing list
>>protege-owl at lists.stanford.edu
>>https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>
>>Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>    
>>
>
>_______________________________________________
>protege-owl mailing list
>protege-owl at lists.stanford.edu
>https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
>Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>
>  
>




More information about the protege-owl mailing list