- From: Steve Harris <steve.harris@garlik.com>
- Date: Fri, 21 Oct 2011 12:01:52 +0100
- To: Andy Seaborne <andy.seaborne@epimorphics.com>
- Cc: public-rdf-wg@w3.org
On 2011-10-21, at 11:19, Andy Seaborne wrote: > > 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 . I don't see how that's an issue - there isn't a 3rd member in that case, which is a bit at odds with the mathematical definition of a Sequence, but a reasonable thing to want to model. > :-( > > Maybe "well-formedness" for Seq and Lists is a useful way to go. Perhaps, though I think it's fine as it is. Or at least not the biggest problem. >> 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 . } Oh, good point. >> 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. Yeah, a SUBSTR and an xsd:integer cast, ugly, but easier than getting the same information out of Lists. - 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 Friday, 21 October 2011 11:02:36 UTC