Home » Modeling » EMF » How to define my own "ecore" metamodel
How to define my own "ecore" metamodel [message #1125331] |
Fri, 04 October 2013 11:57 |
Jean-Baptiste Guillois Messages: 33 Registered: August 2011 |
Member |
|
|
Hello,
First of all, i apologize for maybe not using the proper terms regarding ecore, models, metamodels.
When using ecore, we can model concepts by defining classes and their attributes/relationships.
Let's consider the following model, (defined using ecore):
Class: "Book"
Attributes: Name (String), Price (double), NoPages (int)
Refs: author (Author)
Class: "Author"
Attributes: Name (String), NativeLang (String)
Refs: books (Book)
Now let's consider that i need to provide my users a way for defining custom attributes on books given the hypothesis that my users cannot modify the Book and Author model, they can only extend it. I would like them to be able to define things like a ISBN attribute having a String type.
How can i use ecore (or something else) to address this kind of need?
Many thanks for your help,
Best Regards,
|
|
|
Re: How to define my own "ecore" metamodel [message #1125343 is a reply to message #1125331] |
Fri, 04 October 2013 12:13 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Jean-Baptise,
Comments below.
On 04/10/2013 1:57 PM, Jean-Baptiste Guillois wrote:
> Hello,
>
> First of all, i apologize for maybe not using the proper terms
> regarding ecore, models, metamodels.
>
> When using ecore, we can model concepts by defining classes and their
> attributes/relationships.
>
> Let's consider the following model, (defined using ecore):
> Class: "Book"
> Attributes: Name (String), Price (double), NoPages (int)
> Refs: author (Author)
>
> Class: "Author"
> Attributes: Name (String), NativeLang (String)
> Refs: books (Book)
>
> Now let's consider that i need to provide my users a way for defining
> custom attributes on books given the hypothesis that my users cannot
> modify the Book and Author model, they can only extend it.
That's not necessarily the only conclusion. Often models make
themselves "extensible" via some type of annotation mechanism.
> I would like them to be able to define things like a ISBN attribute
> having a String type.
So is the user capable of using Ecore so that they can define BookWithISBN?
>
> How can i use ecore (or something else) to address this kind of need?
It really depends a lot on the sophistication of your users. Do they
understand type systems? Will they want user defined types or should
you just enumerate the types? Will they be capable of defining
something type-system like, e.g., all Books should also have an ISBN
attribute of type string that I want to call isbn. Will two different
users want different things and still share the same Book instance?
>
> Many thanks for your help,
>
> Best Regards,
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: How to define my own "ecore" metamodel [message #1125364 is a reply to message #1125343] |
Fri, 04 October 2013 12:41 |
Jean-Baptiste Guillois Messages: 33 Registered: August 2011 |
Member |
|
|
Thx for your quick reply
Quote:That's not necessarily the only conclusion. Often models make
themselves "extensible" via some type of annotation mechanism.
==> Right, but i consider that i have to provide my users a mechanism for 1) defining these extensions (new types) and 2) using these new types for creating their instances (both of these without requiring java code to be written)
Quote:So is the user capable of using Ecore so that they can define BookWithISBN?
==> Let's assume yes, I want to provide my users with a mechanism for doing so and force them to create "themselves" this ecore file (i may generate (automatically) it for them given a description/specification they can provide)
Quote:It really depends a lot on the sophistication of your users. Do they
understand type systems? Will they want user defined types or should
you just enumerate the types? Will they be capable of defining
something type-system like, e.g., all Books should also have an ISBN
attribute of type string that I want to call isbn. Will two different
users want different things and still share the same Book instance?
==> The will want user defined types
Quote:Will they be capable of defining something type-system like, e.g., all Books should also have an ISBN attribute of type string that I want to call isbn.
==> Yes
Quote:Will two different users want different things and still share the same Book instance?
==> No
Thx
Ed Merks wrote on Fri, 04 October 2013 08:13Jean-Baptise,
Comments below.
On 04/10/2013 1:57 PM, Jean-Baptiste Guillois wrote:
> Hello,
>
> First of all, i apologize for maybe not using the proper terms
> regarding ecore, models, metamodels.
>
> When using ecore, we can model concepts by defining classes and their
> attributes/relationships.
>
> Let's consider the following model, (defined using ecore):
> Class: "Book"
> Attributes: Name (String), Price (double), NoPages (int)
> Refs: author (Author)
>
> Class: "Author"
> Attributes: Name (String), NativeLang (String)
> Refs: books (Book)
>
> Now let's consider that i need to provide my users a way for defining
> custom attributes on books given the hypothesis that my users cannot
> modify the Book and Author model, they can only extend it.
That's not necessarily the only conclusion. Often models make
themselves "extensible" via some type of annotation mechanism.
> I would like them to be able to define things like a ISBN attribute
> having a String type.
So is the user capable of using Ecore so that they can define BookWithISBN?
>
> How can i use ecore (or something else) to address this kind of need?
It really depends a lot on the sophistication of your users. Do they
understand type systems? Will they want user defined types or should
you just enumerate the types? Will they be capable of defining
something type-system like, e.g., all Books should also have an ISBN
attribute of type string that I want to call isbn. Will two different
users want different things and still share the same Book instance?
>
> Many thanks for your help,
>
> Best Regards,
|
|
|
Re: How to define my own "ecore" metamodel [message #1125440 is a reply to message #1125364] |
Fri, 04 October 2013 14:05 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Jean-Baptiste,
Comments below.
On 04/10/2013 2:41 PM, Jean-Baptiste Guillois wrote:
> Thx for your quick reply
>
> Quote:
>> That's not necessarily the only conclusion. Often models make
>> themselves "extensible" via some type of annotation mechanism.
>
> ==> Right, but i consider that i have to provide my users a mechanism
> for 1) defining these extensions (new types) and 2) using these new
> types for creating their instances (both of these without requiring
> java code to be written)
That's what Ecore already does...
>
> Quote:
>> So is the user capable of using Ecore so that they can define
>> BookWithISBN?
>
> ==> Let's assume yes, I want to provide my users with a mechanism for
> doing so and force them to create "themselves" this ecore file (i may
> generate (automatically) it for them given a description/specification
> they can provide)
Okay.
>
> Quote:
>> It really depends a lot on the sophistication of your users. Do they
>> understand type systems? Will they want user defined types or should
>> you just enumerate the types? Will they be capable of defining
>> something type-system like, e.g., all Books should also have an ISBN
>> attribute of type string that I want to call isbn. Will two different
>> users want different things and still share the same Book instance?
>
> ==> The will want user defined types
>
> Quote:
>> Will they be capable of defining something type-system like, e.g.,
>> all Books should also have an ISBN attribute of type string that I
>> want to call isbn.
>
> ==> Yes
>
> Quote:
>> Will two different users want different things and still share the
>> same Book instance?
>
> ==> No
So just use Ecore. As Sylvain suggest, this is is all possible
already. Even things like
http://ed-merks.blogspot.de/2008/01/creating-children-you-didnt-know.html are
supported.
>
> Thx
>
>
>
> Ed Merks wrote on Fri, 04 October 2013 08:13
>> Jean-Baptise,
>>
>> Comments below.
>>
>> On 04/10/2013 1:57 PM, Jean-Baptiste Guillois wrote:
>> > Hello,
>> >
>> > First of all, i apologize for maybe not using the proper terms >
>> regarding ecore, models, metamodels.
>> >
>> > When using ecore, we can model concepts by defining classes and
>> their > attributes/relationships.
>> >
>> > Let's consider the following model, (defined using ecore):
>> > Class: "Book"
>> > Attributes: Name (String), Price (double), NoPages (int)
>> > Refs: author (Author)
>> >
>> > Class: "Author"
>> > Attributes: Name (String), NativeLang (String)
>> > Refs: books (Book)
>> >
>> > Now let's consider that i need to provide my users a way for
>> defining > custom attributes on books given the hypothesis that my
>> users cannot > modify the Book and Author model, they can only extend
>> it.
>> That's not necessarily the only conclusion. Often models make
>> themselves "extensible" via some type of annotation mechanism.
>> > I would like them to be able to define things like a ISBN attribute
>> > having a String type.
>> So is the user capable of using Ecore so that they can define
>> BookWithISBN?
>> >
>> > How can i use ecore (or something else) to address this kind of need?
>> It really depends a lot on the sophistication of your users. Do they
>> understand type systems? Will they want user defined types or should
>> you just enumerate the types? Will they be capable of defining
>> something type-system like, e.g., all Books should also have an ISBN
>> attribute of type string that I want to call isbn. Will two different
>> users want different things and still share the same Book instance?
>> >
>> > Many thanks for your help,
>> >
>> > Best Regards,
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Thu Sep 19 13:12:31 GMT 2024
Powered by FUDForum. Page generated in 0.04649 seconds
|