Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Getting all Classes in a UML model
Getting all Classes in a UML model [message #1549355] Tue, 06 January 2015 13:26 Go to next message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Hi,

I am trying to get all Classes (instances of UML::Classes::Kernel::Class) contained in a UML 2.5 model created using Papyrus. However, the results I am getting are somewhat confusing:

// Exception: Method 'allOfType' not found for: org.eclipse.epsilon.eol.types.EolModelElementType@1733f03
Source!Class.allOfType();

// Exception: Method 'allOfKind' not found for: org.eclipse.epsilon.eol.types.EolModelElementType@1a48835
Source!Class.allOfKind();

// Returns: Class1, Class1, EPackage, ENamedElement, EClassifier, Extend, EClass, EDataType, EEnum, EEnumLiteral, EOperation, EParameter, EStructuralFeature, EAttribute, EReference, ETypeParameter, EGenericType
Source!Class.allInstances();

// Returns: Class1, Class1, EPackage, ENamedElement, EClassifier, Extend, EClass, EDataType, EEnum, EEnumLiteral, EOperation, EParameter, EStructuralFeature, EAttribute, EReference, ETypeParameter, EGenericType
Source!Class.all();


I would have expected all of these methods to return two Classes, both named "Class1". These are the only Classes in my model.

I also tried the following:

// Exception: Undefined variable, type or model: 'Source!UML::Classes::Kernel::Class'
Source!UML::Classes::Kernel::Class.all();

// Exception: Undefined variable, type or model: 'Source!Classes::Kernel::Class'
Source!Classes::Kernel::Class.all();


Why are the operations in my first four examples returning different results (including exceptions), and why is the qualified name of Class reported as undefined?

I am attaching my test model for reference purposes.

Cheers,
Vlad
  • Attachment: cd1.uml
    (Size: 1.35KB, Downloaded 173 times)
Re: Getting all Classes in a UML model [message #1551485 is a reply to message #1549355] Wed, 07 January 2015 17:02 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

I've used Source!uml::Class, and it produces the same results.

I've looked around in the debugger and I suspect that there's an Ecore UML profile being loaded implicitly by the UML EMF driver, in which Ecore basic types (such as an EClass) are included as instances of Stereotype, which is a kind of Class. EOL is producing correct but unexpected results, I'm afraid.

Apparently it has the "http://www.eclipse.org/uml2/schemas/Ecore/5" URI, but I can't find it in the EPackage Registry. Perhaps someone else knows more about the implementation details of UML within Eclipse.

For the time being, may I suggest checking that it doesn't belong to an UML profile?

for (elem in Source!uml::Class.allInstances()) {
  if (not elem.eContainer().isKindOf(Source!uml::Profile)) {
    "".println(elem);
  }
}
Re: Getting all Classes in a UML model [message #1552645 is a reply to message #1551485] Thu, 08 January 2015 08:28 Go to previous message
Vlad Acretoaie is currently offline Vlad AcretoaieFriend
Messages: 95
Registered: April 2014
Member
Thank you for the detailed explanation of this behavior.

I tried out the test you suggested, and it indeed manages to filter out unexpected instances of Class.

I also noticed the http://www.eclipse.org/uml2/schemas/Ecore/5 URI, since it's not included in the Papyrus model files. I guess it is introduced by EMF at some stage, though I'm not sure when or why.

Cheers,
Vlad
Previous Topic:Eugenia generate Diagram as RCP App ?
Next Topic:Which Epsilon language is best for batch, in-place refactoring?
Goto Forum:
  


Current Time: Fri Apr 19 05:01:34 GMT 2024

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

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

Back to the top