Hi Florian, |
thanks for your question.
On 13.08.2018 16:46, Florian Kunz
This is more or less about how EMF works. There are two ways of
dealing with models with EMF: Static and dynamic EMF. In the bank
example, for easy deployment, we use dynamic EMF. That is, the
meta-model is loaded from an XMI file, rather than from an Eclipse
plug-in (as in static EMF).
recently I started my
first Project with henshin. The goal of the project is to
enable a user to model an environment based on a given meta
model. Within the modelled environment predefined patterns
will be searched. If a pattern or several patterns are found
the name of the pattern as well as the name attribute of the
nodes will be displayed.
To do this I started
with the henshin tutorial project, where you model a simple
bank. To look for a pattern in the given example-bank.xmi
file I made a simple henshin rule and used the following
rule, graph, null);
The result is exactly
what I am looking for, but the list of objects I receive is
of the type Match and all the nodes in a single match are of
the type âDynamicEObjectImplâ. From this type I canât get
access to the name attribute or other attributes. I am
looking for a way, to access all attributes of the found
Since we use dynamic EMF, all model elements have the type "DynamicEObjectImpl". All required information can be
retrieved by using reflection: First, get the EClass of the DynamicEObjectImpl by using the .eClass()Â method of
the object. The EClass has methods to retrieve all attributes, and
to retrieve a specific attribute based on its name. Finally, you
can get the attribute values of your DynamicEObjectImpl by using
its .eGet(attribute) method.
In real use-cases of Henshin, you normally avoid the nastiness of
dealing with reflection, by using static EMF in the first place. In
the bank example, you would have "Bank" and "Customer" objects
rather than "DynamicEObjectImpls".
Generally, you can find information on Henshin's usage on the Wiki:
https://wiki.eclipse.org/Henshin The particular questions seems to
be more of an EMF question.
I hope this is the right
address to solve this problem, because there isnât much help
for henshin to be found. If I am mistaken here it would be
greatly appreciated, if you could tell me, where I can find
help for using henshin.
henshin-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit