Set algebra using only RDF+HTTP (plus a teeny bit of SPARQL)

I've been trying to figure something out, in the context of simple
agents (though it's related to the DB update question). The core agent
operations of ASK and TELL /could/ be done over HTTP with a SPARQL &
GET/POST for ASK, and an RDF graph & PUT/POST for TELL.

But what I'm wondering is how far you can get with basic operations
using just RDF graphs over HTTP, treating the graphs more or less as
sets. From there, what else is needed to cover all the operations
you're likely to need (in a CRUDish kind of way).  I think I've got up
to, but not including, diff (a useful relative of set complement).

Given the following:

StoreL is a graph store local to the client (I picture it more as a
temporary container, floating in memory).
StoreR is a graph store remote from the client, and the name of the
graph in StoreR is uri.
A and B are RDF graphs.

"+" is graph merge (i.e. set union)
"-" is diff (i.e. something long-winded involving complements).
"{}" is the empty graph (i.e. empty set).

Assuming 200 Ok, unless 404 which is interpreted as {}.

Preconditions in all cases: StoreL = A, StoreR = B.
The body of messages (payload) will also be A.

So, slinging a few triples around:

1. http.GET(uri)
Postconditions: StoreL = B, StoreR = B

2. http.PUT(uri, A)
Postconditions: StoreL = A, StoreR = A

3. http.POST(uri, A)
Postconditions: StoreL = A, StoreR = A + B

4. http.DELETE(uri)
Postconditions: StoreL = A, StoreR = {}

I think that's sane so far. I don't think its worth worrying about
operations missing in StoreL (it's under local control). But what I
think is lacking, that would be nice to have is:

Postcondition: StoreL = A, StoreR = A - B

If you allow further processing at one end or the other then obviously
this could be doable in various ways (there are a few rdfdiff
processors around, allowing e.g. GET-diff-PUT). But what's the minimum
needed?

For the agent stuff I've been thinking about, I do want to use SPARQL
for ASK-like performatives (too sweet not to). Seems like having the
query capability could perhaps help with a (conceptually) simple way
of doing the diff.

Long shot : might there be a systematic way of building a SPARQL
CONSTRUCT from one graph (A) so that when applied to another graph (B)
returned the diff (or perhaps the complement of A, with B as the
universe). I suspect it may be doable with an fairly horrendous set of
FILTER clauses derived from the statements in A, but thought I'd check
to see if anyone else had looked around (or I'm missing something
obvious) before giving myself a headache...

Cheers,
Danny.

-- 

http://dannyayers.com

Received on Thursday, 31 August 2006 18:09:53 UTC