W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2009

SPARQL/Update and RDF collections

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Wed, 14 Oct 2009 18:04:29 +0000
To: "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
Message-ID: <B6CF1054FDC8B845BF93A6645D19BEA3693F7D4960@GVW1118EXC.americas.hpqcorp.net>
FYI: A user was asking on jena-dev about deleting lists:

http://tech.groups.yahoo.com/group/jena-dev/message/41798


He wants to delete lists (which in this case are compound data structures)

Accessing lists is not possible on SPARQL 1.0 pattern matching so you can't delete them either without something like property paths (or a property function that evaluates to find all list members but that's not going to common across implementations).

He came up with:

PREFIX f: <uri:f#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE {
  f:foo f:hasList ?list.
  ?node rdf:first ?member.
  ?node rdf:rest ?node2
}
WHERE {
  f:foo f:hasList ?list.
  ?list rdf:rest* ?node.
  ?node rdf:first ?member.
  ?node rdf:rest ?node2
}

RDF containers (Bag, Alt, Seq) can be done with 

  { <container> ?p ?o . FILTER (regex(str(?p), "http://www.w3.org/1999/02/22-rdf-syntax-ns#_\\d+$")) }

(string concat would be nice!)

	Andy

Received on Wednesday, 14 October 2009 18:05:41 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:40 GMT