Hi, Thank you.
Do you mean the SavingChanges eventhandler on BrightstarEntityContext or on IDataObjectStore.
if it is the handler on BrightstarEntityContext - how do I get access to the triples?
It's the IDataObjectStore SavingChanges event that you need to handle.
if it is IDataObjectStore, do I need create an instance of RestDataObjectContext and then call CreateStore/OpenStore, passing the mapping dictionary, is that correct?
Don't worry about the mapping dictionary unless you really want to use it from your code. The EntityFramework uses full URIs (even if you define prefixes in assembly attributes - these get resolved by the EF) so it doesn't need the mapping dictionary.
And in the event should I use the 'AddTriples' Collection?
How would the update and delete work in this case?
You also need to process the DeletePatterns collection as this will list triples being removed (an update is just a delete followed by an add). Delete patterns can include the wildcard URI (BrightstarDB.Constants.WildcardUri) which is like having a * wildcard
for subject, predicate or object. Typically from the EF if you set a update a property you will get a delete pattern of <s> <p> * and an AddTriple of <s> <p> v (where <s> and <p> are subject and predicate URIs, * is the
wildcard URI and v is the new value). If you delete an object you will get a delete pattern of <s> * *.
If you see a delete pattern with no wildcards that matches one of your predicates (e.g. <s> <p1> <v>) then it is a simple matter to just add the inverse also to the deletion (<v> <p2> <s>). It shouldn't be too hard to handle
the wildcards. A delete pattern of <s> <p1> * would mean you need to add another delete pattern of * <p2> <s>. A delete pattern of <s> * * would probably mean that you need to add * <p1> <s> and * <p2><s>
to the delete patterns as the deleted object could be the target of either of those predicates (depends on if it is a movie or a person).
AddTriples never have wildcards so it is much easier - if you see <s> <p1> <v> in AddTriples then you also need to add <v> <p2> <s> (and of course vice-versa). Don't worry about duplicating stuff, RDF doesn't care if you
add the same triple multiple times, it still only exists once.
And as update is just delete followed by add, once you have these two basic cases covered, update comes for free! :)
I think that covers it - let me know how it goes!