Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] EClass.all not returns EClass from referenced packages
[ETL] EClass.all not returns EClass from referenced packages [message #1702830] Sat, 25 July 2015 12:45 Go to next message
Oleg Orlov is currently offline Oleg OrlovFriend
Messages: 14
Registered: June 2015
Junior Member
Hi all.
How can i get all EClasses, inherited from my EClass?
Is it possible at all?

My first try:
operation S!EClass getAllKindOf() {
return S!EClass.all.select(e|self.isSuperTypeOf(e));
}

But it returns objects only from main ecore module, not referenced modules.
Any hints?

[Updated on: Sat, 25 July 2015 12:45]

Report message to a moderator

Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702832 is a reply to message #1702830] Sat, 25 July 2015 13:02 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 Oleg,

Could you please provide a minimal example [1] that we can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702834 is a reply to message #1702832] Sat, 25 July 2015 13:27 Go to previous messageGo to next message
Oleg Orlov is currently offline Oleg OrlovFriend
Messages: 14
Registered: June 2015
Junior Member
Epsilon Core 1.3.0.201506241627

expected result:
myRef->MyBase
MyBase
MyImpl1
MyImpl2
MyImpl3

actual result:
myRef->MyBase
MyImpl3
  • Attachment: mintest.zip
    (Size: 2.46KB, Downloaded 107 times)

[Updated on: Sat, 25 July 2015 16:17]

Report message to a moderator

Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702846 is a reply to message #1702834] Sat, 25 July 2015 21:16 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 Oleg,

Tweaking minmain.emf's import statement as follows seems to be doing the trick.

@namespace(uri="minmain", prefix="minmain")
package minmain;

import "platform:/resource/mintest/minsub.ecore";

class MyContainer {
  ref minsub.MyBase myRef;
}

class MyImpl3 extends minsub.MyBase {
}


Cheers,
Dimitris
Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702849 is a reply to message #1702846] Sun, 26 July 2015 07:34 Go to previous messageGo to next message
Oleg Orlov is currently offline Oleg OrlovFriend
Messages: 14
Registered: June 2015
Junior Member
Hi Dimitris,
Yes, it works with platform reference.

But this solution not fully satisfactory for us. Our goal is to get it working in specific production server environment, without eclipse platform.

Can you give any advice for that case?

Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702852 is a reply to message #1702849] Sun, 26 July 2015 08:46 Go to previous messageGo to next message
Oleg Orlov is currently offline Oleg OrlovFriend
Messages: 14
Registered: June 2015
Junior Member
Ok, i get it myself:)

[%for (r in EReference.all) {%]
[%=r.name%]->[%=r.eReferenceType.name%]
[%for (eClass in allClasses().select(e|r.eReferenceType.isSuperTypeOf(e))) {%]
[%=eClass.name%]
[%}%]
[%}%]

[%
operation allClasses() {
var l = Sequence{};
for (p in allPackages()) {
for (c: EClass in p.getEClassifiers()) {
l.add(c);
}
}
return l;
}

operation allPackages() {
var l = Sequence{};
for (p in EPackage.all) {
p.collectEPackages(l);
}
return l;
}

operation EPackage collectEPackages(l) {
if (l.includes(self)) {
return;
}
l.add(self);
for (ePackage in self.getESubpackages()) {
ePackage.collectEPackages(l);
}
for (eClass: EClass in self.getEClassifiers()) {
for (eSuperType in eClass.getEAllSuperTypes()) {
eSuperType.getEPackage().collectEPackages(l);
}
for (eRference in eClass.getEAllReferences()) {
eRference.getEReferenceType().getEPackage().collectEPackages(l);
}
}
}
%]
Re: [ETL] EClass.all not returns EClass from referenced packages [message #1702858 is a reply to message #1702852] Sun, 26 July 2015 11:51 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Oleg,

I've committed a fix which adds support for relative file imports [1], and pushed out a new version of the update site. Replacing your import statement with
import "minsub.ecore";
should now work as expected without the workaround code.

Cheers,
Dimitris

[1] https://git.eclipse.org/c/emfatic/org.eclipse.emfatic.git/commit/?id=4f873d43cc26ff262efc3cca297dcfb1f4e92a77

[Updated on: Sun, 26 July 2015 11:53]

Report message to a moderator

Previous Topic:[ETL]How to transform a Source model into an arbitrary number of target models ?
Next Topic:scanning ecore file for annotation
Goto Forum:
  


Current Time: Thu Apr 25 08:41:16 GMT 2024

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

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

Back to the top