AToMPM / atompm

A Tool for Multi-Paradigm Modeling
https://atompm.github.io/
GNU Lesser General Public License v3.0
22 stars 15 forks source link

Overlapping matches aren't handled correctly #113

Open AndreiBondarenko opened 3 years ago

AndreiBondarenko commented 3 years ago

ISSUE

When running a rule that has overlapping matches as an FRule the frontend doesn't produce an error, making it look as if all is well. However, the transformation engine raises following exception:

Exception in thread Thread-18:
Traceback (most recent call last):
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\messages.py", line 241, in to_label_mapping
    sourceNode = source_graph.get_node(self[label])
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\core\himesis.py", line 135, in get_node
    raise KeyError('Node not found with specified id. Make sure to only create nodes via Himesis.add_node(): ' + str(guid))
KeyError: 'Node not found with specified id. Make sure to only create nodes via Himesis.add_node(): 1ce09e75-0052-4ece-89d0-acefa03f5ab0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Andrei\Downloads\atompm-portable\platform\WinPython\WPy32-3830\python-3.8.3\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\mtworker.py", line 26, in run
    self._onmsg(self._msg)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\mtworker.py", line 217, in _onmessage
    getattr(self._ptcal,mode.lower())()
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 986, in step
    self._doWhenLastStepFeedbackReceived(self._step)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 169, in _doWhenLastStepFeedbackReceived
    utils.doWhen(
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\utils.py", line 20, in doWhen
    callback()
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 1089, in _step
    (res,ai) = runRule(nr)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\ptcal.py", line 1005, in runRule
    self.packet = ar.packet_in(self.packet)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\rules\frule.py", line 42, in packet_in
    packet = self.W.packet_in(packet)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\rewriter.py", line 46, in packet_in
    mapping = match.to_label_mapping(packet.graph)
  File "C:\Users\Andrei\Downloads\atompm-portable\AToMPM\mt\ptcal\pytcore\tcore\messages.py", line 243, in to_label_mapping
    raise Exception('The matched node %s does not exist' % label)
Exception: The matched node 2 does not exist

I think this should be handled by the pytcore's resolver?

HOW TO REPRODUCE?

Reproduce using following example:

Create a rule that looks as follows:

image

Schedule it as an FRule:

image

Apply the schedule to a model that has overlapping matches for aforementioned rule:

image

Observe as the rule is applied without producing an error in the frontend.