|Re: [henshin-user] parameterization of rules, require/preserve difference, time stopping|
Please find some comments in-line below…
Dr. rer. nat. Steffen Zschaler AHEA
King's College London
Department of Informatics
Phone +44 (020) 7848 1513
While I worked on a project with Henshin I stumbled upon a few problems and hope someone here can help me out.
1. Is there an option to parameterize rules in Henshin? Let's say I created a rule with Node A and Node B and they are connected through Edge C. Both Nodes have an Attribute 'ID' of the type int. Now there are times where I want to find all combinations, where Node A has the ID 1 and then there are times when I want to find all combinations, where Node A has the ID 2.
In the bank example I saw that it is possible to parameterize units, now I hope there is a way to do the same with rules.
Yes, that’s possible. Just click on the rule name and complete the text to a full signature. Note you will have to label each parameter as in, out, or var. You will also have to use Ecore types (EInt, EBoolean, EString, …) or types from your metamodel only.
2. My next problem is, that it seems to be impossible to create a rule where you only use <<require>> and <<forbid>> in combination. When I want Node A and Node B to exist (<<require>>) and the Edge C not to exist (<<forbid>>), the complete graph gets changed. As an example, just now it changed the annotation of Node A to <<forbid>> and the annotation of node B to <<delete>>.
This problem can only be fixed by using <<preserve>> instead of <<require>> (Or is there another way?). Could anyone tell me the reason behind that?
Only require and forbid on their own don’t really make sense. These define positive and negative application conditions, respectively, so your match would be empty. Using preserve elements you actually define a match for your rule.
3. This made me think about the matchmaking of Henshin, because there has to be a difference between <<require>> and <<preserve>>. Since I couldn't find documentation on how exactly the matching algorithm of Henshin works it would be great if someone here could clear that up for me. (If there is a documentation I missed, I would be grateful for a link)
There’s a good bit of documentation on the Henshin website. Generally speaking, Henshin implements standard graph matching, so if you learn about that, it will make your life understanding and using Henshin much easier.
4. Finally I tried to stop the time the searching procedure needs in my project. I used a stopwatch attempt (saving the start time, run procedure, saving end time). Since I don't want to run the program 50 times and note down the times, ich wrote a loop, that runs the attempt 50 times in a row. The problem is, that the time goes down each iteration. The time starts with reasonable 70 to 80 ms and ends with 10 ms. Normally this time stopping approach works quite well. That's why I would like to know, if there is some reason for this behaviour.
No idea what’s going on here…