Aggregation - delegating to RDF and using PATCH.

tl;dr:

we need to test whether the principle of "use standard RDF" features, 
works in practice for aggregations (weak containers).

Using RDF lists as aggregations can be made to work but their 
manipulation is complicated.  Is it acceptable?

-------------------------------

Our discussions need to both create an abstract model and also ensure 
such abstract concepts are practical and the consequences desirable.  We 
need examples of bytes-on-the-wire where details are realised and checked.

The discussions on links and creating new members in particular have 
been mainly "abstract".

One case being made is for aggregation to happen by using plain RDF so 
here is one example - what it might take to use SPARQL as a PATCH format 
on an aggregating LDP-R.

Some people want to be SPARQL-independent - in which case, there needs 
to be a proposal for the PATCH language.  Just posting some RDF triples 
to merge into a resource does not work.  Changesets can not deal with 
blank nodes [1]; changesets need to pull over the data first before 
update to calculate the change.

Accessing aggregation would be different to accessing containers.
The LDP spcec notes:
[[
In this way, LDPC avoids the use of RDF constructs like Seq and List for 
expressing order.
]]

so by saying that aggregation should use "standard" RDF, we are already 
suggesting clients need to treat containers / aggregations differently 
in some way.

So seqs or list?  Both are tricky to manipulate.  Seqs are not 
encouraged for new data:
http://www.w3.org/2011/rdf-wg/wiki/ArchaicFeatures#ISSUE-24:_Containers
There is no syntactic support for Seqs in Turtle.

Modifying remotely lists in RDF is tricky because of bNodes, because 
lists are encoded in RDF triples and not native to RDF (like they should 
be!).

Modifying sequences is tricky because of determining the new sequence 
number (and possibly moving all the old numbers if prepending).

To assess whether this WG really does want to go this way, here is an 
example of adding (prepend and append) to RDF lists in SPARQL Update. It 
requires detailed knowledge of the list encoding in RDF - they are not 
just Turtle syntax "(1 2 3)" any more.

Deleting lists is "fun" [2] as well.

 Andy

[1] The RDF-WG is working on skolemization - which makes bNodes 
addressable remotely.  But it requires support by the platform so should 
it be a requirement fro LDP?

[2]
http://seaborne.blogspot.co.uk/2011/03/updating-rdf-lists-with-sparql.html

-----------------------


PREFIX : <http://example/>
PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

CLEAR ALL ;

# Test data
INSERT DATA {
        :s1 :p (1 2) .
        :s1 :p () .
        :s2 :p (1 2) .
        :s2 :p () .
        :s3 :p (1 2) . # Ensure this is not touched.
        :s3 :p () .
} ;

# Prepend -- :s1
DELETE { :s1 :p ?list }
INSERT {
    # Insert new list element.
    :s1 :p [ rdf:rest ?list ; rdf:first 0 ] .
}
WHERE
{ :s1 :p ?list }
;

# Append (1) -- :s2 list, initially not empty.
DELETE { ?elt rdf:rest rdf:nil }
INSERT { ?elt rdf:rest (3) }
WHERE
{
   :s2 :p ?list .
   ?list rdf:rest* ?elt .
   ?elt rdf:rest rdf:nil .
}
;

# Append (2) -- :s2 list,  initially empty.
DELETE { :s2 :p rdf:nil }
INSERT { :s2 :p (3) }
WHERE  { :s2 :p rdf:nil } # Guard on existence.

----------------------------
Output:

@prefix :        <http://example/> .

:s2 :p     (3) , (1 2 3) .

:s3 :p     (1 2) , () .

:s1 :p     (0 1 2) , (0) .

----------------------------

Received on Wednesday, 19 December 2012 13:28:56 UTC