Re: Pondering RDF Path

On Fri, 5 Sep 2003, Sean B. Palmer wrote:

>
> > Damian Steer has come up with an implementation of
> > an RDF path syntax as an addition to Saxon:
>
> That's interesting, especially in that it doesn't appear to conflate
> nodes and arcs since it uses RDF/XML's striping. But I wonder how it
> handles stuff such as
> <foaf:Person><foaf:knows><foaf:Person/></></>--will it make the
> internally nested Person available from the root, or does one have to
> //foaf:Person to get it? And if so, would //rdf:type match rdf:type as
> a node or an arc, or both? (I've not got Java on this box... will test
> shortly; I looked at the "README", which made some things clearer).

I hope Damian will reply to this - he has more documentation in
progress.
>
> > I really like the idea of an RDF path syntax, because I think
> > that it might enable the huge community of XSLT users to
> > get to grips with RDF quickly without dealing with the syntax,
> > and using the XML tools they are used to.
>
> Absolutely!
>
> > What I'd love to see is a mapping from (some subset of?)
> > RDF-path type queries to say Squish or RDQL
>
> I don't think that you can necessarily do it like that. For example,
> let's take the RDF-Path that I used in my previous email:-
>
> *[rdf:type/foaf:Person foaf:name/"Sean B. Palmer"]
> /foaf:knows/*[rdf:type/foaf:Person]/foaf:mbox/*
>
> As stated, this is equivalent to the following query:-
>
> ?x rdf:type foaf:Person .
> ?x foaf:name "Sean B. Palmer" .
> ?x foaf:knows ?y .
> ?y rdf:type foaf:Person .
> ?y foaf:mbox ?z .
>
> But it only returns ?z in the results. In fact, I'd go about it by

right, Damian just pointed this out to me.

> breaking the path up into a smaller set of queries and conditions.
> Here's how I'd do it, procedurally:-
>
> "*"
> Query all nodes, i.e. { ?nodeSubj ?arcPred ?nodeObjt }.
>
> "[rdf:type/foaf:Person "
> For each ?nodeSubj and ?nodeObjt in the bindings, assign to ?node, and
> query for {?node rdf:type foaf:Person}. For each ?node, continue if
> there are > 0 results.
>
> " foaf:name/"Sean B. Palmer"]"
> For each ?node, query for {?node foaf:name "Sean B. Palmer"}. For each
> ?node, continue if there are > 0 results.
>
> "/foaf:knows/*"
> Query for {?node foaf:knows ?objt}.
>
> "[rdf:type/foaf:Person]"
> For each ?objt, query for {?objt rdf:type foaf:Person}, and continue
> only if there are > 0 results.
>
> "/foaf:mbox/*"
> Query for { ?objt foaf:mbox ?mbox }, and return each ?mbox.
>
> Phew. So it's actually made up of lots of little queries and
> conditions. I'm not sure whether the compilation method would be
> faster or slower, and which is the best route to implementation.

I agree. I guess I was thinking that it would be interesting to attatch
the paths to a database. I use queries even for api-level stuff when it
comes to databases in my own implementation, so I'm kind of query
obsessed :)


> Perhaps I ought to try both and thne compare them. The former looks
> easiest, but flat RDF Queries are still pretty complicated things
> because you constantly have to sift through all of the triples, unless
> you've mapped masks in your Graph class, whereas in the Path
> case--with all the little queries and conditions--you're pruning away
> branches all the time.

good point.
>
> It's very interesting to compare the two, and I'm glad Graham brought
> it up so quickly.

It'll be interesting see how far we can go with this stuff.

Libby

Received on Friday, 5 September 2003 06:11:07 UTC