From: Rob V. <rv...@do...> - 2015-02-16 11:49:16
|
Max It's somewhat historical IGraph and ITripleCollection are coupled (loosely) and for performance reasons it was decided that rather than having a graph add a triple by first checking if it existing in the underlying triple collection and then if not adding it and triggering the event it instead just tries to add the triple and bubbles the added event should the triple collection produce it. The GraphChanged event was intended as a first class graph level event but as you note is probably mostly redundant, to some extend I would rather remove graph events as a core part of IGraph going forward (place them on an extra IEventedGraph interface that extends IGraph). 2.x decouples ITripleCollection and IGraph from an external API perspective though the default Graph implementation still uses it internally. I like the idea of having a single event a la the .Net ICollectionChanged interface I am strongly against having an Update() method on IGraph, I put one on IStorageProvider and with hindsight it was a mistake. If you have a method that can both add and remove triples then you have to define in what order you expect those operations to be implemented while having zero control (either as a user or internally within dotNetRDF) that a given implementation will actually follow the specification. That being said the existing batch Assert() and Retract() could do a better job of actually batching the events, currently they just dispatch to the single triple Assert() or Retract() overloads which is why you see multiple events. However I can't see any of this changing in 1.x as my policy for a while now is to do zero feature work on 1.x and focus my efforts when I can on 2.x. Rob From: Max - Micrologiciel <ma...@mi...> Reply-To: dotNetRDF Developer Discussion and Feature Request <dot...@li...> Date: Wednesday, 11 February 2015 17:27 To: dotNetRDF Developer Discussion and Feature Request <dot...@li...> Subject: [dotNetRDF-Develop] dotNetRDF API and refactoring > Hi all, > > Here are some points in the current API (and what is being refined/refactored > in the new 1.9 version) that I have wondered about for some time > > Specifically and currently about graph events, calling IGraph.Assert(Triple t) > would trigger a Graph.TripleAsserted and a Graph.Changed event > calling IGraph.Assert(IEnumerable<Triple> t) on 10 triples will trigger 10 > Graph.TripleAsserted and 10 Graph.Changed event > In the second case, wouldn't it be more efficient and clear (and simple for a > user) to trigger the 10 Graph.TripleAsserted events and only one overall > Graph.Changed event for the global additions ? > > Going that way it may also be useful to add a direct Update method in the > IGraph interface so both removals and additions can be notified with a single > Graph.Changed event, ins't it ? > > I know I could always derive from a specific IGraph implementation but should > it not be addressed directly in the base library (if deemed suitable) ? > > Max. > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/____________________________________________ > ___ dotNetRDF-develop mailing list dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop |