alexroldugin / spray

Automatically exported from code.google.com/p/spray
0 stars 0 forks source link

Enable definition of connection by given start and end element #168

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently there must exist a domain meta model element that can be mapped to a 
connection. This domain meta model element holds references to the start and 
the end element. But the more common case is, that there two elements that have 
uni- o bi-directional association to each other without such an extra third 
element.

In the DSL it should be possible, to write something like this:

classes Element1 alias e1, Element2 alias e2 {
    connection  ( )
    {
        from e1.element2Reference // this is the reference of type Element2
        to   e2.element1Reference // this is the reference of type Element1
    }
}

In the example above there is a bi-directional association between Element1 and 
Element2 assumed. Note that there might be different association roles between 
Element1 and Element2 defined like Person.parents->Person*, 
Person.siblings->Person*

The following example shows the case when there is only a uni-directional 
relationship from Element2 to Element1, i.e. Element1 does not know that it is 
referenced by Element2:

classes Element1 alias e1, Element2 alias e2 {
    connection  ( )
    {
        from e1 // this is the reference of type Element2
        to   e2.element1Reference // this is the reference of type Element1
    }
}

If there is only one relationship feature on each Element of the corresponding 
type the relationship feature may left off in the definition:

classes Element1 alias e1, Element2 alias e2 {
    connection  ( )
    {
        from e1 // this is the reference of type Element2
        to   e2 // this is the reference of type Element1
    }
}

Original issue reported on code.google.com by de.abg.r...@gmail.com on 2 Sep 2012 at 11:34

GoogleCodeExporter commented 8 years ago
This is currently possible using:

class BusinessClass alias FullClass {
      container  ( fill=dark_green ) 
    {
          text ( )  { "<<"+eClass.name+">> " + name};
    }   
    references {   
         superclass : connection( )
    }
    behavior {
        create into types palette "Shapes"  askFor name ; 
    }

The superclass is just an EReference in the domain model.  I think it makes 
sense to define this inside the meta class in which the reference is defined, 
as is done here.

Original comment by joswar...@gmail.com on 3 Nov 2012 at 6:22

GoogleCodeExporter commented 8 years ago
with new syntax:

class EClass {
   ...
   references {
       eSuperTypes : connection ReferenceConnection
       {
          name into name
       } 
   }
   ...
}

(ReferenceConnection is defined in shape DSL)

Origin in the class itself and the target is restricted by the type of the 
ERreference.

Please note the existing issue with bidirectional references: 
http://code.google.com/a/eclipselabs.org/p/spray/issues/detail?id=270

Original comment by de.abg.r...@gmail.com on 14 Jul 2013 at 1:21