Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Some rules work other don't(I have 2 similar rules, one is working as expected the other no.)
Some rules work other don't [message #1760384] Wed, 26 April 2017 14:35 Go to next message
Martin Paquin is currently offline Martin PaquinFriend
Messages: 21
Registered: July 2014
Junior Member
HI,

I don't understand why the transformMessageDetail rule work and not transformLibrary rule.
Both elements exist in the source model.
rule createSystem
    transform s : XAmm!XARepo
    to o: GENmm!GSystem {
        o.name = s.libname(); // a custom operation not in listing
        o.packages = s.libraries.equivalent();
        o.userMessages = s.messageDetails.equivalent();
}

// this rule work as expected.
rule transformMessageDetail
    transform i: XAmm!XAMessageDetail
    to userMessage: GENmm!GUserMessage {
            userMessage.key = i.msgId;
            userMessage.text = i.text;
}
 
// library are not transform.   
rule transformLibrary
    transform i: XAmm!ILibrary
    to  userMessage: GENmm!GPackage {

}
Re: Some rules work other don't [message #1760385 is a reply to message #1760384] Wed, 26 April 2017 14:39 Go to previous messageGo to next message
Eclipse UserFriend
If it is a parent EClass of some other subclasses (extends relationship), then you have to annotate your rule with @greedy to make sure that all items of its subtypes are also handled by the rule.
Re: Some rules work other don't [message #1760386 is a reply to message #1760385] Wed, 26 April 2017 14:44 Go to previous messageGo to next message
Eclipse UserFriend
At the second thought, I had a feeling that you also need to share the metamodel. For example, the following lines:

o.packages = s.libraries.equivalent();
o.userMessages = s.messageDetails.equivalent();


seems to me a bit wrong. I had the following feeling: These references like s.libraries are lists. And I am not sure equivalent() works with the lists.
Re: Some rules work other don't [message #1760388 is a reply to message #1760386] Wed, 26 April 2017 14:48 Go to previous messageGo to next message
Martin Paquin is currently offline Martin PaquinFriend
Messages: 21
Registered: July 2014
Junior Member
I can't share meta-model, they are Intellectual properties from my cie. For you info the librairies and messageDetails are Sequence.
Re: Some rules work other don't [message #1760432 is a reply to message #1760388] Thu, 27 April 2017 07:11 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Martin,

If you cannot share your metamodel as-is due to IP, you should try to construct a minimal (artificial) metamodel that we can use to replicate the issue you're encountering [1].

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Some rules work other don't [message #1760496 is a reply to message #1760432] Thu, 27 April 2017 17:27 Go to previous messageGo to next message
Martin Paquin is currently offline Martin PaquinFriend
Messages: 21
Registered: July 2014
Junior Member
I have added sample files in attachement.
Re: Some rules work other don't [message #1760616 is a reply to message #1760496] Fri, 28 April 2017 22:03 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Martin,

When I run the transformation both rules are executed ("transformLibrary" is printed to the console and a GPackage is create in the target model). It's a wild guess but is there any chance that your metamodels are registered multiple times e.g. through a plugin and through right-click->Register EPackages?

Cheers,
Dimitris
Previous Topic:IllegalAccessException for java.lang.Math.random
Next Topic:Code refactoring
Goto Forum:
  


Current Time: Fri Apr 19 21:20:03 GMT 2024

Powered by FUDForum. Page generated in 0.03343 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top