- From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
- Date: Tue, 24 Aug 2004 11:18:46 +0100
- To: www-rdf-interest@w3.org
On Tue, Aug 24, 2004 at 10:49:27 +0100, Andy Seaborne wrote: > > I think it actually becomes: > > > > select ?obj, ?objlabel > > where (<http://example.com/foo> ?prop ?obj) > > OPTIONAL (?obj ?tmp ?objlabel) > > (?tmp rdfs:subPropertyOf rdfs:label) > > > > an optional subgraph, c.f. http://www.w3.org/2001/sw/DataAccess/tests/ > > but that still breaks the rule of having variables that can only be > > bound > > in the optional part, but can, I think be expanded to something like: > > [using SQL+RDF and a subset of 3stores schema] > > The rule I think is needed is that a variable can't be bound in two separate > OPTIONALs - that causes the non-deterministic behaviour that Phil noted. > Variables can be bound in OPTIONALs (that's the point of them!) and binding > twice in one match is fine. Its the whole OPTIONAL block that > matches/doesn't match. > > Andy > > PS The new syntax is a bit clearer that there is one optional block in that > query. > > SELECT ?obj, ?objlabel > WHERE { <http://example.com/foo> ?prop ?obj . } > OPTIONAL > { ?obj ?tmp ?objlabel . > ?tmp rdfs:subPropertyOf rdfs:label } Yes, that is clearer, but I'm not comfortable with the new syntax, so I didnt want to use it. FWIW, the following example is wrong, its not clear yet wether this query can be forward chained into a single relational expression or not. > > SELECT t1.object, t2.object > > FROM triples t1 > > LEFT JOIN triples t2 ON > > (t2.subject = t1.object) > > LEFT JOIN triples t3 ON > > (t3.subject = t2.predicate AND > > t3.predicate = <rdfs:subPropertyOf> AND > > t3.object = <rdfs:label>) > > WHERE t1.subject = <http://example.com/foo> - Steve
Received on Tuesday, 24 August 2004 10:18:53 UTC