Home » Modeling » EMF » How to define a metamodel of a model?
|
Re: How to define a metamodel of a model? [message #493803 is a reply to message #493771] |
Wed, 28 October 2009 06:25 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Heiko,
Comments below.
Heiko Ahlig wrote:
> After my CodeCamp 2 weeks ago, I take my knowledge and built a
> datamodel with many classes and attributes.
>
> Now I need to build a system (model) to save meta informations about
> my defined datamodel, like labels and descriptions about the defined
> data-classes or attributes.
>
> For example
>
> datamodel:
> EClass: MenuCard
> EAttribute: -name
>
> Now I want save informations for this like:
> MenuCard.class -> label:"Menuekarte", description:"A menuecard
> contains all recipies, which you can order."
> EAttribute:name -> Label:"Name", description:"Contains the name of the
> menucard"
>
> Now I try to define a desription model with a description-class and an
> attribute where I can save the eAttribute(or eClass), the label and
> the description.
> But I cant say the type of eAttribute is from type EAttribute.
You can create EAnnotations. In the EAnnotation you can create a
details entry. EcoreUtil.getAnnotation can be used to fetch it.
>
> I think my attempt is the wrong apporach, but what is the right?
>
> Thanks in advance,
>
> Heiko
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: How to define a metamodel of a model? [message #494021 is a reply to message #493803] |
Wed, 28 October 2009 19:42 |
Heiko Ahlig Messages: 62 Registered: July 2009 |
Member |
|
|
Hi Ed,
thanks for your quick answer.
You are right, for my example with the labels.
But, why I need an extra model, I want also define diffrent "templates"
to my data model.
This templates/config-files, I will use to build generic
views/gui-elements with these at runtime, like a search formular with
the fields saved in the template.
I want to define this in external files so it is possible to change this
gui elements witho recompile the code.
An approach,I tested today are:
Save the fragment-part from the uri of the defined classes and
attributes and also the additional informations.
These uri-fragments I can use to iterate threw all elements on the
"data-model"-package and can find the object if it exist.
But I dont know if this is the right way or not. :(
Exists an a class which I can give the complete Uri an I get back the
right EObject or is the iteration the only way?
Thanks and Regards
Heiko
Am 28.10.2009 07:25, schrieb Ed Merks:
> Heiko,
>
> Comments below.
>
>
> Heiko Ahlig wrote:
>> After my CodeCamp 2 weeks ago, I take my knowledge and built a
>> datamodel with many classes and attributes.
>>
>> Now I need to build a system (model) to save meta informations about
>> my defined datamodel, like labels and descriptions about the defined
>> data-classes or attributes.
>>
>> For example
>>
>> datamodel:
>> EClass: MenuCard
>> EAttribute: -name
>>
>> Now I want save informations for this like:
>> MenuCard.class -> label:"Menuekarte", description:"A menuecard
>> contains all recipies, which you can order."
>> EAttribute:name -> Label:"Name", description:"Contains the name of the
>> menucard"
>>
>> Now I try to define a desription model with a description-class and an
>> attribute where I can save the eAttribute(or eClass), the label and
>> the description.
>> But I cant say the type of eAttribute is from type EAttribute.
> You can create EAnnotations. In the EAnnotation you can create a details
> entry. EcoreUtil.getAnnotation can be used to fetch it.
>>
>> I think my attempt is the wrong apporach, but what is the right?
>>
>> Thanks in advance,
>>
>> Heiko
|
|
|
Re: How to define a metamodel of a model? [message #494067 is a reply to message #494021] |
Thu, 29 October 2009 05:41 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Heiko,
Comments below.
Heiko Ahlig wrote:
> Hi Ed,
> thanks for your quick answer.
> You are right, for my example with the labels.
> But, why I need an extra model, I want also define diffrent
> "templates" to my data model.
> This templates/config-files, I will use to build generic
> views/gui-elements with these at runtime, like a search formular with
> the fields saved in the template.
>
> I want to define this in external files so it is possible to change
> this gui elements witho recompile the code.
>
> An approach,I tested today are:
> Save the fragment-part from the uri of the defined classes and
> attributes and also the additional informations.
>
> These uri-fragments I can use to iterate threw all elements on the
> "data-model"-package and can find the object if it exist.
>
> But I dont know if this is the right way or not. :(
>
> Exists an a class which I can give the complete Uri an I get back the
> right EObject or is the iteration the only way?
ResourceSet.getEObject and Resource.getEObject look up objects from
their full URI or just their fragment.
EAnnotations do support arbitrary references to other EObjects
(EAnnotations.references) or can contain arbitrary other EObjects
(EAnnotation.contents) too.
>
> Thanks and Regards
>
> Heiko
>
>
>
>
>
> Am 28.10.2009 07:25, schrieb Ed Merks:
>> Heiko,
>>
>> Comments below.
>>
>>
>> Heiko Ahlig wrote:
>>> After my CodeCamp 2 weeks ago, I take my knowledge and built a
>>> datamodel with many classes and attributes.
>>>
>>> Now I need to build a system (model) to save meta informations about
>>> my defined datamodel, like labels and descriptions about the defined
>>> data-classes or attributes.
>>>
>>> For example
>>>
>>> datamodel:
>>> EClass: MenuCard
>>> EAttribute: -name
>>>
>>> Now I want save informations for this like:
>>> MenuCard.class -> label:"Menuekarte", description:"A menuecard
>>> contains all recipies, which you can order."
>>> EAttribute:name -> Label:"Name", description:"Contains the name of the
>>> menucard"
>>>
>>> Now I try to define a desription model with a description-class and an
>>> attribute where I can save the eAttribute(or eClass), the label and
>>> the description.
>>> But I cant say the type of eAttribute is from type EAttribute.
>> You can create EAnnotations. In the EAnnotation you can create a details
>> entry. EcoreUtil.getAnnotation can be used to fetch it.
>>>
>>> I think my attempt is the wrong apporach, but what is the right?
>>>
>>> Thanks in advance,
>>>
>>> Heiko
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: How to define a metamodel of a model? [message #494826 is a reply to message #494067] |
Mon, 02 November 2009 19:43 |
Heiko Ahlig Messages: 62 Registered: July 2009 |
Member |
|
|
Hi,
Thanks Ed,
it works fine.
Heiko
Am 29.10.2009 06:41, schrieb Ed Merks:
> Heiko,
>
> Comments below.
>
> Heiko Ahlig wrote:
>> Hi Ed,
>> thanks for your quick answer.
>> You are right, for my example with the labels.
>> But, why I need an extra model, I want also define diffrent
>> "templates" to my data model.
>> This templates/config-files, I will use to build generic
>> views/gui-elements with these at runtime, like a search formular with
>> the fields saved in the template.
>>
>> I want to define this in external files so it is possible to change
>> this gui elements witho recompile the code.
>>
>> An approach,I tested today are:
>> Save the fragment-part from the uri of the defined classes and
>> attributes and also the additional informations.
>>
>> These uri-fragments I can use to iterate threw all elements on the
>> "data-model"-package and can find the object if it exist.
>>
>> But I dont know if this is the right way or not. :(
>>
>> Exists an a class which I can give the complete Uri an I get back the
>> right EObject or is the iteration the only way?
> ResourceSet.getEObject and Resource.getEObject look up objects from
> their full URI or just their fragment.
>
> EAnnotations do support arbitrary references to other EObjects
> (EAnnotations.references) or can contain arbitrary other EObjects
> (EAnnotation.contents) too.
>>
>> Thanks and Regards
>>
>> Heiko
>>
>>
>>
>>
>>
>> Am 28.10.2009 07:25, schrieb Ed Merks:
>>> Heiko,
>>>
>>> Comments below.
>>>
>>>
>>> Heiko Ahlig wrote:
>>>> After my CodeCamp 2 weeks ago, I take my knowledge and built a
>>>> datamodel with many classes and attributes.
>>>>
>>>> Now I need to build a system (model) to save meta informations about
>>>> my defined datamodel, like labels and descriptions about the defined
>>>> data-classes or attributes.
>>>>
>>>> For example
>>>>
>>>> datamodel:
>>>> EClass: MenuCard
>>>> EAttribute: -name
>>>>
>>>> Now I want save informations for this like:
>>>> MenuCard.class -> label:"Menuekarte", description:"A menuecard
>>>> contains all recipies, which you can order."
>>>> EAttribute:name -> Label:"Name", description:"Contains the name of the
>>>> menucard"
>>>>
>>>> Now I try to define a desription model with a description-class and an
>>>> attribute where I can save the eAttribute(or eClass), the label and
>>>> the description.
>>>> But I cant say the type of eAttribute is from type EAttribute.
>>> You can create EAnnotations. In the EAnnotation you can create a details
>>> entry. EcoreUtil.getAnnotation can be used to fetch it.
>>>>
>>>> I think my attempt is the wrong apporach, but what is the right?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Heiko
>>
|
|
|
Goto Forum:
Current Time: Tue Apr 23 17:42:24 GMT 2024
Powered by FUDForum. Page generated in 0.03243 seconds
|