Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Doubt defining my ecore model
Doubt defining my ecore model [message #511217] Sun, 31 January 2010 06:29 Go to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
Hi,

I'm trying to define a ecore model that i need to develope a emf widget editor (to verify the result), and then a gmf based grapic editor.

I've tried to define it from a xml schema, the problem is that in practice the schema contains numerous details that I don't care (schema import and other..) and increase the complexity of the result.
So because I think that my model domain is simple, I've tried to define manually (via uml diagram editor), but unsuccessfully .

Below this a description of the model and problems that I've encountered in its manual definition

---------description of domain model----------
I have 4 element to model (.. ..and finally to draw)
-1-One with an ID EString Attribute
-2-Two
-3-Three
--I suppose that all are children of an Abstract class "number" (that i don't nedd to draw, and I don't care)

-4-Then there is another elemente "item" with id1 and id2 attriburte (EString type)

Well my problem is to understand the relationship (how to model them?) betwen 1,2,3 and item when the expected structure is like below defined :

The Root is one element (every instances of my model is contained in a "one" element) then

one element can contain:
-0 or unbounded item
-0 or unbounded two
-0 or unbounded three

item element can contain
-0 or unbounded one

two element can contain
-0 or unbounded one
-0 or unbounded item
-0 or unbounded three

three element can contain
-0 or unbounded one
-0 or unbounded two
-0 or unbounded item

Re: Doubt defining my ecore model [message #511225 is a reply to message #511217] Sun, 31 January 2010 09:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
Comments below.

M. wrote:
> Hi,
>
> I'm trying to define a ecore model that i need to develope a emf
> widget editor (to verify the result), and then a gmf based grapic
> editor.
>
> I've tried to define it from a xml schema, the problem is that in
> practice the schema contains numerous details that I don't care
> (schema import and other..) and increase the complexity of the result.
> So because I think that my model domain is simple, I've tried to
> define manually (via uml diagram editor), but unsuccessfully .
Using Ecore Tools to directly edit Ecore would seem more direct and simpler.
>
> Below this a description of the model and problems that I've
> encountered in its manual definition
>
> ---------description of domain model----------
> I have 4 element to model (.. ..and finally to draw)
> -1-One with an ID EString Attribute
> -2-Two
> -3-Three
> --I suppose that all are children of an Abstract class "number" (that
> i don't nedd to draw, and I don't care)
>
> -4-Then there is another elemente "item" with id1 and id2 attriburte
> (EString type)
>
> Well my problem is to understand the relationship (how to model them?)
> betwen 1,2,3 and item when the expected structure is like below defined :
>
> The Root is one element (every instances of my model is contained in a
> "one" element) then
>
> one element can contain:
> -0 or unbounded item
> -0 or unbounded two
> -0 or unbounded three
>
> item element can contain
> -0 or unbounded one
>
> two element can contain
> -0 or unbounded one
> -0 or unbounded item
> -0 or unbounded three
>
> three element can contain
> -0 or unbounded one
> -0 or unbounded two
> -0 or unbounded item
I'm just not sure what your question is. By the time you describe what
you want completely, you'd have spelled out exactly what your Ecore
model should be. Even the Sample Ecore Editor is not so hard to use...
>
>
Re: Doubt defining my ecore model [message #511227 is a reply to message #511217] Sun, 31 January 2010 09:43 Go to previous messageGo to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
well,

I've modeled the containment relationship betwen element (eclass), like aggregation 0..*. .

-So, I'm not sure of this choice because there are numeros aggregations in both directions?

-Then another question is: if (and eventually how) the concept of "Root" element (external container of all, but that can also contain itself) can be modeled in ecore (this interest me also because in the gmf generator process I need indicate a root element..)

----


I've tried to remake my ecore like I think (adding only a Root Element)

image of ecore here (note: name used are different not one,two,three but policy,all,excatlyone and policyassertion for item)
Problem: why when i run editor (as Eclpise application) and create in a new general project a file "wplocy Model" I can't make child that I need? image here

[Updated on: Sun, 31 January 2010 11:55]

Report message to a moderator

Re: Doubt defining my ecore model [message #511240 is a reply to message #511227] Sun, 31 January 2010 12:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
Comments below.

M. wrote:
> well,
>
> I've modeled the containment relationship betwen element (eclass),
> like aggregation 0..*. .
>
> -So, I'm not sure of this choice because there are numeros
> aggregations in both directions?
Aggregation is of course directional so you need to be sure you're
inducing the tree structure you really want. Keep in mind that
containment is very strict: an object can be contained under at most one
parent...
> -Then another question is: if (and eventually how) the concept of
> "Root" element (external container of all, but that can also contain
> itself) can be modeled in ecore (this interest me also because in the
> gmf generator process I need indicate a root element..)
It's quite reasonable that an object can contain itself. For example,
consider that an EPackage has a eSubpackages reference so while an
EPackage is typically a root container, it can also contain another
package instance.
Re: Doubt defining my ecore model [message #511242 is a reply to message #511240] Sun, 31 January 2010 12:59 Go to previous messageGo to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
[quote title=Ed Merks wrote on Sun, 31 January 2010 12:24]
> -So, I'm not sure of this choice because there are numeros
> aggregations in both directions?
Aggregation is of course directional so you need to be sure you're
inducing the tree structure you really want. Keep in mind that
containment is very strict: an object can be contained under at most one
parent...

Uhm, the strict relation (you've remembered ) is on the objects which instantiate their classes (in aggregation relation), so that one instance can be contained only in one father . I presume this is not a limit for my domain model.

(..aggregation betwen class in my modle create cycle like in a graph not tree.)

Try to look the image i've posted upon, One is for my ecore and another for the generated editor in runtime (I can't make child to my tree?)

Re: Doubt defining my ecore model [message #511314 is a reply to message #511242] Mon, 01 February 2010 04:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
I don't see any pictures. By default, to create children for some
class, that class needs to have containment references. You can use the
properties view to reference already existing nodes, thereby inducing a
graph structure rather than only a tree structure.


M. wrote:
> [quote title=Ed Merks wrote on Sun, 31 January 2010 12:24]
>> -So, I'm not sure of this choice because there are numeros
>> aggregations in both directions?
> Aggregation is of course directional so you need to be sure you're
> inducing the tree structure you really want. Keep in mind that
> containment is very strict: an object can be contained under at most
> one parent...
>
> Uhm, the strict relation (you've remembered ) is on the objects which
> instantiate their classes (in aggregation relation), so that one
> instance can be contained only in one father . I presume this is not a
> limit for my domain model.
>
> (..aggregation betwen class in my modle create cycle like in a graph
> not tree.)
>
> Try to look the image i've posted upon, One is for my ecore and
> another for the generated editor in runtime (I can't make child to my
> tree?)
>
>
Re: Doubt defining my ecore model [message #511514 is a reply to message #511314] Mon, 01 February 2010 15:43 Go to previous messageGo to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
while I reflect on your words, I resend link with the images that I previously


http://i50.tinypic.com/5xlc85.jpg
http://i48.tinypic.com/54b1gx.jpg
Re: Doubt defining my ecore model [message #511728 is a reply to message #511314] Tue, 02 February 2010 11:35 Go to previous messageGo to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
Ed Merks wrote on Mon, 01 February 2010 04:02
I don't to create children for some class, that class needs to have containment references. You can use the properties view to reference already existing nodes, thereby inducing a graph structure rather than only a tree structure.


Ops Ok, Now I've setted the "containement" on true in ecore model (for every reference that I need), then in the property view of genmodel also setted true "children" and "create child" (edit section).


Then when I run as Eclipse Application result is correct Smile but:
-when I add child I need to refresh to see them
-When I click "save" then I get an error: image below represent the message error (edited structure in "outline" view) ?

http://i45.tinypic.com/2e3nxj6.jpg
Re: Doubt defining my ecore model [message #511936 is a reply to message #511728] Wed, 03 February 2010 08:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
M,

Comments below.

M. wrote:
> Ed Merks wrote on Mon, 01 February 2010 04:02
>> I don't to create children for some class, that class needs to have
>> containment references. You can use the properties view to reference
>> already existing nodes, thereby inducing a graph structure rather
>> than only a tree structure.
>
>
> Ops Ok, Now I've setted the "containement" on true in ecore model (for
> every reference that I need), then in the property view of genmodel
> also setted true "children" and "create child" (edit section).
Did you set Notify to true?
>
>
> Then when I run as Eclipse Application result is correct :) but:
> -when I add child I need to refresh to see them -
Probably you didn't set those features to notify.
> When I click "save" then I get an error: image below represent the
> message error (edited structure in "outline" view) ?
I can't see the error message. Your images never seem to make it... Is
it an error about dangling references. That's likely caused by setting
a non-containment reference to support children creation; you need to
specialize the logic to decide where such a new child will actually be
contained.
>
>
>
Re: Doubt defining my ecore model [message #514301 is a reply to message #511936] Sat, 13 February 2010 15:49 Go to previous messageGo to next message
M.  is currently offline M.
Messages: 19
Registered: November 2009
Junior Member
auto refresh correct with "notify" setted true. thanks

But when I save I've always problem, the message is:

"org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'Wpolicy.impl.PolicyImpl@cdd92e (id: null)' is not contained in a resource."

Re: Doubt defining my ecore model [message #514304 is a reply to message #514301] Sat, 13 February 2010 16:06 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25918
Registered: July 2009
Senior Member
You'd get this if you support child creation for a reference that isn't
containment. It indicates there's a reference to an object not
contained by any parent object and not contained directly in a resource.


M. wrote:
> auto refresh correct with "notify" setted true. thanks
>
> But when I save I've always problem, the message is:
>
> "org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The
> object mailto:'Wpolicy.impl.PolicyImpl@cdd92e (id: null)' is not
> contained in a resource."
>
>
Previous Topic:Pattern for corecing Java datatypes to EObject
Next Topic:[Teneo/EclipseLInk] ORM Generator and multiple inheritance
Goto Forum:
  


Current Time: Thu Jul 24 21:53:45 EDT 2014

Powered by FUDForum. Page generated in 0.02893 seconds