Re: [AccessingRdfLists] relationship with property paths?

Seaborne, Andy wrote:

> 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.

Oops.

> If ?list is bound it would work.

...which it probably is in many (most?) examples of this.

> As would: 
> SELECT DISTINCT ?member { ?list rdf:rest*/rdf:first ?member }
> 
> including as a sub-query.

Ah, I see.

Andy, ARQ returns the list items in order when you use list:member, 
right? If we were to defer on this issue in favor of property paths, 
that might be a point in favor of some solution to the issue that David 
Newman rose on the teleconference earlier: is there a way with property 
paths to specify that the results should come back in an order that's 
related to where things appear in the matched path?

Lee

Received on Tuesday, 17 March 2009 18:06:57 UTC