Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Metamodel for ecoremodel
Metamodel for ecoremodel [message #416772] Mon, 18 February 2008 13:49 Go to next message
justin Mising name is currently offline justin Mising nameFriend
Messages: 28
Registered: July 2009
Junior Member
Hi ,

I have the following scenario:
There are 2 entities in a domain model.
Item and User.
User may/may not buy items.Basically,it is a aggregation relationship with
0..* at one-end.
When I convert UML model to ecore model,there is no difference between
aggregation and composition representation in ecore except for
containment='true'.
I need to differentiate between aggregation and composition representation
in ecore so that I can use the appropriate relationship in hibernate.XPath
doesn't differentiate this directly.

I think we need to have/make a metamodel for the ecore model to be able to
represent the aggregation and composition so that we can differentiate
between these two in a single parsing of ecore file.Is this understanding
right?

Is there a metamodel for ecore model already?
Kindly let me at the earliest possible.

Source ecore file is given below.

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="AuctionModel"
nsURI="http:///AuctionModel.ecore" nsPrefix="AuctionModel">

<eClassifiers xsi:type="ecore:EClass" name="Item">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
ordered="false" lowerBound="1"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="createdDate"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="price"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EInt"/>

<eStructuralFeatures xsi:type="ecore:EReference" name="bid"
ordered="false" upperBound="-1"
eType="#//Bid" containment="true" eOpposite="#//Bid/item"/>

<eStructuralFeatures xsi:type="ecore:EReference" name="user"
ordered="false" lowerBound="1"
eType="#//User" eOpposite="#//User/item"/>

</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bid">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="amount"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EInt"/>

<eStructuralFeatures xsi:type="ecore:EReference" name="user"
ordered="false" eType="#//User"/>

<eStructuralFeatures xsi:type="ecore:EReference" name="item"
ordered="false" lowerBound="1"
eType="#//Item" eOpposite="#//Item/bid"/>

</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="User">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="billingAddress"
ordered="false"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>

<eStructuralFeatures xsi:type="ecore:EReference" name="item"
ordered="false" upperBound="-1"
eType="#//Item" eOpposite="#//Item/user"/>
</eClassifiers>
</ecore:EPackage>


Thanks,
Justin.
Re: Metamodel for ecoremodel [message #416773 is a reply to message #416772] Mon, 18 February 2008 14:34 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090809050607050906050900
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Justin,

The ecore metamodel is "Ecore.ecore" in the plug-in
org.eclipse.emf.ecore, folder "model". You can retrieve either the
earliest or the latest version of this model on eclispe CVS.

Regards,
Laurent Goubet
Obeo

jap a
Re: Metamodel for ecoremodel [message #416903 is a reply to message #416772] Tue, 19 February 2008 19:37 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi Justin,

I believe that EReference.containment is directly analogous to
composition. So, if containment==true, you consider it composition. Is
that not sufficient?

Cheers,
Dave

jap wrote:
> Hi ,
>
> I have the following scenario:
> There are 2 entities in a domain model.
> Item and User.
> User may/may not buy items.Basically,it is a aggregation relationship
> with 0..* at one-end.
> When I convert UML model to ecore model,there is no difference between
> aggregation and composition representation in ecore except for
> containment='true'.
> I need to differentiate between aggregation and composition
> representation in ecore so that I can use the appropriate relationship
> in hibernate.XPath doesn't differentiate this directly.
>
> I think we need to have/make a metamodel for the ecore model to be able
> to represent the aggregation and composition so that we can
> differentiate between these two in a single parsing of ecore file.Is
> this understanding right?
>
> Is there a metamodel for ecore model already?
> Kindly let me at the earliest possible.
>
> Source ecore file is given below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="AuctionModel"
> nsURI="http:///AuctionModel.ecore" nsPrefix="AuctionModel">
>
> <eClassifiers xsi:type="ecore:EClass" name="Item">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> ordered="false" lowerBound="1"
> eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="createdDate"
> ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="price"
> ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="bid"
> ordered="false" upperBound="-1"
> eType="#//Bid" containment="true" eOpposite="#//Bid/item"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="user"
> ordered="false" lowerBound="1"
> eType="#//User" eOpposite="#//User/item"/>
>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Bid">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="amount"
> ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="user"
> ordered="false" eType="#//User"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="item"
> ordered="false" lowerBound="1"
> eType="#//Item" eOpposite="#//Item/bid"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="User">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName"
> ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName"
> ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="billingAddress" ordered="false"
> lowerBound="1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="item"
> ordered="false" upperBound="-1"
> eType="#//Item" eOpposite="#//Item/user"/>
> </eClassifiers>
> </ecore:EPackage>
>
>
> Thanks,
> Justin.
>
>
>
Previous Topic:Unable to get the ecore namespace and schema
Next Topic:Clone an EResource
Goto Forum:
  


Current Time: Thu Apr 25 08:46:05 GMT 2024

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

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

Back to the top