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

Pitonyak, Andrew D PitonyakA at BATTELLE.ORG
Wed Mar 25 13:16:30 PDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20090325/da7247d7/attachment.html>


More information about the protege-owl mailing list