Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Refer to an EAttribute of a different model
Refer to an EAttribute of a different model [message #431484] Mon, 13 July 2009 09:35 Go to next message
Sebastian Fuchs is currently offline Sebastian FuchsFriend
Messages: 97
Registered: July 2009
Member
Hello,

I need some help in understanding how I can use EMF for MDSD.

My idea is to use an EMF generated Ecore model M1 as data model and to
have another Ecore model M2 describing details of my application, e.g.
the structure of an editor.

M2 should be transformed to Java code by XPand.

How can I refer at modelling time (e.g. in the ecore editor) from M2 to
an EAttribute of M1, e.g. to say that a particular EDouble of the model
(instances at runtime) should be displayed in that particular text field
(described by M2) ?

Thanks for your answers
Sebastian
Re: Refer to an EAttribute of a different model [message #431485 is a reply to message #431484] Mon, 13 July 2009 10:47 Go to previous messageGo to next message
Joel Greenyer is currently offline Joel GreenyerFriend
Messages: 170
Registered: July 2009
Senior Member
Hello Sebastian,
to pinpoint the attribute value, you can reference the data object and the EAttribute in the (meta-)model.

Joel

Sebastian Fuchs wrote:
> Hello,
>
> I need some help in understanding how I can use EMF for MDSD.
>
> My idea is to use an EMF generated Ecore model M1 as data model and to
> have another Ecore model M2 describing details of my application, e.g.
> the structure of an editor.
>
> M2 should be transformed to Java code by XPand.
>
> How can I refer at modelling time (e.g. in the ecore editor) from M2 to
> an EAttribute of M1, e.g. to say that a particular EDouble of the model
> (instances at runtime) should be displayed in that particular text field
> (described by M2) ?
>
> Thanks for your answers
> Sebastian
Re: Refer to an EAttribute of a different model [message #431486 is a reply to message #431485] Mon, 13 July 2009 11:35 Go to previous messageGo to next message
Sebastian Fuchs is currently offline Sebastian FuchsFriend
Messages: 97
Registered: July 2009
Member
Hi Joel,

Unfortunately I am not sure WHICH metamodel you mean.
Here is what I want:

// the metamodel for all possible editors in applications
// MM2
Editor.ecore
- EClass TextField
- EAttribute EString 'label' // the label of the Field
- EReference EAttribute 'modelProperty' // the Property of an
(yet) unknown datamodel to show

// the datamodel for a concrete application
// M1
Person.ecore
- EClass Person
- EAttribute EString 'name' // the name of a Person


// model of a person editor of the concrete application
// dynamic instance of Editor.ecore
// M2
PersonEditor.xmi
- TextField
- label = "Person's name"
- modelProperty = ***Person.ecore#EAttribute('name')***


So far I am not able to either select Person nor one of its attribute
in the properties view of the PersonEditor.xmi-Editor.
I even tried to let Person be an dynamic instance of the ecore-model
(platform:/plugin/org.eclipse.emf.ecore/model/Ecore) without success.

Sebastian


Joel Greenyer schrieb:
> Hello Sebastian,
> to pinpoint the attribute value, you can reference the data object and
> the EAttribute in the (meta-)model.
>
> Joel
Re: Refer to an EAttribute of a different model [message #431490 is a reply to message #431486] Mon, 13 July 2009 13:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Sebastian,

In all cases, if you use Load Resource... to load a resource, the
objects in that resource will be available for any feature whose type
allows that object. So loading Person.ecore into the PersonEditor.xmi
shoudl make the Person EClass and the name EAttribute available...


Sebastian Fuchs wrote:
> Hi Joel,
>
> Unfortunately I am not sure WHICH metamodel you mean.
> Here is what I want:
>
> // the metamodel for all possible editors in applications
> // MM2
> Editor.ecore
> - EClass TextField
> - EAttribute EString 'label' // the label of the Field
> - EReference EAttribute 'modelProperty' // the Property of an
> (yet) unknown datamodel to show
>
> // the datamodel for a concrete application
> // M1
> Person.ecore
> - EClass Person
> - EAttribute EString 'name' // the name of a Person
>
>
> // model of a person editor of the concrete application
> // dynamic instance of Editor.ecore
> // M2
> PersonEditor.xmi
> - TextField
> - label = "Person's name"
> - modelProperty = ***Person.ecore#EAttribute('name')***
>
>
> So far I am not able to either select Person nor one of its attribute
> in the properties view of the PersonEditor.xmi-Editor.
> I even tried to let Person be an dynamic instance of the ecore-model
> (platform:/plugin/org.eclipse.emf.ecore/model/Ecore) without success.
>
> Sebastian
>
>
> Joel Greenyer schrieb:
>> Hello Sebastian,
>> to pinpoint the attribute value, you can reference the data object
>> and the EAttribute in the (meta-)model.
>>
>> Joel


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Refer to an EAttribute of a different model [message #431492 is a reply to message #431490] Mon, 13 July 2009 14:39 Go to previous messageGo to next message
Sebastian Fuchs is currently offline Sebastian FuchsFriend
Messages: 97
Registered: July 2009
Member
It works when I specify "modelProperty" as an EObject.
When loading ressource
platform:/plugin/org.eclipse.emf.ecore/model/Ecore in Editor.ecore
to specify "modelProperty" as an EAttribute, I can't select any value
in PersonEditor.xmi after reopening the xmi-editor.

Overall it works now - thank you.
Sebastian


Ed Merks schrieb:
> Sebastian,
>
> In all cases, if you use Load Resource... to load a resource, the
> objects in that resource will be available for any feature whose type
> allows that object. So loading Person.ecore into the PersonEditor.xmi
> shoudl make the Person EClass and the name EAttribute available...
>
>
> Sebastian Fuchs wrote:
>> Hi Joel,
>>
>> Unfortunately I am not sure WHICH metamodel you mean.
>> Here is what I want:
>>
>> // the metamodel for all possible editors in applications
>> // MM2
>> Editor.ecore
>> - EClass TextField
>> - EAttribute EString 'label' // the label of the Field
>> - EReference EAttribute 'modelProperty' // the Property of an
>> (yet) unknown datamodel to show
>>
>> // the datamodel for a concrete application
>> // M1
>> Person.ecore
>> - EClass Person
>> - EAttribute EString 'name' // the name of a Person
>>
>>
>> // model of a person editor of the concrete application
>> // dynamic instance of Editor.ecore
>> // M2
>> PersonEditor.xmi
>> - TextField
>> - label = "Person's name"
>> - modelProperty = ***Person.ecore#EAttribute('name')***
>>
>>
>> So far I am not able to either select Person nor one of its attribute
>> in the properties view of the PersonEditor.xmi-Editor.
>> I even tried to let Person be an dynamic instance of the ecore-model
>> (platform:/plugin/org.eclipse.emf.ecore/model/Ecore) without success.
>>
>> Sebastian
>>
>>
>> Joel Greenyer schrieb:
>>> Hello Sebastian,
>>> to pinpoint the attribute value, you can reference the data object
>>> and the EAttribute in the (meta-)model.
>>>
>>> Joel
Re: Refer to an EAttribute of a different model [message #431494 is a reply to message #431492] Mon, 13 July 2009 14:46 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Sebastian,

Comments below.

Sebastian Fuchs wrote:
> It works when I specify "modelProperty" as an EObject.
> When loading ressource
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore in Editor.ecore
> to specify "modelProperty" as an EAttribute, I can't select any value
> in PersonEditor.xmi after reopening the xmi-editor.
Well, Ecore being it's own meta model does lead to some odd cases. But
I do expect your generated model to refer to the actual
EcorePackage.Literals.EATTRIBUTE instance and for loaded *.ecore models
to have objects that are an instance of that class...
>
> Overall it works now - thank you.
> Sebastian
>
>
> Ed Merks schrieb:
>> Sebastian,
>>
>> In all cases, if you use Load Resource... to load a resource, the
>> objects in that resource will be available for any feature whose type
>> allows that object. So loading Person.ecore into the
>> PersonEditor.xmi shoudl make the Person EClass and the name
>> EAttribute available...
>>
>>
>> Sebastian Fuchs wrote:
>>> Hi Joel,
>>>
>>> Unfortunately I am not sure WHICH metamodel you mean.
>>> Here is what I want:
>>>
>>> // the metamodel for all possible editors in applications
>>> // MM2
>>> Editor.ecore
>>> - EClass TextField
>>> - EAttribute EString 'label' // the label of the Field
>>> - EReference EAttribute 'modelProperty' // the Property of an
>>> (yet) unknown datamodel to show
>>>
>>> // the datamodel for a concrete application
>>> // M1
>>> Person.ecore
>>> - EClass Person
>>> - EAttribute EString 'name' // the name of a Person
>>>
>>>
>>> // model of a person editor of the concrete application
>>> // dynamic instance of Editor.ecore
>>> // M2
>>> PersonEditor.xmi
>>> - TextField
>>> - label = "Person's name"
>>> - modelProperty = ***Person.ecore#EAttribute('name')***
>>>
>>>
>>> So far I am not able to either select Person nor one of its attribute
>>> in the properties view of the PersonEditor.xmi-Editor.
>>> I even tried to let Person be an dynamic instance of the ecore-model
>>> (platform:/plugin/org.eclipse.emf.ecore/model/Ecore) without success.
>>>
>>> Sebastian
>>>
>>>
>>> Joel Greenyer schrieb:
>>>> Hello Sebastian,
>>>> to pinpoint the attribute value, you can reference the data object
>>>> and the EAttribute in the (meta-)model.
>>>>
>>>> Joel


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Weird race condition when committing
Next Topic:passing a hibernate.cfg.xml to teneo
Goto Forum:
  


Current Time: Thu Apr 25 09:57:21 GMT 2024

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

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

Back to the top