Re: Querying reified statements

I've been experimenting recently with a query language that takes queries of
the form:

    select  ?age where {?x ?y {age JohnSmith ?age}}

which behind the scenes results in a query:

    select ?age where {?x ?y ?z} and {rdf:type ?z rdf:Statement} and
{rdf:subject ?z JohnSmith}
                and {rdf:predicate ?z age} and {rdf:object ?z ?age}

Similarly, inner triples are assumed to refer to reified statements in
insert, delete, infer, and other commands. Additional nesting of triples is
allowed (i.e. he says she says such and such).  This seems to be a pretty
natural representation and works well in practice.

rgds,

Geoff Chappell
----- Original Message -----
From: "Libby Miller" <Libby.Miller@bristol.ac.uk>
To: "David Allsopp" <dallsopp@signal.dera.gov.uk>
Cc: <www-rdf-interest@w3.org>
Sent: Wednesday, December 13, 2000 7:46 AM
Subject: Re: Querying reified statements


>
>
> On Wed, 13 Dec 2000, David Allsopp wrote:
>
> >
> > But if I wanted a query along the lines of "What do people say John
> > Smith's age is?" I would need something like:
> >
> >   select ?a where (?x rdf:type Statement)(?x rdf:subject JohnSmith)(?x
> > rdf:predicate age)(?x rdf:object ?a)
> >
> > which even for this trivial example is getting complex.  I'd like a way
> > of 'drilling down' through reification, possibly through multiple layers
> > (A says that B says that John Smith is 42...).
>
> Hi David,
>
> You're right, this is a real nuisance, especially since queries like
> this also tend to be inefficient, because rdf:type statement,
> rdf:subject will be very common if you're dealing with a lot of reified
> statements.
>
> >
> > Perhaps the solution is to 'flatten' an RDF model containing reified
> > statements (applying filters according to the origin of the statements
> > or other criteria) to generate a model without any reifications, which
> > can be queried easily.
>
> I was trying to think around this problem, but I haven't bee able to
> work out how it can be done. If we have
>
> [bag1]-- 1 -- [Statement1]
> --- subject
> --- predicate
> --- object
>
> there's no obvious way to flatten it, because without reifying the
> statement there's no way to refer to the statement rather than its
> constituents. So it looks as if you can't connect parts of the model
> together unambiguously.
>
> I'd be very interested in any ideas you have about how to tackle this.
>
> On the plus side though, it does mean that you can have very general
> queries about a resource if you have lots of reified statements in a
> database, because e.g.
>
>    select ?z, ?a where (?x rdf:type Statement)(?x rdf:subject
> JohnSmith)(?x rdf:predicate ?z)(?x rdf:object ?a)
>
> will get you all the predicate-object pairs with JohnSmith as the
> subject.
>
> cheers,
>
>
> Libby

Received on Wednesday, 13 December 2000 08:30:46 UTC