eMoflon / emoflon-ibex-democles

Incremental unidirectional and bidirectional graph transformations with the Democles pattern matching engine
GNU General Public License v3.0
1 stars 2 forks source link

Correct order of deletion in GT #64

Closed anthonyanjorin closed 6 years ago

anthonyanjorin commented 6 years ago

Hi Greg,

I now have an example where I can actually understand why Democles complains about the deletion:

deletionproblem

The problem is that the umsaetze edge is a composite edge. So deleting it means that the node u:Umsatz will be floating. As the edge umsatz is also a composite edge, everything would be fine if it would be created first before the vorgemerkt edge (a normal reference) is deleted. Democles chooses to delete vorgemerkt next, however, and complains of course because u:Umsatz is floating.

So what do you think? For a user's perspective a pattern specification cannot enforce the "correct" order so it would be fantastic if Democles could figure out the right thing to do here.

Thanks, Tony

gervarro commented 6 years ago

Hi Tony,

in my opinion, it is not the role of the pattern matcher to reorder the modification events. I would solve this problem at the application of a GT rule. I do not know, how deletions and insertions are currently carried out in Ibex (GT/TGG), but enforcing the following order (during GT rule application) would generally solve the problem: (1) delete regular edges, (2) delete containment edges (and nodes), (3) add (nodes and) containment edges, (4) add regular edges. If you already use Democles for red (and green) patterns (like in the original, compiled eMoflon variant), then a simple weight modification (weight of regular edges < weight of containment edges) should solve the problem in the deletion phase.

Bests, Greg

anthonyanjorin commented 6 years ago

Ok - that makes sense. Should be fairly easy to implement. Thanks for the tip!

anthonyanjorin commented 6 years ago

@patrickrobrecht Please adjust the red and green interpreters to work in the following order:

  1. delete regular edges,
  2. delete containment edges (and nodes),
  3. add (nodes and) containment edges,
  4. add regular edges.

Does this have to be corrected for TGGs too? Or do we reuse the same interpreters?

patrickrobrecht commented 6 years ago

There are different interpreters for GT and TGGs - due to use of different patterns (IBeXCreatePattern vs. IGreenPattern for the green part and IBeXDeletePattern vs. undoing the rule application).

patrickrobrecht commented 6 years ago

I created an issue for the TGG part: https://github.com/eMoflon/emoflon-ibex-democles/issues/66

During fixing that for GT I'll try to extract as much as possible into some EMFUtils class such that the interpreters for TGG can use that as well.