RE: [AccessingRdfLists] relationship with property paths?

> -----Original Message-----
> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-
> request@w3.org] On Behalf Of Lee Feigenbaum
> Sent: 17 March 2009 17:40
> To: SPARQL Working Group
> Subject: [AccessingRdfLists] relationship with property paths?
> 
> I'd like to start having some discussion of other query language
> features - we'll come back to them on the teleconference, but next week
> I think we might turn our attention to some other issues (construct
> maybe, or protocol issues).
> 
> One thing that came up in IRC at one point was whether or not the
> property paths feature suggestion would cover the use cases in
> AccessingRdfLists. I believe the answer is "not easily", but wanted to
> bring it up here.
> 
> This feature is about making it easy to query for members of an RDF
> list. ARQ supports this via a "property function" -- a URI that when
> used in a SPARQL triple pattern has semantics other than standard
> graph-pattern matching.
> 
> EricP has a suggestion for an alternative way of doing this.
> 
> My personal belief is that this is mildly useful, but not essential, and
> I'm a bit worried about the two potential approaches:
> 
> + property functions seem to be somewhat "magical" in their behaviour

Good point.  Property functions are good for independent evolution but if this is about standardization, then explicit syntax can be done.

> + new syntax that is not widely implemented always makes me nervous
> 
> If I had to straw poll myself on this issue, I'd be a "0".
> 
> Anyway, I'm interested in how others feel, any other implementation
> experience, and whether or not this feature can be accomplished via
> property paths.
>  
> Lee

That's a slight catch to know about with a query like:

PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT * { ?list rdf:rest*/rdf:first ?member }

Because if the data is:
---- Data:
("A" "B" "C") .

Which is in triples:
---- Same data:
_:b1      rdf:first  "A" .
_:b1      rdf:rest  _:b2 .
_:b2      rdf:first  "B" .
_:b2      rdf:rest  _:b3 .
_:b3      rdf:first  "C" .
_:b3      rdf:rest  rdf:nil .
----

The results are:

-----------------
| list | member |
=================
| _:x0 | "B"    |
| _:x0 | "C"    |
| _:x1 | "A"    |
| _:x1 | "B"    |
| _:x1 | "C"    |
| _:x2 | "C"    |
-----------------

That's 3*"C", 2*"B" and 1*"A" because the tail of the RDF list is itself a list.

If ?list is bound it would work.

As would: 
SELECT DISTINCT ?member { ?list rdf:rest*/rdf:first ?member }

including as a sub-query.

 Andy

Received on Tuesday, 17 March 2009 17:55:14 UTC