Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » referencing an element of an unknown metamodel using EObject
referencing an element of an unknown metamodel using EObject [message #414474] Thu, 08 November 2007 14:38 Go to next message
Javi is currently offline JaviFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

I have an input model mU compliant to the U metamodel (mmU).
I create an output model mX compliant to the X metamodel (mmX).

I want to keep a link from the output element (eX) to the input element
(eU) from which it is derived.

Because only during app-runtime the metamodel U is known, I cannot have
any reference from mmX to mmU. Thus, I thought of creating a feature in
XElement: actualElement of type EObject.

<eClassifiers xsi:type="ecore:EClass" name="XElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="actualElement"
ordered="false"
lowerBound="1" eType="ecore:EClass
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Object "/>
</eClassifiers>

I manage to read programmatically a model from the files (fX, fU), the
link has the reference to eU. But eU is read as AnyType instead of as
UElement. I suppose because it is unrecognized content.

In case U=UML,
- I register the extension
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
- I register the package
UMLPackage umlPackage = UMLPackage.eINSTANCE;
- I register the UML pathmaps
URIConverter.URI_MAP.put(..., ...);

Am I missing anything to have the element read as UElement instead of
AnyType.

Thank you in advance
Re: referencing an element of an unknown metamodel using EObject [message #414482 is a reply to message #414474] Thu, 08 November 2007 17:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Javi,

Comments below.

Javi wrote:
> Hi,
>
> I have an input model mU compliant to the U metamodel (mmU).
> I create an output model mX compliant to the X metamodel (mmX).
>
> I want to keep a link from the output element (eX) to the input
> element (eU) from which it is derived.
>
> Because only during app-runtime the metamodel U is known, I cannot
> have any reference from mmX to mmU. Thus, I thought of creating a
> feature in XElement: actualElement of type EObject.
>
> <eClassifiers xsi:type="ecore:EClass" name="XElement">
> <eStructuralFeatures xsi:type="ecore:EReference" name="actualElement"
> ordered="false"
> lowerBound="1" eType="ecore:EClass
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Object "/>
> </eClassifiers>
>
> I manage to read programmatically a model from the files (fX, fU), the
> link has the reference to eU. But eU is read as AnyType instead of as
> UElement. I suppose because it is unrecognized content.
What does the serialized link look like?
>
> In case U=UML,
> - I register the extension
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
> - I register the package
> UMLPackage umlPackage = UMLPackage.eINSTANCE;
> - I register the UML pathmaps
> URIConverter.URI_MAP.put(..., ...);
>
> Am I missing anything to have the element read as UElement instead of
> AnyType.
I imagine the reference should be read as proxy and resolved later, if
it's not resolving, I need more details to understand why. It should be
fine that it's an AnyType while it's a proxy, so likely the problem is
more to do with resolving the proxy than anything else.
>
> Thank you in advance
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: referencing an element of an unknown metamodel using EObject [message #414571 is a reply to message #414482] Tue, 13 November 2007 15:02 Go to previous message
Javi is currently offline JaviFriend
Messages: 23
Registered: July 2009
Junior Member
Ed,

Indeed, it was unrecognized content. Different uml versions.
So it was not a reference problem.

Thank you anyway.


Ed Merks wrote:

> Javi,

> Comments below.

> Javi wrote:
>> Hi,
>>
>> I have an input model mU compliant to the U metamodel (mmU).
>> I create an output model mX compliant to the X metamodel (mmX).
>>
>> I want to keep a link from the output element (eX) to the input
>> element (eU) from which it is derived.
>>
>> Because only during app-runtime the metamodel U is known, I cannot
>> have any reference from mmX to mmU. Thus, I thought of creating a
>> feature in XElement: actualElement of type EObject.
>>
>> <eClassifiers xsi:type="ecore:EClass" name="XElement">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="actualElement"
>> ordered="false"
>> lowerBound="1" eType="ecore:EClass
>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Object "/>
>> </eClassifiers>
>>
>> I manage to read programmatically a model from the files (fX, fU), the
>> link has the reference to eU. But eU is read as AnyType instead of as
>> UElement. I suppose because it is unrecognized content.
> What does the serialized link look like?
>>
>> In case U=UML,
>> - I register the extension
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(
>> UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
>> - I register the package
>> UMLPackage umlPackage = UMLPackage.eINSTANCE;
>> - I register the UML pathmaps
>> URIConverter.URI_MAP.put(..., ...);
>>
>> Am I missing anything to have the element read as UElement instead of
>> AnyType.
> I imagine the reference should be read as proxy and resolved later, if
> it's not resolving, I need more details to understand why. It should be
> fine that it's an AnyType while it's a proxy, so likely the problem is
> more to do with resolving the proxy than anything else.
>>
>> Thank you in advance
>>
>>
Previous Topic:Generated Editor serializes code but doesn't reload it
Next Topic:Nullpointer in sdo in multithreaded environment.
Goto Forum:
  


Current Time: Thu Apr 25 22:17:33 GMT 2024

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

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

Back to the top