Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emf-dev] Unresolved proxies on metamodel that is split into two files

Please use the EMF forum to ask questions:

https://www.eclipse.org/forums/index.php/f/108/

You must use a resource set to be able to resolve proxies from a resource.  I.e., proxies can only be resolved if the resource is contained by a resource set into which additional resources can be demand loaded.

If you're running stand-alone you should do something like this:

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
    Resource metamodelResource  = resourceSet.getResource(URI.createFileURI(metamodel), true);

Regards,
Ed

On 12.08.2020 20:08, Harmon Nine wrote:
Hello.

I'm getting "unresolved proxy" errors when trying to execute "ECoreUtils.resolvedAll" on an emf metamodel.

The metamodel is stored in two files:

/path/to/metamodel/file/master.ecore
/path/to/metamodel/file/referenced.ecore


The "master" file references items in the "referenced" file using proxies that look like this:

<eStructuralFeatures xsi:type="ecore:EReference" name="rm" ordered="false" upperBound="-1"
    eType="ecore:EClass referenced.ecore#//ReferencedModel" containment="true"/>


The calls that are being used to load and resolve the "master" file are as follows:

(This code is from "https://github.com/atlanmod/mondo-atlzoo-benchmark/blob/master/fr.inria.atlanmod.instantiator/src/fr/inria/atlanmod/instantiator/Launcher.java")
--------------------------------
String metamodel = commandLine.getOptionValue(METAMODEL);

Resource metamodelResource = new XMIResourceImpl(URI.createFileURI(metamodel));
metamodelResource.load(Collections.emptyMap());

EcoreUtil.resolveAll(metamodelResource);
--------------------------------


For each proxy in the master.ecore file, the "EcoreUtil.resolveAll()" call
results in the following 4 error messages.  There are 13 such proxies, so 52 error message in total:

--------------------------------
Aug 12, 2020 12:22:21 PM fr.inria.atlanmod.instantiator.Launcher main
SEVERE: The feature 'eType' of
'org.eclipse.emf.ecore.impl.EReferenceImpl@6293abcc{file:/path/to/metamodel/file/master.ecore#//MasterModel/rm}' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.EClassImpl@794cb805{file:/path/to/metamodel/file/referenced.ecore#//ReferencedModel}'

Aug 12, 2020 12:22:21 PM fr.inria.atlanmod.instantiator.Launcher main
SEVERE: The feature 'eReferenceType' of
'org.eclipse.emf.ecore.impl.EReferenceImpl@6293abcc{file:/path/to/metamodel/file/master.ecore#//MasterModel/rm}' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.EClassImpl@794cb805{file:/path/to/metamodel/file/referenced.ecore#//ReferencedModel}'

Aug 12, 2020 12:22:21 PM fr.inria.atlanmod.instantiator.Launcher main
SEVERE: The feature 'eRawType' of
'org.eclipse.emf.ecore.impl.EGenericTypeImpl@4b5a5ed1{file:/path/to/metamodel/file/master.ecore#//MasterModel/rm/@eGenericType}' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.EClassImpl@794cb805{file:/path/to/metamodel/file/referenced.ecore#//ReferencedModel}'

Aug 12, 2020 12:22:21 PM fr.inria.atlanmod.instantiator.Launcher main
SEVERE: The feature 'eClassifier' of
'org.eclipse.emf.ecore.impl.EGenericTypeImpl@4b5a5ed1{file:/path/to/metamodel/file/master.ecore#//MasterModel/rm/@eGenericType}' contains an unresolved proxy 'org.eclipse.emf.ecore.impl.EClassImpl@794cb805{file:/path/to/metamodel/file/referenced.ecore#//ReferencedModel}'
--------------------------------

Note that the URL to the "referenced.ecore" file i.e. "file:/path/to/metamodel/file/referenced.ecore" in the error messages is correct.


What function/method calls are needed to get these proxies to resolve in the call to "EcoreUtil.resolveAll()"?

Thanks
-- Harmon

_______________________________________________
emf-dev mailing list
emf-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/emf-dev

Back to the top