Re: What is it that's wrong with rdf:List

On 20/06/2010 13:23, Andy Seaborne wrote:
> 
> 
> On 19/06/2010 10:05 PM, Pat Hayes wrote:
>>
>> On Jun 19, 2010, at 11:54 AM, Andy Seaborne wrote:
>>
>>>
>>>
>>> On 17/06/2010 11:35 PM, Paul Gearon wrote:
>>>> The main problem with an RDF list is that there is no mechanism in
>>>> SPARQL to query or update them. SPARQL only allows you to form queries
>>>> that explicitly describe connections, while an arbitrary list can have
>>>> any number of elements down its length. That means that you can refer
>>>> to, say, the 2nd, 3rd, or 4th elements in the list, but there is no
>>>> way to refer to ALL the elements in the list, since you don't know how
>>>> long the list is.
>>>>
>>>> SPARQL 1.1 will fix this problem with "property paths".
>>>
>>> with
>>>
>>> { <list> rdf:rest*/rdf:first ?x }
>>>
>>> this is only a partial solution:
>>>
>>> 1/ Order in a list is not preserved
>>
>> ? Preserved by what? Lists in RDF have an order (that is, the elements
>> of the list are put into an order by the list.) What is it that doesn't
>> 'preserve' this?
> 
> The SPARQL property path expression that Paul mentioned does not provide 
> any guarantee on order of results returned, nor do further operations of 
> the SPARQL algebra for graph patterns preserve order.  SPARQL looses the 
> ordering.  It can't properly return lists either, only members of a list.

I am absolutely not involved in, nor fully aware of, the work on SPARQL
1.1; but from my naive point of view, it seems to me that a further
extension of the syntax could help SPARQL 1.2 (or later) preserve the
order of lists. Imagine a syntax like

  { <list> rdf:rest[?index]/rdf:first ?x } ORDER BY ?index

where '[?var]' would mean '*', but would in addition assign to ?var the
*number* of rdf:rest arcs that were traversed to reach ?x.

It would do the trick. What I don't know is how easily it integrates
into SPARQL semantics, nor how hard it would be to implement...

  pa

Received on Wednesday, 23 June 2010 10:57:17 UTC