Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] References to outside elements

Hi Johannes,

Am 15.09.2017 um 08:51 schrieb Johannes Groß:

Hi Daniel,

i was thinking about that and yes, i only want to reflect the outside model to a certain depth (e.g. say 1-level beyond the scope of the rule) to allow for the flexibility of the rule. But if i want to create an element that has a reference to an outside element, e.g. an InstanceSpecification that references a classifier already existing in a model or a loaded (non-changeable) library, would i have to add this classifier on the LHS and RHS (so it gets searched and the eReference set) or is there a different way to create eReferences to existing elements? 

In your example, yes, you would add a Classifier node to the LHS and RHS of the rule. You would also need create a mapping from the LHS node to the RHS node, to specify that it's the same node (shown as one <<preserve>> node in the visual syntax), rather than two different ones. 

See [1] for an intuitive example that includes the creation of an element with references from existing elements - I think it's very similar to what you want to do.

What I'm actually slightly confused about is the term "outside element".  The element in this example doesn't seem to be outside -- it's in the same model, and once you add it, it's also inside the rule. Would the term "context element"  make more sense to you?

BTW, library calls would be a dealbreaker for this approach, since Henshin assumes that all objects are EObjects. You would probably have to preprocess your model to represent library contents as EObjects.


[1] https://www.eclipse.org/henshin/examples.php?example=bank - Rule "createAccount"

Best regards,
Daniel

Thanks,

Johannes



Am 14.09.2017 um 19:34 schrieb Daniel Strüber:
Hi Johannes,

generally, you don't need to specify all elements of an input model - in fact, doing so would very much contradict the idea of rules, which are meant to be applicable to many different input models. At its core, a rule specifies (i) a pattern that is matched against (possibly much larger) input models, and (ii) some change actions to modify these models if a match was found.

Your use-case of generating rules from a UML model sounds like a very specialized use of rules. I think we could help you better if you could describe the context and purpose of your example rule in more detail.

Best regards,
Daniel



Am 14.09.2017 um 18:25 schrieb Johannes Groß:
Hi,
 
while generating henshin rules from an EMF based UML model, i am asking myself how to treat references (eReferences) to the rest of the model. 
So say i have an instance specification in my LHS and RHS that has a classifier, do i need to model this classifier in the rule as a node or is there a way to reference it as an "outside element"? 

Thanks,
Johannes


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev


Back to the top