Bug 483577 - Difficulties to request an odesign model with Sirius (or Acceleo) interpreter
Summary: Difficulties to request an odesign model with Sirius (or Acceleo) interpreter
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.0.0M5   Edit
Assignee: Cedric Brun CLA
QA Contact: Maxime Porhel CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 485397
Blocks:
  Show dependency tree
 
Reported: 2015-12-03 10:32 EST by Cedric Notot CLA
Modified: 2016-06-24 07:59 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Notot CLA 2015-12-03 10:32:18 EST
The need consists in requesting an odesign model to retrieve all the contained line mappings.

For that, you can use the Sirius (or Acceleo) Interpreter, to write this request: [self.eAllContents(LineMapping)/] and to apply it on the root object (Group). But this fails because LineMapping is unknown (same thing on a Viewpoint object).

LineMapping is only known from a EditionTableDescription.
So, applying this request: [self.eContainer(Group).eAllContents(LineMapping)/] on an EditionTableDescription, it works.
Note that, with AQL, "aql:self.eContainer(Group).eAllContents(LineMapping)" does not work either because Group is unknown.

Note that adding the related Sirius metamodel(s) on one of the RepresentationDescription has no effet (and it is not very intuitive from the end-user)

Watched on Sirius 3.1.1.
Comment 1 Cedric Brun CLA 2015-12-28 05:24:30 EST
"aql:self.eContainer(Group).eAllContents(LineMapping)" is not valid AQL as the types are missing their EPackage name. 

I would have expected: 
aql:self.eContainer(viewpoint::Group).eAllContents(table::LineMapping)

But besides that, we would need to know more about what you where doing, are you evaluating the request on the .odesign editor ? or on a modeling project ?

I assume it is using the .odesign editor, if that is the case, the issue probably lies on the fact that, as no "session" is available no metamodel besides the one of the current selected EObject is registered in the AQL context. This has been done as the only other option we foresaw was to browse the whole model just to retrieve the "EPackage which are used in the current editor" and that's something we'd like to avoid.

That being said, I don't think we explored the option of going through the PackageRegistry of the resourceSet and registering all the EPackages which are resolved (and not PackageDescriptor). That would likely fix this issue.
Comment 2 Eclipse Genie CLA 2016-01-08 08:32:14 EST
New Gerrit change created: https://git.eclipse.org/r/63844
Comment 3 Cedric Brun CLA 2016-01-08 08:39:23 EST
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/63844

This makes sure the EPackages will be registered even if the selection is not currently managed by Sirius. 
This is not enough for *this* actual bug though as it also revealed the fact that AQL might override type informations if two EPackages have the same name, which is often the case in Sirius, see Bug 485397
Comment 4 Cedric Brun CLA 2016-01-08 08:40:07 EST
> I would have expected: 
> aql:self.eContainer(viewpoint::Group).eAllContents(table::LineMapping)

Correction, this is actually :

aql:self.eContainer(description::Group).eAllContents(description::LineMapping)

(where both "description" are actually different EPackages
Comment 6 Cedric Brun CLA 2016-01-19 10:16:27 EST
This is fixed on master with https://git.eclipse.org/r/#/c/63845/ being merged.

For the record, this bugzilla led to the following changes to get a complete fix:
- Make Sirius declare all the EPackages which are resolved when the requestor is used from a selection which is not "handled" by Sirius and as such as no session.
- Make AQL consider the fact that several EPackages might have the same name yet not be identic and as such contains different EClassifiers. Also expose the corresponding API
- Make Sirius use this improved API from AQL

Thanks for your feedback !
Comment 7 Maxime Porhel CLA 2016-05-24 05:29:31 EDT
Validated on Sirius 4.0.0.201605180923 (4.0.0 RC1)

See also correction done for Bug 485397 and mentioned by Cédric in the previous commit: 
 Gerrit change https://git.eclipse.org/r/63845 was merged to [master].
 Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=df40a4e3cb3c1cbd5835ef2d1494da9534db4424
Comment 8 Maxime Porhel CLA 2016-05-24 05:32:00 EDT
Validated with  AQL 5.0.0.201605040614
Comment 9 Pierre-Charles David CLA 2016-06-24 07:59:10 EDT
Available in Sirius 4.0.0.