RDF Reification

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RDF Reification

Neil Stansbury-2
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
_______________________________________________
Mozilla-rdf mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-rdf
Reply | Threaded
Open this post in threaded view
|

Re: RDF Reification

harry-6
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
_______________________________________________
Mozilla-rdf mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-rdf
Reply | Threaded
Open this post in threaded view
|

Re: RDF Reification

Neil Stansbury-2
Harry, thanks for your thoughts. What's your thinking behind storing
whether it's an assert/unassert/modify?

What I was thinking was:

For each reificated triple, a timestamp is used to uniquely identify the
journaled triple itself:

urn:undo:utc-timestamp => rdf:subject => urn:abc
urn:undo:utc-timestamp => rdf:predicate => dc:Title
urn:undo:utc-timestamp => rdf:object => "current-value"
urn:undo:utc-timestamp => my:oldvalue => "old-value"

This allows me to identify any specific triple. A NULL value asserted in
the "my:oldvalue" predicate could equate to an unassert of the triple.

A journalled action may comprise any number of actual underlying
assertions therefore I also need to assert the journal action each entry
belongs to:

urn:undo:utc-timestamp => my:journal => "unique-journal-id"

Then like you suggested the action string:

unique-journal-id => dc:Title => "insert"

Probably as a localisable string uri.

Then I can call GetSources( "my:journal", "unique-journal-id" ); which
will give me all subjects that belong to that journalled action.

So I'd end up with:

unique-journal-id => dc:Title => "insert"
urn:undo:utc-timestamp => my:journal => "unique-journal-id"
urn:undo:utc-timestamp => rdf:subject => urn:abc
urn:undo:utc-timestamp => rdf:predicate => dc:Title
urn:undo:utc-timestamp => rdf:object => "current-value"
urn:undo:utc-timestamp => my:oldvalue => "old-value"


Though that's still 5 journalled triples for each underlying triple :¬(



Cheers,

N
_______________________________________________
Mozilla-rdf mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-rdf