- From: Steve Harris <steve.harris@garlik.com>
- Date: Tue, 29 Sep 2009 10:51:46 +0100
- To: Paul Gearon <gearon@ieee.org>
- Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
On 28 Sep 2009, at 17:15, Paul Gearon wrote: [snip] >> Naively (ignoring complexity problems), allowing ?p to take any >> value seems to produce more >> interesting use cases, especially in untidy real world data, where >> people might use different >> predicates interchangably, e.g: >> >> SELECT ?s ?ob1 ?ob2 ?p WHERE { >> ?s ?p* ?y . >> FILTER(?p = <:somePredicate> || ?p =<:someSimilarPredicate> ) . >> } > > Filtering is not binding, though it may often appear the have the same > effect (ignoring performance). This is a case that shows the > difference though. > > Does {?s ?p* ?o} bind every individual predicate transitively, or does > it treat all predicates as a group and search through the group > transitively? As an example, consider the following family: > > :fred : hasAncestor :mary > :mary : hasAncestor :anne > :mary :hasSibling :peter > :peter :hasSibling :harry > > If we treat each predicate individually, then we'd get the following > bindings: > ?s ?p ?o > :fred :hasAncestor :mary > :mary :hasAncestor :anne > :fred : hasAncestor :anne <-- new > :mary :hasSibling :peter > :peter :hasSibling :harry > :mary :hasSibling :harry <-- new That depends on the semantics of *, in regex it means "0 or more", so I'd expect to see :fred :hasAncestor :fred :mary :hasAncestor :mary etc. with ?p+ I'd expect to see what you have above. ?p* is useful for RDFS (and OWL?) style transitive properties though, as they have that semantics. > This could be useful for following many predicate chains at once, > though it doesn't offer significantly more functionality than doing a > union between the results of following each predicate individually. > Still, it's useful. > > If we treat the predicates as a group that can be transitive, then we > might see something like the following binding: > > ?s ?p ?o > :fred : hasAncestor :mary > :mary : hasAncestor :anne > :mary :hasSibling :peter > :peter :hasSibling :harry > :fred :hasAncestor :anne <-- new > :mary :hasSibling :harry <-- new > :fred :hasAncestor/:hasSibling :peter <-- new > :fred :hasAncestor/:hasSibling :harry <-- new ?p not taking a single value per row seems at odds with the SPARQL algebra to me. > P.S. in an earlier email I mistyped, and said our transitive > predicates costs Mulgara log(n) when I should have said n.log(n). But > you all knew what I meant, right? :-) Yup :) - Steve -- Steve Harris Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK +44(0)20 8973 2465 http://www.garlik.com/ Registered in England and Wales 535 7233 VAT # 849 0517 11 Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Tuesday, 29 September 2009 09:53:05 UTC