Re: RDF Reification

harry <[email protected]> Tue, 03 Jan 2006 00:47:35 +0100
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
I would say almost correct.
But you probably need also keep track of the action (assert, reassert, 
unassert)

Assert (Create) a new trible (undo  unasserts)
urn:undo:1 => undoredo:subject => urn:abc
urn:undo:1 => undoredo:predicate => dc:Title
urn:undo:1 => undoredo:action => "insert"
Note: I left out undoredo:oldobject because it's not required here.

Reassert (Modify) a trible (undo asserts old value)
urn:undo:2 => undoredo:subject => urn:abc
urn:undo:2 => undoredo:predicate => dc:Title
urn:undo:2 => undoredo:oldobject => "fred"
urn:undo:2 => undoredo:action => "edit"

Unassert (Delete) a trible (undo asserts old value)
urn:undo:3 => undoredo:subject => urn:abc
urn:undo:3 => undoredo:predicate => dc:Title
urn:undo:3 => undoredo:oldobject => "bob"
urn:undo:3 => undoredo:assert => "delete"

Well I believe you could replace:
undoredo:subject by rdf:subject
undoredo:predicate by rdf:predicate
undoredo:oldobject by rdf:object

undoredo is a your new custom prefix.


Good luck
   Harry


Neil Stansbury wrote:
> Hi all,
> 
> I am trying to write a journal/undo mechanism for RDF statements.
> 
> Considering the following arc:
> 
> urn:abc => #dc:Title => "bob"
> 
> Now if I change the arc's object from "bob" to "fred", I need to store 
> the old value to be able to undo later.
> 
> (Axel, perhaps you could correct me here) it doesn't seem possible to 
> identify a specific arc without the entire triple?
> 
> So I can't say the arc ID of "123456" last object was "bob", so first I 
> assert:
> 
> urn:abc => #dc:title => "fred"
> 
> Then to avoid arcs colliding, in a different datasource I assert:
> 
> urn:undo:1 => #undo => urn:abc
> urn:abc => #dc:title => "bob"
> 
> All is well and good until the arc is changed again - say from "fred" to 
> "mike"
> 
> First:
> urn:abc => #dc:title => "mike"
> 
> Then the journal assertion:
> 
> urn:undo:2 => #undo => urn:abc
> urn:abc => #dc:title => "fred"
> 
> But I already have an arc for "bob" so now I have no way of knowing 
> which arc belongs to which "undo" assertion.
> 
> Is this the kind of thing the RDF Reification Vocabulary could be used for?
> 
> Something like:
> 
> urn:undo:1 => rdf:subject => urn:abc
> urn:undo:1 => rdf:predicate => dc:Title
> urn:undo:1 => rdf:object => "bob"
> 
> urn:undo:2 => rdf:subject => urn:abc
> urn:undo:2 => rdf:predicate => dc:Title
> urn:undo:2 => rdf:object => "fred"
> 
> Not sure if this would be a correct way to use this vocab?
> 
> 
> In a similar vein, I'm intrigued when using the mozStorage interfaces 
> for RDF as discussed here: 
> http://wiki.mozilla.org/Mozilla2:Unified_Storage#RDF_Data_Store_interface
> How a triple in a datasource is going to be mapped to a "triple_id" in 
> the SQL when saving an assertion? Or is the intention to just use 
> nsIRDFXMLSerializer against an entire datasource rather than individual 
> arcs?
> 
> Cheers,
> 
> N