# Re: proposals for Lists and Seq (ISSUE-77)

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Fri, 21 Oct 2011 11:19:10 +0100
Message-ID: <4EA1471E.7020100@epimorphics.com>

```

On 20/10/11 14:05, Steve Harris wrote:
> On 2011-10-20, at 13:47, Sandro Hawke wrote:
>
>> On Thu, 2011-10-20 at 13:21 +0200, Dan Brickley wrote:
>>> On 20 October 2011 13:13, Steve Harris<steve.harris@garlik.com>  wrote:
>>>> I wouldn't be comfortable with marking Seq as "archaic" or similar unless there's a viable alternative, and I don't think List counts.
>>>
>>> Me neither.  Nor "quaint", "twee", "retro" or "regrettable". It's just
>>> what it is, with no great mystery or confusion.
>>
>> Actually, there's a great deal of confusion.  Please do explain -- in
>> one sentence for newbies -- why we have both Seq and List, and with Seq
>> better supported in RDF/XML and List better supported in Turtle, and how
>> someone should decide which to use.
>
> Seq has the advantage that it's much easier to query with SPARQL. Still not great, but much easier.
>
> Finding the 3rd member of a list:
>
> Seq
>
> SELECT ?m3
> WHERE {
>    <x>  rdf:_3 ?m3
> }

If you assume a notion of well-formedness: else:

:x rdf:_1 1 ;
rdf:_1 10 ;
rdf:_1 11 ;
rdf:_2 2 ;
rdf:_9 3 .

:-(

Maybe "well-formedness" for Seq and Lists is a useful way to go.

> List
>
> SELECT ?m3
> WHERE {
>    <x>  rdf:rest ?l2 .
>    ?l2 rdf:rest ?l3 .
>    ?l3 rdf:first ?m3 .
> }

0-based lists:

{ <x>  rdf:rest{2}/rdf:first ?m . }

> Finding all the members:
>
> Seq (if you have RDFS)
>
> SELECT ?m
> WHERE {
>    <x>  rdfs:member ?m .
> }
>
> List (if you have property paths)
>
> SELECT ?m
> WHERE {
>    <x>  rdf:rest*/rdf:first ?m .
> }
>
> If you don't have RDFS or SPARQL 1.1 PPs, then "find all members" is ugly in Seqs (you need a regex), and very hard for Lists, unless you know the maximum length of the list.
>
> It's possible to get all the Seq members in order, but it's a pretty nasty expression.

Understatement! It requires SPARQL 1.1 string bashing.

>
> - Steve
>

Andy
```
Received on Friday, 21 October 2011 10:19:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 22:02:01 UTC