fujaba / org.fujaba.graphengine

This project's aim is to build a graph engine, that is able to build and compare graphs - and to match patterns and apply actions on the graph, to effectively use it as a graph-transformation framework.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

clarify what negative pattern elements really mean #11

Closed hoechp closed 7 years ago

hoechp commented 7 years ago

Previously, we decided to get rid of those sub-graphs inside of PatternGraph, which already made things a lot easier.

But it's not exactly clear to me, what negative pattern elements mean - at least not in every case.

PatternNodes, PatternEdgess and PatternAttributes have the action attribute, which usually should be "match", "create" or "remove". Additionally they all have the negative attribute, which only makes sense for those with action == "match". So probably, we could get rid of this negative attribute, too - and replace it with another value for the action attribute. It could just have "==", "!=", "+" and "-" as values, for example.

So to get to the point - my interpretation is:

hoechp commented 7 years ago

What I got wrong (here's an example): node with attribute 'type': 'Car' and edge to negative node with attributes 'type': 'Wheel' and 'color': 'blue' means "a car that has no blue wheel".

A negative node is not supposed to match with anything. Effectively, you look for a match of the rest of the Pattern - not minding the negative node. Whenever a match is then found, you try to find this negative node in context of the current match. If you don't find it - it's all fine. If you do find it, this match doesn't work out and the search continues with the next valid configuration of matchable nodes for the main pattern. Something like that. Gotta figure that out and write some tests!