W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2007


From: Lee Feigenbaum <lee@thefigtrees.net>
Date: Fri, 17 Aug 2007 01:52:49 -0400
Message-ID: <46C537B1.6040103@thefigtrees.net>
To: 'RDF Data Access Working Group' <public-rdf-dawg@w3.org>

We ran out of time in the telecon to examine this test in detail to 
determine why we are not passing it, so I promised this email.

default graph (complex-data-2.ttl)

@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf:       <http://xmlns.com/foaf/0.1/> .
@prefix ex:        <http://example.org/things#> .
@prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .

_:a rdf:type foaf:Person ;
     foaf:name "Eve" ;
     ex:empId "9"^^xsd:integer .

_:b rdf:type foaf:Person ;
     foaf:name "Alice" ;
     ex:empId "29"^^xsd:integer ;
     ex:healthplan ex:HealthPlanD.

_:c rdf:type foaf:Person ;
     foaf:name "Fred" ;
     ex:empId "27"^^xsd:integer .

_:e foaf:name "Bob" ;
     ex:empId "23"^^xsd:integer ;
     ex:healthplan ex:HealthPlanC.

_:f foaf:name "Bob" ;
     ex:empId "30"^^xsd:integer;
     ex:healthplan ex:HealthPlanB.

_:g rdf:type foaf:Person;
     ex:ssn "000000000";
     foaf:name   "Bert";
     ex:department "DeptA" ;
     ex:healthplan ex:HealthPlanA.

named graph (complex-data-1.ttl)

@prefix foaf:       <http://xmlns.com/foaf/0.1/> .

     foaf:mbox   <mailto:alice@example.net>;
     foaf:name   "Alice";
     foaf:nick   "WhoMe?";
     foaf:depiction   <http://example.com/alice.png> .

     foaf:mbox   <mailto:bert@example.net> ;
     foaf:nick   "BigB" ;
     foaf:name   "Bert" .

     foaf:mbox   <mailto:eve@example.net> ;
     foaf:firstName   "Eve" .

     foaf:mbox   <mailto:john@example.net> ;
     foaf:nick   "jDoe";
     foaf:isPrimaryTopicOf <http://example.com/people/johnDoe>


PREFIX  foaf:   <http://xmlns.com/foaf/0.1/>
PREFIX    ex:   <http://example.org/things#>
SELECT ?name ?plan ?dept ?img
     ?person foaf:name ?name
     { ?person ex:healthplan ?plan } UNION { ?person ex:department ?dept}
         ?person a foaf:Person
         GRAPH ?g {
             [] foaf:name ?name;
                foaf:depiction ?img


Let's do the UNION first. The result of the UNION is pairs of persons 
and plans and of persons and depts (one solution per line):

?person=_:b, ?plan=ex:HealthPlanD, ?dept=unbound
?person=_:e, ?plan=ex:HealthPlanC, ?dept=unbound
?person=_:f, ?plan=ex:HealthPlanB, ?dept=unbound
?person=_:g, ?plan=ex:HealthPlanA, ?dept=unbound
?person=_:g, ?plan=unbound, ?dept="DeptA"

This gets conjoined with ?person foaf:name ?name, which simply adds a 
name to each row:


Now, the RHS of the optional. The two parts of the RHS share no 
variables in common, so we can take their cross product. The lone triple 
pattern has solutions:


And the GRAPH clause has solution:


for a (simple) cross product of:


Now, we need to extend those solutions from above (the LHS) that are 
compatible with these from the RHS. The solutions with ?person=_:e and 
?person=_:f are both incompatible with all of these, so remain 
unchanged. The two _:g rows from the LHS are also unchanged since the 
name is a mismatch. Only the _:b row gets extended.


...which we then project out to:


Three of these solutions match what's already there, but the other two 
don't. The 4th solution as Chimezie wrote it down involves "Bert" and 
both a health plan and a department which doesn't make sense to me since 
only one or the other can be bound by the UNION in a single query.

Now, Eric's alternative answer to this is:

algae fails:
   - "Bert"|"DeptA"|<http://example.org/things#HealthPlanA>|NULL
   + "Bert"|NULL|<http://example.org/things#HealthPlanA>|NULL
   + "Bert"|"DeptA"|NULL|NULL

Which matches exactly. Checking in ARQ also matches this. (Though 
Glitter seems to have a bug. :-) )

Based on this analysis and implementation evidence, I'm checking in an 
updated version of the results. Please let me know what you think; we'll 
look at approving Chimezie's tests on Tuesday, along with others that 
remain. (A full recap to be posted to the list before Tuesday, of course.)

Received on Friday, 17 August 2007 05:52:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:00:51 UTC