Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » support for map types in uml2 or emf
support for map types in uml2 or emf [message #35169] Thu, 25 May 2006 20:12 Go to next message
Eclipse User
Originally posted by: solomono.yahoo.com

Hi
I must create a property/attribute of type map in UML2 or EMF class
Is there a mechanism in which this can be done such that the code
generator generates the appropriate type and accessors in java, is this
possible in either emf or uml2 or both.
How is access supported through the emft ocl engine if at all
If this is not supported any direction on how to implement this would
be helpful
Solomon
Re: support for map types in uml2 or emf [message #35192 is a reply to message #35169] Thu, 25 May 2006 20:22 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Solomon,

EMF and UML are in eclipse.tools, not eclipse.technology...

There have been quite a few questions about EMap/Map support in in the
EMF newsgroup. You should search and look at those. An example of map
support is EAnnotation's details feature. An EMap is effectively just
modeled as a containment reference to objects that implement Map.Entry,
so you should be able to access them like any other containment feature.


Solomon Obi wrote:
> Hi
> I must create a property/attribute of type map in UML2 or EMF class
> Is there a mechanism in which this can be done such that the code
> generator generates the appropriate type and accessors in java, is
> this possible in either emf or uml2 or both.
> How is access supported through the emft ocl engine if at all
> If this is not supported any direction on how to implement this would
> be helpful
> Solomon
Re: support for map types in uml2 or emf [message #35464 is a reply to message #35192] Tue, 30 May 2006 07:14 Go to previous messageGo to next message
Philipp W. Kutter is currently offline Philipp W. Kutter
Messages: 301
Registered: July 2009
Senior Member
Hi, Solomon.
I would be interested in your second question, whether Ocl can access
maps specified in EMF.

Regarding the first: Ed is right the info is out there.
Collecting all the info about maps is hard, but all is there.

All you need to know is the following:
for maps being returned:

@model ... keyType="xxx" valueType="yyy"

for parameters:

@model .... myFirstParameterKeyType="aaa" myFirstParameterValueType="bbb"

Then reload the ECore from Java, and EMF will generate the
corresponding XxxToYyyMapEntry and AaaToBbbMapEntry types, and
use them as types of the return or parameter stuff.

One can as well set the map types explicitly, but we never did
this.

Regards, Philipp



Ed Merks wrote:
> Solomon,
>
> EMF and UML are in eclipse.tools, not eclipse.technology...
>
> There have been quite a few questions about EMap/Map support in in the
> EMF newsgroup. You should search and look at those. An example of map
> support is EAnnotation's details feature. An EMap is effectively just
> modeled as a containment reference to objects that implement Map.Entry,
> so you should be able to access them like any other containment feature.
>
>
> Solomon Obi wrote:
>> Hi
>> I must create a property/attribute of type map in UML2 or EMF class
>> Is there a mechanism in which this can be done such that the code
>> generator generates the appropriate type and accessors in java, is
>> this possible in either emf or uml2 or both.
>> How is access supported through the emft ocl engine if at all
>> If this is not supported any direction on how to implement this would
>> be helpful
>> Solomon
Re: support for map types in uml2 or emf [message #35507 is a reply to message #35464] Tue, 30 May 2006 11:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Philipp,

I don't think OCL is aware that there are EMaps in the model, but I
could be wrong. It will just see that as yet another containment
reference and will let you access the items by position or perhaps (I
know very little about OCL) by matching an item in the containment
reference that has a particular key value...


Philipp W. Kutter wrote:
> Hi, Solomon.
> I would be interested in your second question, whether Ocl can access
> maps specified in EMF.
>
> Regarding the first: Ed is right the info is out there.
> Collecting all the info about maps is hard, but all is there.
>
> All you need to know is the following:
> for maps being returned:
>
> @model ... keyType="xxx" valueType="yyy"
>
> for parameters:
>
> @model .... myFirstParameterKeyType="aaa" myFirstParameterValueType="bbb"
>
> Then reload the ECore from Java, and EMF will generate the
> corresponding XxxToYyyMapEntry and AaaToBbbMapEntry types, and
> use them as types of the return or parameter stuff.
>
> One can as well set the map types explicitly, but we never did
> this.
>
> Regards, Philipp
>
>
>
> Ed Merks wrote:
>> Solomon,
>>
>> EMF and UML are in eclipse.tools, not eclipse.technology...
>>
>> There have been quite a few questions about EMap/Map support in in
>> the EMF newsgroup. You should search and look at those. An example
>> of map support is EAnnotation's details feature. An EMap is
>> effectively just modeled as a containment reference to objects that
>> implement Map.Entry, so you should be able to access them like any
>> other containment feature.
>>
>>
>> Solomon Obi wrote:
>>> Hi
>>> I must create a property/attribute of type map in UML2 or EMF class
>>> Is there a mechanism in which this can be done such that the code
>>> generator generates the appropriate type and accessors in java, is
>>> this possible in either emf or uml2 or both.
>>> How is access supported through the emft ocl engine if at all
>>> If this is not supported any direction on how to implement this would
>>> be helpful
>>> Solomon
Re: support for map types in uml2 or emf [message #35537 is a reply to message #35507] Tue, 30 May 2006 13:16 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Ed, Solomon,

OCL will see a property of type Collection(EMapEntry) or whatever the type
of an entry is (I forget just now). So, this collection can be iterated
like any other and its elements accessed. The only trouble is, that the
map entry type is an EDataType, which means that OCL can't really do
anything with it.

UML allows DataTypes to define features (properties and operations), which
Ecore does not. This would be a good enhancement to raise on EMFT OCL's
bugzilla: to provide access to the features of an EDataType, as defined by
its Java implementation class.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=OCL&bug_severity=enhancement& amp;form_name=enter_bug

Cheers,

Christian

Ed Merks wrote:

> Philipp,
>
> I don't think OCL is aware that there are EMaps in the model, but I
> could be wrong. It will just see that as yet another containment
> reference and will let you access the items by position or perhaps (I
> know very little about OCL) by matching an item in the containment
> reference that has a particular key value...
>
Correction [Re: support for map types in uml2 or emf] [message #35571 is a reply to message #35537] Tue, 30 May 2006 14:16 Go to previous message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, all,

I confused the EMap representation in Ecore with something else (feature
maps), with which I am more familiar.

"feature maps" vs. "map features" -- no wonder.

Anyways, Ecore models EMap features as containment references typed by an
EClass that defines an instance class. This instance class is a kind of
Map.Entry and defines (via EOperations and EStructuralFeatures) the
features required by OCL to access the mapped keys and values.

So, you should be able to iterate the contents of your EMap feature which
OCL sees as a Collection of objects like any other, and use the entry
class's features to inspect those contents.

Of course, none of this detracts from the need for better EDataType support
in OCL.

HTH,

Christian


Christian W. Damus wrote:

>
> Hi, Ed, Solomon,
>
> OCL will see a property of type Collection(EMapEntry) or whatever the type
> of an entry is (I forget just now). So, this collection can be iterated
> like any other and its elements accessed. The only trouble is, that the
> map entry type is an EDataType, which means that OCL can't really do
> anything with it.
>
> UML allows DataTypes to define features (properties and operations), which
> Ecore does not. This would be a good enhancement to raise on EMFT OCL's
> bugzilla: to provide access to the features of an EDataType, as defined
> by its Java implementation class.
>
>
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=OCL&bug_severity=enhancement& amp;form_name=enter_bug
>
> Cheers,
>
> Christian
>
> Ed Merks wrote:
>
>> Philipp,
>>
>> I don't think OCL is aware that there are EMaps in the model, but I
>> could be wrong. It will just see that as yet another containment
>> reference and will let you access the items by position or perhaps (I
>> know very little about OCL) by matching an item in the containment
>> reference that has a particular key value...
>>
Re: support for map types in uml2 or emf [message #578924 is a reply to message #35169] Thu, 25 May 2006 20:22 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26136
Registered: July 2009
Senior Member
Solomon,

EMF and UML are in eclipse.tools, not eclipse.technology...

There have been quite a few questions about EMap/Map support in in the
EMF newsgroup. You should search and look at those. An example of map
support is EAnnotation's details feature. An EMap is effectively just
modeled as a containment reference to objects that implement Map.Entry,
so you should be able to access them like any other containment feature.


Solomon Obi wrote:
> Hi
> I must create a property/attribute of type map in UML2 or EMF class
> Is there a mechanism in which this can be done such that the code
> generator generates the appropriate type and accessors in java, is
> this possible in either emf or uml2 or both.
> How is access supported through the emft ocl engine if at all
> If this is not supported any direction on how to implement this would
> be helpful
> Solomon
Re: support for map types in uml2 or emf [message #579086 is a reply to message #35192] Tue, 30 May 2006 07:14 Go to previous message
Philipp W. Kutter is currently offline Philipp W. Kutter
Messages: 301
Registered: July 2009
Senior Member
Hi, Solomon.
I would be interested in your second question, whether Ocl can access
maps specified in EMF.

Regarding the first: Ed is right the info is out there.
Collecting all the info about maps is hard, but all is there.

All you need to know is the following:
for maps being returned:

@model ... keyType="xxx" valueType="yyy"

for parameters:

@model .... myFirstParameterKeyType="aaa" myFirstParameterValueType="bbb"

Then reload the ECore from Java, and EMF will generate the
corresponding XxxToYyyMapEntry and AaaToBbbMapEntry types, and
use them as types of the return or parameter stuff.

One can as well set the map types explicitly, but we never did
this.

Regards, Philipp



Ed Merks wrote:
> Solomon,
>
> EMF and UML are in eclipse.tools, not eclipse.technology...
>
> There have been quite a few questions about EMap/Map support in in the
> EMF newsgroup. You should search and look at those. An example of map
> support is EAnnotation's details feature. An EMap is effectively just
> modeled as a containment reference to objects that implement Map.Entry,
> so you should be able to access them like any other containment feature.
>
>
> Solomon Obi wrote:
>> Hi
>> I must create a property/attribute of type map in UML2 or EMF class
>> Is there a mechanism in which this can be done such that the code
>> generator generates the appropriate type and accessors in java, is
>> this possible in either emf or uml2 or both.
>> How is access supported through the emft ocl engine if at all
>> If this is not supported any direction on how to implement this would
>> be helpful
>> Solomon
Re: support for map types in uml2 or emf [message #579119 is a reply to message #35464] Tue, 30 May 2006 11:26 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26136
Registered: July 2009
Senior Member
Philipp,

I don't think OCL is aware that there are EMaps in the model, but I
could be wrong. It will just see that as yet another containment
reference and will let you access the items by position or perhaps (I
know very little about OCL) by matching an item in the containment
reference that has a particular key value...


Philipp W. Kutter wrote:
> Hi, Solomon.
> I would be interested in your second question, whether Ocl can access
> maps specified in EMF.
>
> Regarding the first: Ed is right the info is out there.
> Collecting all the info about maps is hard, but all is there.
>
> All you need to know is the following:
> for maps being returned:
>
> @model ... keyType="xxx" valueType="yyy"
>
> for parameters:
>
> @model .... myFirstParameterKeyType="aaa" myFirstParameterValueType="bbb"
>
> Then reload the ECore from Java, and EMF will generate the
> corresponding XxxToYyyMapEntry and AaaToBbbMapEntry types, and
> use them as types of the return or parameter stuff.
>
> One can as well set the map types explicitly, but we never did
> this.
>
> Regards, Philipp
>
>
>
> Ed Merks wrote:
>> Solomon,
>>
>> EMF and UML are in eclipse.tools, not eclipse.technology...
>>
>> There have been quite a few questions about EMap/Map support in in
>> the EMF newsgroup. You should search and look at those. An example
>> of map support is EAnnotation's details feature. An EMap is
>> effectively just modeled as a containment reference to objects that
>> implement Map.Entry, so you should be able to access them like any
>> other containment feature.
>>
>>
>> Solomon Obi wrote:
>>> Hi
>>> I must create a property/attribute of type map in UML2 or EMF class
>>> Is there a mechanism in which this can be done such that the code
>>> generator generates the appropriate type and accessors in java, is
>>> this possible in either emf or uml2 or both.
>>> How is access supported through the emft ocl engine if at all
>>> If this is not supported any direction on how to implement this would
>>> be helpful
>>> Solomon
Re: support for map types in uml2 or emf [message #579148 is a reply to message #35507] Tue, 30 May 2006 13:16 Go to previous message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Ed, Solomon,

OCL will see a property of type Collection(EMapEntry) or whatever the type
of an entry is (I forget just now). So, this collection can be iterated
like any other and its elements accessed. The only trouble is, that the
map entry type is an EDataType, which means that OCL can't really do
anything with it.

UML allows DataTypes to define features (properties and operations), which
Ecore does not. This would be a good enhancement to raise on EMFT OCL's
bugzilla: to provide access to the features of an EDataType, as defined by
its Java implementation class.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=OCL&bug_severity=enhancement& amp;form_name=enter_bug

Cheers,

Christian

Ed Merks wrote:

> Philipp,
>
> I don't think OCL is aware that there are EMaps in the model, but I
> could be wrong. It will just see that as yet another containment
> reference and will let you access the items by position or perhaps (I
> know very little about OCL) by matching an item in the containment
> reference that has a particular key value...
>
Correction [Re: support for map types in uml2 or emf] [message #579165 is a reply to message #35537] Tue, 30 May 2006 14:16 Go to previous message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, all,

I confused the EMap representation in Ecore with something else (feature
maps), with which I am more familiar.

"feature maps" vs. "map features" -- no wonder.

Anyways, Ecore models EMap features as containment references typed by an
EClass that defines an instance class. This instance class is a kind of
Map.Entry and defines (via EOperations and EStructuralFeatures) the
features required by OCL to access the mapped keys and values.

So, you should be able to iterate the contents of your EMap feature which
OCL sees as a Collection of objects like any other, and use the entry
class's features to inspect those contents.

Of course, none of this detracts from the need for better EDataType support
in OCL.

HTH,

Christian


Christian W. Damus wrote:

>
> Hi, Ed, Solomon,
>
> OCL will see a property of type Collection(EMapEntry) or whatever the type
> of an entry is (I forget just now). So, this collection can be iterated
> like any other and its elements accessed. The only trouble is, that the
> map entry type is an EDataType, which means that OCL can't really do
> anything with it.
>
> UML allows DataTypes to define features (properties and operations), which
> Ecore does not. This would be a good enhancement to raise on EMFT OCL's
> bugzilla: to provide access to the features of an EDataType, as defined
> by its Java implementation class.
>
>
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=OCL&bug_severity=enhancement& amp;form_name=enter_bug
>
> Cheers,
>
> Christian
>
> Ed Merks wrote:
>
>> Philipp,
>>
>> I don't think OCL is aware that there are EMaps in the model, but I
>> could be wrong. It will just see that as yet another containment
>> reference and will let you access the items by position or perhaps (I
>> know very little about OCL) by matching an item in the containment
>> reference that has a particular key value...
>>
Previous Topic:JET 1.0.0: incomplete xpath expressions?
Next Topic:[Announce] EMFT JETEDITOR 1.0.0RC6 is available
Goto Forum:
  


Current Time: Wed Oct 22 14:00:32 GMT 2014

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

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