Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using two models in a single project
Using two models in a single project [message #719366] Fri, 26 August 2011 20:19 Go to next message
Elvis  is currently offline Elvis Friend
Messages: 15
Registered: May 2011
Junior Member
Hi Guys,

Would anyone tell me how can I instantiate two models within a single project. example:

Model 1 (Conceptual Diagram):
@namespace(uri="diagramConceptual", prefix="diagramConceptual")
package diagramConceptual;

@gmf.diagram(foo="bar")
class Schema {
	val Entity[*] entity_schema;
	val Attribute[*] attribute_schema;
	val Relationship[*] relationship_schema;
	val AttributeLink[*] attributeLink_schema;
	val RelationshipLink[*] relationshipLink_schema;
}

@gmf.node(label="name", label.icon="false", figure="rectangle", size="100,50")
class Entity {
	attr String name;
}

@gmf.node(label="name", label.icon="false", figure="ellipse", size="100,50")
class Attribute {
	attr String name;
}

@gmf.node(label="name", label.icon="false", size="100,50")
class Relationship {
	attr String name;
}

@gmf.link(source="source", target="target")
class AttributeLink {
	ref Entity[1] source;
	ref Attribute[1] target;
}

@gmf.link(source="source", target="target")
class RelationshipLink {
	ref Entity[1] source;
	ref Relationship[1] target;
}


Model 2 (Class Diagram):
@namespace(uri="diagramClass", prefix="diagramClass")
package diagramClass;

@gmf.diagram(foo="bar")
class Diagram {
	val Table[*] table_diagram;
	val RelationshipLink[*] relationshipLink_diagram;
}

@gmf.node(label="name", label.icon="false", figure="rectangle")
class Table {
   attr String name;
   @gmf.compartment(layout="list", collapsible="false")
   val Attribute[*] attributes;
}

@gmf.node(label="name,type", figure="rectangle", label.icon="false", label.pattern="{0}:{1}")
class Attribute {
   attr String name;
   attr String type;
}

@gmf.link(source="source", target="target")
class RelationshipLink {
	ref Table[1] source;
	ref Table[1] target;
}


How to create a project "DatabaseProject" and after run it and working with two instances "Conceptual Diagram" and "Class Diagram" at the same time?

Thanks very much in advance for your answers!

Elvis
Re: Using two models in a single project [message #719540 is a reply to message #719366] Sat, 27 August 2011 17:10 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

I'm not quite sure I understood your question. Do you want to generate a GMF editor for each model, but place the code for both models in the same plugins, so you'll only have DatabaseProject, DatabaseProject.edit, DatabaseProject.editor and DatabaseProject.diagram?

In that case, it should be enough to simply place both .emf files in the DatabaseProject project and then generate the GMF editors using Eugenia. I have just tried that and it seems to work.

However, I don't think this would be the cleanest approach. Normally, I would use separate plugins for separate metamodels, so I'd have the ConceptualMetamodel.* plugins and the DiagramMetamodel.* plugins.
Re: Using two models in a single project [message #719712 is a reply to message #719540] Sun, 28 August 2011 15:09 Go to previous message
Elvis  is currently offline Elvis Friend
Messages: 15
Registered: May 2011
Junior Member
Hi Antonio,

Thanks for the help. After watching the Screencasts (Establishing links between EMF models) I was in doubt of what would be the best way to work with two models, because plan to use EGL to generate a model through the other. Anyway I will follow your guidelines and use two separate plugins.

Thank you very much

Elvis
Previous Topic:[Flock] error while executing migration strategy distributed via plugin
Next Topic:Method 'getContainmentReferences' not found (190:38)
Goto Forum:
  


Current Time: Thu Apr 25 21:09:10 GMT 2024

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

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

Back to the top