Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » SuperClass gets displayed with SubClass(SuperClass gets displayed even though only the SubClass should be displayed)
SuperClass gets displayed with SubClass [message #1810266] Tue, 06 August 2019 09:19 Go to next message
Florian Kunz is currently offline Florian KunzFriend
Messages: 21
Registered: September 2018
Junior Member
Hi,

I got a rather strange problem.
I created an ecore meta model with a class that is a supertype to another class. Lets say the superclass is called ClassA and the other class is SubClassA1.
When I create an instance of SubClassA1, the editor als creates a representation of ClassA. It is not possible to delete only the ClassA representation without deleting the SubClassA1 representation.

From my own research on the internet I found out, that I am supposed to use the "Semantic Candidates Expression" of the ClassA node to solve this problem. But for some reason, the expressions I found online do not work for me.

Example:
aql:self.yourContainmentReference.oclIsTypeOf(yourPackage::SuperTypeA)

Of course I switched out the nessessary parts. It looked kinda like this.
aql:self.classa.oclIsTypeOf(exampleProject::ClassA)

I hope someone here can help me.

Regards,
Florian
Re: SuperClass gets displayed with SubClass [message #1810268 is a reply to message #1810266] Tue, 06 August 2019 09:31 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

If I understood correctly, in your VSM (.odesign file), you have two mappings, one where the domain class is "exampleProject::ClassA" and another one where the domain class is "exampleProject::SubClassA1". On the first one you added the semantic candidate expression "self.classa.oclIsTypeOf(exampleProject::ClassA)", have you set the equivalent semantic candidate expression on the second mapping? Can you check that you have not used oclIsKindOf somewhere? This one is valid for a supertype.

Regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: SuperClass gets displayed with SubClass [message #1810269 is a reply to message #1810268] Tue, 06 August 2019 10:01 Go to previous messageGo to next message
Florian Kunz is currently offline Florian KunzFriend
Messages: 21
Registered: September 2018
Junior Member
Thanks for the fast reply.

I tried adding the corresponding expression to the SubClass. Now the SubClass does not get displayed either.
I think I made a mistake somewhere but I don't know where since I mainly followed the steps of the sirius tutorial.
I just validated the odesign file and I got a warning messege that says something about dependencies (I added a screenshot). But I don't know, if that has something to do with the problem at hand.

I added some screenshots to show you my meta model and the expressions.
Re: SuperClass gets displayed with SubClass [message #1810280 is a reply to message #1810269] Tue, 06 August 2019 13:07 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

Ok I think I have a better understanding with the screenshot. I hadn't noticed the first time, but with your expression you are trying to do two thing at once, identify candidates and filter by type so you should use oclAsType to cast, instead of oclIsTypeOf that returns a boolean.
If it is easier, you can do it in two steps. For your candidate expression, you can use only aql:self.classa, as it is the reference in your metamodel. Note that you can also use the expression "feature:classa" that is more performant. Then you want to filter by type, this can be done in the "Precondition Expression" field in the advance tab. Here the expression will be aql:self.oclIsTypeOf(exampleProject::ClassA) or SubClassA1 depending on the mapping.

Concerning the errors about the unaccessible types, can you check that in the Manifest.MF file of your project, you have a dependency to your metamodel? Also, in your .odesign, if you select your DiagramDescription "exampleDiagram", you can go to the metamodel tab and add your metamodel using the registry or the workspace. This should further check that you have access to your metamodel.

Regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: SuperClass gets displayed with SubClass [message #1810283 is a reply to message #1810280] Tue, 06 August 2019 13:38 Go to previous messageGo to next message
Florian Kunz is currently offline Florian KunzFriend
Messages: 21
Registered: September 2018
Junior Member
Hi,

First of all, thanks a lot. It's working now. I can create instnaces of the SubClass without representations of the SuperClass :D

Considering the warning messege, I checked and found, that there is no dependency to the meta model project. I did reference it in the metamodel tab of the "exampleDiagram" though. In the Manifest I tried to add it with the Add button, but I can't find the project in the upcoming list.
(I hope it's not a problem, that I have the design project in a new eclipse instance, like it's done in the tutorial.)

Regards,
Florian
Re: SuperClass gets displayed with SubClass [message #1810285 is a reply to message #1810283] Tue, 06 August 2019 14:12 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Great!

You should be able to add the dependency to the metamodel, whether your "Viewpoint Specification Project" (the one with the .odesign file) is in the same workspace or in a runtime. How did you create the metamodel project? With the "EMF Project" wizard? Is it a plugin project?

On a different topic, in your initial post, you said that you found that you needed to use the "semantic candidate expression". As you have noticed this field gives Sirius the information on how to select candidate elements for a mapping. If this field is not set, then only the Domain Class provides this information. This means that Sirius will look every element of the model to find a candidates. As you can guess, this is not as performant.

Regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: SuperClass gets displayed with SubClass [message #1810290 is a reply to message #1810285] Tue, 06 August 2019 14:57 Go to previous message
Florian Kunz is currently offline Florian KunzFriend
Messages: 21
Registered: September 2018
Junior Member
Hi,

I created the project through New -> Ecore Modeling Project.
From there I created the meta model and then generated the model, edit and editor code. I made no further changes to the project (Name, Ns URI and NS Prefix are set from the beginning, so I didn't change anything there)

Regards,
Florian
Previous Topic:Why can't the official website enter?
Next Topic:Issue with layout of border nodes (arrange-all)
Goto Forum:
  


Current Time: Thu Apr 25 10:30:27 GMT 2024

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

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

Back to the top