Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] put Model-object as parameter?

Hi Jens,

I am not sure whether I fully understand what you want to do. If you want to set a specific object to be matched, you should pass it as a parameter or as part of a partial match to the RuleApplication.

If you want to pass a "type" to a rule that should be used for matching a particular node, then that is a different problem. This is not supported by the modeling language itself, but you can easily do this by a "dynamic rule adaptation" at runtime. Say you have an EClass "clazz" that you want to use as the type of a node called "x" in the left-hand side of a rule. Then you can use this code to dynamically adapt your rule:

Node node = rule.getLhs().getNode("x");
node.setType(clazz);

Then you must make sure that you use a fresh engine to apply this rule (necessary because engines cache metadata about rules). So this trick allows you to dynamically adapt rules. It works analogously for edges (references) and attributes.

Hope that helps.

Christian


On 11/13/2012 3:18 PM, Daniel Strüber wrote:
Hi Jens,

I guess that the Henshin keyword for this kind of use case is not "parameter", but "partial match".

Refer to "findMatches" at http://download.eclipse.org/modeling/emft/henshin/javadoc/nightly/org/eclipse/emf/henshin/interpreter/Engine.html

HTH,
Daniel


Am 13.11.2012 14:43, schrieb Jens Bürger:
Hello again,

I am currently planning my the code architecture for my application of Henshin. It would be easier if I could put a model object, for example a "CommunicationPath"-object of the UML2-metamodel, via parameter into a rule and do a match against it.

I thought this could work via naming the respective node after the input value, but it seems not the way it works.

Am I right that there is no possibility for using a concrete model object as a input parameter for a Henshin rule resp. node?

Thanks in advance,

Jens
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev





Back to the top