Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » model with 2 nodes
model with 2 nodes [message #423662] Mon, 06 October 2008 09:21 Go to next message
Andrei is currently offline AndreiFriend
Messages: 3
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------030803060407030605060702
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I created model with 6 classes. 1 class is represented Canvas. 2,3
classes is represented nodes(as example circle and rectangle). 4 class
is link between circles, 5 class is link between rectangles, 6 class is
link between circles and rectanles.
Model is working but i think that model may be simpler.
Do i need to create a more link -class if I add triangle to set of
nodes? Or links between nodes may do simpler (with less counts of classes)?
Thanks!
Andrei

--------------030803060407030605060702
Content-Type: text/xml;
name="Classmodel.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Classmodel.ecore"

<?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="classmodel"
nsURI="http://classmodel" nsPrefix="classmodel">
<eClassifiers xsi:type="ecore:EClass" name="Class">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Relations">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//Class"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//Class"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ClassDiagramm">
<eStructuralFeatures xsi:type="ecore:EReference" name="hasClasses" upperBound="-1"
eType="#//Class" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="hasRelations" upperBound="-1"
eType="#//Relations" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="hasMegaClasses" upperBound="-1"
eType="#//MegaClass" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="hasMegaRelations" upperBound="-1"
eType="#//MegaRelations" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="hasSuperRelations" upperBound="-1"
eType="#//SuperRelations" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MegaClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MegaRelations">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="MegaSource" eType="#//MegaClass"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="MegaTarget" eType="#//MegaClass"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SuperRelations">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//MegaClass"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//Class"/>
</eClassifiers>
</ecore:EPackage>

--------------030803060407030605060702--
Re: model with 2 nodes [message #423664 is a reply to message #423662] Mon, 06 October 2008 11:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30813
Registered: July 2009
Senior Member
Andrei,

Comments below.


Andrei wrote:
> Hi,
> I created model with 6 classes. 1 class is represented Canvas. 2,3
> classes is represented nodes(as example circle and rectangle). 4 class
> is link between circles, 5 class is link between rectangles, 6 class
> is link between circles and rectanles.
> Model is working but i think that model may be simpler.
> Do i need to create a more link -class if I add triangle to set of
> nodes? Or links between nodes may do simpler (with less counts of
> classes)?
You don't need classes to represent links in GMF. An EReference between
EClasses can be used to represent a link. But it's okay to have them
too... I believe GMF allows the same object to have different shapes
depending on properties of the object; I'm not sure about that. You're
best to ask GMF questions on the GMF newsgroup...

> Thanks!
> Andrei
Re: model with 2 nodes [message #423665 is a reply to message #423662] Mon, 06 October 2008 11:10 Go to previous message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello Andrei,

You could create a common base class "Node" for circle and rectangle. The
link class should connect nodes of any type through polymorphism.

Enrico

Andrei wrote:

> Hi,
> I created model with 6 classes. 1 class is represented Canvas. 2,3
> classes is represented nodes(as example circle and rectangle). 4 class
> is link between circles, 5 class is link between rectangles, 6 class is
> link between circles and rectanles.
> Model is working but i think that model may be simpler.
> Do i need to create a more link -class if I add triangle to set of
> nodes? Or links between nodes may do simpler (with less counts of
> classes)? Thanks!
> Andrei
Previous Topic:Scheme editor, ecore to gmf
Next Topic:Instantiating an ecore metamodel
Goto Forum:
  


Current Time: Sat Jan 25 10:53:53 GMT 2020

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

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

Back to the top