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

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
}

List

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

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.

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Thursday, 20 October 2011 13:05:44 UTC