Bug 461498 - Loading referenced models include Sirius meta models.
Summary: Loading referenced models include Sirius meta models.
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.0.0M7   Edit
Assignee: Cedric Brun CLA
QA Contact: Laurent Fasani CLA
URL:
Whiteboard: needtest
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-03-05 08:35 EST by Wilbert Alberts CLA
Modified: 2016-02-09 11:19 EST (History)
4 users (show)

See Also:


Attachments
Description that meets validation but includes sirius metamodel. (2.09 KB, application/octet-stream)
2015-03-06 06:02 EST, Wilbert Alberts CLA
no flags Details
Description that does not meet validation without sirius metamodel. (2.02 KB, application/octet-stream)
2015-03-06 06:02 EST, Wilbert Alberts CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Alberts CLA 2015-03-05 08:35:12 EST
Editor descriptions might depend on the Sirius metamodel. That can be specified which allows succesfull validation of these editor descriptions.

However, opening an associated *.aird file leads to loading referenced models. The editor then starts to include also the Sirius meta models and all models they depend on. This leads to a large list of models.

I noted this in particular when a model I was editing was referring to another model. Sometimes everything seemed fine until the moment I closed and restarted eclipse. Then, opening the *.aird files lead to loading models like Ecore.ecore.
Comment 1 Wilbert Alberts CLA 2015-03-05 08:35:49 EST
See also: https://www.eclipse.org/forums/index.php/t/1027875/
Comment 2 Esteban DUGUEPEROUX CLA 2015-03-05 08:46:00 EST
Indeed it comes from RepresentationDescription.metamodel:EPackage[0..*] reference. We should find a better mean to reference metamodel without loading them.
Comment 3 Cedric Brun CLA 2015-03-05 10:15:04 EST
I would say there might be two distincts problems here.

The expression validation complaining about "not knowning about DSemanticDiagram"  is a bug in itself (which I could not reproduce using master)

Would that be possible for you to attach a Viewpoint Specification Project which reveal this issue ?


Now regarding the referencing of the EPackages in the .odesign, we indeed have quite an "unclear" story and need to sort that out.
Either we make sure to always reference the Ecore's through their nsURI and then setup the proper URIMappings, or always platform:/plugin...

Right now it really depends on "how the user did load the Ecore model" which offers many choices, through the "load Resources.." or using one of the button from the property view. Each of these choice will have an implication and might lead to fragile relative references, or references which are not valid once the .odesign is deployed.


EcorePlugin.computePlatformURIMap() have a role to play in the whole story and should probably be called by the SiriusEditor so that Ecore which are imported in the workspace are "shadowing" those deployed in the target platform.
Comment 4 Esteban DUGUEPEROUX CLA 2015-03-06 04:19:08 EST
Indeed when testing on master, adding Sirius metamodels in Metamodels tabs of properties view on RepresentationDescription selection seems not needed for validation when having Sirius EClass referenced in interpreted expression.
For example having "[self.oclIsTypeOf(DSemanticDecorator)/]" in a precondition, the validation is ok.
Wilbert, which release of Sirius do you use? And could you provide a minimal reproduction case?

It is RepresentationDescriptionMetamodelsUpdater which manages these metamodels reference to have odesign references directly by URI instead of by nsURI. We could look at it to better manage that.
Comment 5 Wilbert Alberts CLA 2015-03-06 06:02:25 EST
Created attachment 251355 [details]
Description that meets validation but includes sirius metamodel.
Comment 6 Wilbert Alberts CLA 2015-03-06 06:02:53 EST
Created attachment 251356 [details]
Description that does not meet validation without sirius metamodel.
Comment 7 Wilbert Alberts CLA 2015-03-06 06:04:31 EST
Attached two descriptions that show the need of including sirius metamodel when validating model.

I use Sirius Core Runtime 3.0.0.201502261203 in Eclipse Marse 4.5 milestone.
Comment 8 Cedric Brun CLA 2015-03-20 10:37:54 EDT
I could reproduce the problem with your .odesign, thanks !

Indeed Sirius is, right now, not passing its own metamodels in the validator.

I'm currently cleaning up this area of the code so will fix it in the same pass.

In the meantime, you can avoid the validation error by being more explicit regarding the type and adding the nsPrefix : diagram::DSemanticDiagram. This gives Acceleo enough information that it find the right type himself.
Comment 9 Eclipse Genie CLA 2015-03-20 12:25:10 EDT
New Gerrit change created: https://git.eclipse.org/r/44267
Comment 11 Cedric Brun CLA 2015-04-20 04:38:02 EDT
Expression validation (In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/44267 was merged to [master].
> Commit:
> http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/
> ?id=309f55a1134dccf4823b121169b651e46c91d9d5

vsp-nook now valids correctly with this changes. That being said, at runtime, during expression evaluation the mechanisms and code involved are fairly different and right now there is no guarantee the Sirius runtime will pass the Sirius model EPackages to the intepreter instances which can lead to expressions using DSemantiDiagram, NodeMapping or any other type failing at runtime.

To fix that I was thinking about re-using the org.eclipse.sirius.business.api.extender.MetamodelDescriptorProvider and the org.eclipse.sirius.mmdescriptor extension point with implementations in all the plugins providing new metamodels to Sirius always adding the corresponding EcoreMetamodelDescriptor.

This might seems like a small "abuse" of the extension point which was, at first dedicated to "add and declare some EPackages which would have been defined in a custom way (and maybe computed based on some other model description).

Team, what do you think about going this route ?
Comment 12 Eclipse Genie CLA 2015-04-20 05:37:35 EDT
New Gerrit change created: https://git.eclipse.org/r/46061
Comment 14 Pierre-Charles David CLA 2015-04-22 10:49:49 EDT
Cédric, your patch was merged. Does this fix the issue? Even if it does, we would need to add a regression test for it before closing the bugzilla.
Comment 15 Cedric Brun CLA 2015-04-27 10:55:51 EDT
(In reply to Pierre-Charles David from comment #14)
> Cédric, your patch was merged. Does this fix the issue? Even if it does, we
> would need to add a regression test for it before closing the bugzilla.

Yes, it is now fixed both at evaluation and validation time.
Comment 16 Laurent Fasani CLA 2015-05-26 06:13:21 EDT
validated:
behavior test used at design time : validation must succeed on "Description that does not meet validation without sirius metamodel." odesign

behavior test used at runtime : [view.eContainer(DSemanticDiagram).target.oclIsKindOf(EPackage)/] must work
 * create a modeling project with an ecore semantic resource and some classes under rootpackage
 * add new bugdiagram diagram => that represented classes should be elliptic
Comment 17 Pierre-Charles David CLA 2015-06-24 11:15:11 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.
Comment 18 Eclipse Genie CLA 2016-01-14 12:20:20 EST
New Gerrit change created: https://git.eclipse.org/r/64388
Comment 20 Eclipse Genie CLA 2016-01-15 03:07:35 EST
New Gerrit change created: https://git.eclipse.org/r/64435
Comment 21 Eclipse Genie CLA 2016-01-15 03:09:41 EST
New Gerrit change created: https://git.eclipse.org/r/64436
Comment 23 Laurent Fasani CLA 2016-02-09 11:19:28 EST
validated on sirius 3.1.4