Incomplete EPackage from ecore file [message #1861705] |
Mon, 30 October 2023 08:50 ![Go to next message Go to next message](png/down.png) |
Máté Földiák![Friend of Eclipse Friend](png/friends_decorator13c3.png) Messages: 3 Registered: October 2023 |
Junior Member |
|
|
Hi,
I'm working on checking in runtime if a VQL file is syntactically correct given a metamodel.
The problem is that when I parse an ECore metamodel from file, the references and containments are missing.
val ResourceSet resourceSet = new ResourceSetImpl();
EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE)
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
"ecore", new EcoreResourceFactoryImpl());
val resource = resourceSet.getResource(
URI.createFileURI("res/meta.ecore"), true);
val pkg = resource.contents.get(0) as EPackage
If I run the code above, classifiers and super types are loaded in, but none of the structural features. (eAllReferences, eAllStructuralFeatures and eAllContainments are null.)
Do you have any idea on what is the problem and how to fix it?
Thanks,
Máté
|
|
|
|
|
|
|
Re: Incomplete EPackage from ecore file [message #1861731 is a reply to message #1861729] |
Tue, 31 October 2023 11:05 ![Go to previous message Go to previous message](png/up.png) |
Ed Merks![Friend of Eclipse Friend](png/friends_decorator1fd6.png) Messages: 32984 Registered: July 2009 |
Senior Member |
|
|
I see a containment list for eStructuralFeatures, but I don't know how you know it's empty. That's not evident from your picture. It's pretty much impossible for containment features not to be populated for a resource that loads without exceptions/errors. I can see eOperations is null (because the getter has never been called) but eStructuralFeatures is not null and I expect it contains your two features.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02203 seconds