W3C home > Mailing lists > Public > www-rdf-interest@w3.org > August 2004

Re: bc inferencing on optional query patterns

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Thu, 19 Aug 2004 09:22:05 +0100
To: www-rdf-interest@w3.org
Message-ID: <20040819082205.GA31147@login.ecs.soton.ac.uk>

Hi Phil,

On Thu, Aug 19, 2004 at 07:45:56 +0100, phil@phildawes.net wrote:
> E.g. take the following query, which gets all http://example.com/foo's
> props and objects, and if the object is a resource also gets an
> rdfs:label for it:
> 
> select ?obj, objlabel
> where    (<http://example.com/foo> ?prop ?obj)
> OPTIONAL (?obj rdfs:label ?objlabel)
> 
> I want to do subproperty inferencing on the optional pattern to return
> e.g. foaf:name labels (foaf:name is a subproperty of rdfs:label). 
> As in the 3store paper[1], I am using the idiom:
> 
> ?subj ?prop ?obj
> -> 
> ?subj ?tmp ?obj
> ?tmp SUBPROPERTYOF ?prop
> 
> 
> But that yields:
> 
> select ?obj, ?objlabel
> where    (<http://example.com/foo> ?prop ?obj)
> OPTIONAL (?obj ?tmp ?objlabel)
> OPTIONAL (?tmp rdfs:subPropertyOf rdfs:label)

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]

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 Thursday, 19 August 2004 08:22:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:57 UTC