Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Implementation of instance-of references
Implementation of instance-of references [message #884514] Mon, 11 June 2012 08:25
Stefan WülfrathFriend
Messages: 18
Registered: February 2012
Junior Member
Hi,

I have a problem with my current modeling task:

I want to model an instance-of reference in Ecore. I have created a metamodel for description of a kind of networks:

- EClass "Network": holds all element types, elements and connections
- EClass "ElementType": defines a possible network element and its ports
- EClass "Element": instance-of "ElementType", one concrete network element
- EClass "ConnectionPort": a port of an element which is used by the "Connection" to connect to elements
- EClass "Connection": connects two connection ports

Each "ElementType" declaration contains a definition of the element's connection ports. As "Element" is an instance of "ElementType" it holds copies of the connection ports defined by its type.

Currently I simply copy (EcoreUtil.copyAll) the connection ports from "ElementType" to "Element" on first access to the getInPorts()/getOutPorts() method of "Element". This has many issues as unresolved proxies and duplicate "ConnectionPort" objects.

Do you have an idea of how I could do this in a better way?

Thank you very much for your help!

Best regards,
Stefan Wülfrath

The metamodel (in MinimalEcore syntax):

abstract interface NamedElement (
  name EString
)
Network : NamedElement (
  // types
  elementTypes ElementType*
  // network elements
  elements Element*
  connections Connection*
)
ElementType : NamedElement (
  inPorts ConnectionPort*
  outPorts ConnectionPort*
)
Element : NamedElement (
  ~elementType ElementType // models the instance-of reference
  inPorts ConnectionPort* // defined by elementType, should be copied
  outPorts ConnectionPort* // defined by elementType, should be copied
)
ConnectionPort : NamedElement (
  ~incomingConnections Connection* <> Connection.target
  ~outgoingConnections Connection* <> Connection.origin
)
Connection : NamedElement (
  ~origin ConnectionPort <> ConnectionPort.outgoingConnections
  ~target ConnectionPort <> ConnectionPort.incomingConnections
)

[Updated on: Mon, 11 June 2012 08:39]

Report message to a moderator

Previous Topic:An "intelligent" autocomplete function for Ecore diagram editors
Next Topic:[xcore] Two metamodels where one refers to the other
Goto Forum:
  


Current Time: Thu Aug 22 07:46:37 GMT 2019

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

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

Back to the top