Top Banner
® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM [email protected] ADTF, OMG March 2010, Washington DC
30

® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM [email protected] ADTF, OMG March 2010, Washington.

Mar 26, 2015

Download

Documents

Landon Warren
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

®

IBM Software Group

© 2006 IBM Corporation

Diagram Definition: Revised Submission

Maged Elaasar, [email protected]

ADTF, OMG March 2010, Washington DC

Page 2: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

2

DD Joint Submission Team

Submitters Adaptive

Deere & Company

Fujitsu

International Business Machines

Model Driven Solutions

Sparx Systems

Supporters Trisotech

U.S. National Institute of Standards and Technology

Page 3: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

3

Diagram Definition Time Line

September 2007 February 2009 May 2010 September 2010

RFP Initial Submission Revised Submission Voting

Page 4: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

4

Diagram Definition RFP Requirements

Enable diagram interchange between tools of a given language Currently only the abstract syntax models can be interchanged

Current DI spec provides a solution but it is not adequate because:

Fixed metamodel that cannot be used to specify language-specific idioms.

Mixes between what needs to be interchanged and what is fixed.

Enable formal specification of the concrete graphical syntax of a language Currently graphical syntax and its mapping to the abstract syntax is specified using

pictures and informal text.

The lack of precision leads to confusion and ambiguity increasing cost/effort

Page 5: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

5

Diagram Definition Submission

Enable diagram interchange between tools of a given language Provides a new abstract Diagram Interchange (DI) metamodel

Defines common DI abstractions, relationships and assumptions

References abstract syntax (AS) model elements

Gets extended by concrete language-specific DI metamodels.

Provides base for integration between various language notations

Enable formal specification of the concrete graphical syntax of a language Provides a new Diagram Graphics (DG) metamodel

Defines well-known graphics abstractions, primitives and idioms.

Is inspired by other popular graphics standards like SVG and CSS.

Proposes using a mapping language (e.g. QVT) to map language-specific DI to DG

Maps elements of DI and their referenced AS elements to elements of DG

Results in DG models that depict the graphical syntax of models

Page 6: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

6

Outline

DD Architecture

DI Metamodel

Example: UML DI Metamodel

DG Metamodel

Example: QVT Mapping from UML DI to DG

Page 7: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

7

MOF

DI

AS

M3 spec

M2 spec

M1 user

AS DI

Model Diagram

AbstractSyntax

DiagramSyntax

CS MappingSpecification

Graphics

ConcreteSyntax

CS Mapping

Model(interchanged)

MappingLanguage

MOF

View(rendered)

Controller(executed)

Instantiates

Specializes

References

AS: Abstract Syntax

CS : Concrete Syntax

DG

DD Spec

LanguageSpec

DI : Diagram Interchange

DG: Diagram Graphics

DD Architecture

Page 8: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

8

DI

UML

M3

M2

M1

UML DI

AbstractSyntax

DiagramSyntax

UML MappingSpecification

ConcreteSyntax

UML Mapping

Model

MappingLanguage

ViewController

DG

Instantiates

Specializes

References

DD Spec

UMLSpec

DI : Diagram Interchange

DG: Diagram Graphics

MOF MOF

Example : UML DD Architecture

Page 9: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

9

Diagram Common (DC) Metamodel

Defines data types that are common between DI and DG: Primitive types: Boolean, String, Integer, Real

2D Layout types: Point (x, y), Dimension (w, h), Bounds (x, y, w, h)

Color types: Color (r, g, b), KnownColor (red, green, yellow…etc)

Defines common geometrical assumptions: Measurement Unit: user units (logical)

A mapping to inches (physical) provided as diagram resolution

Coordinate System: x-y based

Origin at 0,0 and Increases to right and down

Negative coordinates allowed

Z-Order: based on rules

Owned element > owning element

Sibling at higher index > sibling at lower index

Rotation: in degrees

Can be +ve (clockwise) or –ve

Page 10: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

10

Diagram Interchange (DI) Metamodel DiagramElement is the basic building block of a diagram

Can reference an optional model element

Can have an optional local and/or shared style

Can nest other diagram elements

Style is a bag of optional

properties affecting the styling

of diagram elements

Page 11: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

11

Diagram Interchange (DI) Metamodel

Diagram is a container of a hierarchy of diagram elements The root of the hierarchy is of type Plane (next slide)

Can own styles shared by diagram elements in the diagram

DiagramCollection is a container of a collection of diagrams Can own styles shared by diagram elements across diagrams

Page 12: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

12

Diagram Interchange (DI) Metamodel Plane defines a 2-dimensional x-y coordinate system

Owns an ordered collection of plane elements

PlaneElement is the super type of elements laid out relative to their plane Owns a collection of labels

Label is an attachment to a plane element Has its own optional bounds relative the plane

When bounds are not specified

it is positioned automatically

Page 13: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

13

Diagram Interchange (DI) Metamodel

Shape is a plane element specified with a rectangular bounds on the plane

Edge is a plane element specified with a set of points relative to the plane represents a line connecting two plane elements: a source and a target

Page 14: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

14

Example: UML DI Metamodel

Page 15: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

15

Example: UML DI Metamodel

Page 16: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

16

Diagram Graphics (DG) Metamodel

GraphicalElement is the basic building block of graphics Can have a local and a share style

Can be transformed with a list of transforms

Can be clipped with a clip path

Page 17: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

17

Diagram Graphics (DG) Metamodel

Many primitive graphical elements

are defined

Others can be defined

at M1

Page 18: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

18

Diagram Graphics (DG) Metamodel Group is a graphical element that nests other elements as members

Canvas is the top most group and defines a 2-dimentional coordinate system Owns shared elements (Fills and Markers) referenced by other elements

ClipPath is a group that defines

a clip path as the union of the

the outlines of its members

Page 19: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

19

Diagram Graphics (DG) Metamodel Fill is a definition of how to fill enclosed areas of graphical elements

Two types of Fill exist: Gradient and Pattern

Style is a bag of optional properties affecting the styling of graphical elements

Page 20: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

20

Diagram Graphics (DG) Metamodel PathCommand is an instruction to manipulate

the current pen in the canvas

Tansform is a definition of a

change to do to a graphical element

Page 21: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

21

Example: QVT Mapping from UML DI to DGmodeltype DC uses 'http://www.omg.org/spec/DD/20100525/DC';

modeltype DI uses 'http://www.omg.org/spec/DD/20100525/DI';

modeltype DG uses 'http://www.omg.org/spec/DD/20100525/DG';

modeltype UMLDI uses 'http://www.omg.org/spec/UML/20100525/DI';

modeltype UML uses 'http://www.omg.org/spec/UML/20090901';

transformation umldi2dg(in umldi : UMLDI, out DG)

{

main() {

umldi.objectsOfType(UMLDI::UMLPlane)->map planeToGraphicalElement();

}

mapping UMLDI::UMLPlane::planeToGraphicalElement() : DG::Canvas

inherits DI::DiagramElement::diagramElementToGraphicalElement

{

member += self.planeElement->map planeElementToGraphicalElement();

}

}

UMLPlane

DG

Canvas

UMLDI

PlaneElement

Group

Page 22: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

22

Example: QVT Mapping from UML DI to DGmapping DI::PlaneElement::planeElementToGraphicalElement() : DG::Group {

init {

result := switch {

case (self.oclIsKindOf(UMLDI::UMLShape))

self.oclAsType(UMLDI::UMLShape).map shapeToGraphicalElement();

case (self.oclIsKindOf(UMLDI::UMLEdge))

self.oclAsType(UMLDI::UMLEdge).map edgeToGraphicalElement();

};

}

}

mapping UMLDI::UMLShape::shapeToGraphicalElement() : DG::Group

inherits DI::DiagramElement::diagramElementToGraphicalElement

{

member += self.umlElement.map shapeToGraphicalElement(self);

member += self.label.map labelToGraphicalElement();

member += self.compartment->map compartmentToGraphicalElement();

}

mapping UMLDI::UMLEdge::edgeToGraphicalElement() : DG::Group

inherits DI::DiagramElement::diagramElementToGraphicalElement

{

member += self.umlElement.map edgeToPolyline(self);

member += self.label.map labelToGraphicalElement();

}

UMLShape

DG

Group

UMLDI

UML::Element

UMLEdge

Group

GraphicalElement

UMLLabel

UMLCompartment

UMLLabel

Text

Group

Text

Polyline

Page 23: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

23

Example: QVT Mapping from UML DI to DGmapping UMLDI::UMLCompartment::compartmentToGraphicalElement() : DG::Group

inherits DI::DiagramElement::diagramElementToGraphicalElement

{

member := object DG::Rectangle { bounds := newBounds(self.bounds) };

member += self.label.map labelToGraphicalElement();

member += self.planeElement->map planeElementToGraphicalElement();

}

mapping UMLDI::UMLLabel::labelToGraphicalElement() : DG::Text

inherits DI::DiagramElement::diagramElementToGraphicalElement

{

bounds := newBounds(self.bounds);

switch {

case (self.kind = UMLDI::UMLLabelKind::name)

{var diagramElement = self.owningElement.oclAsType(UMLDI::UMLDiagramElement);

data := diagramElement.umlElement.oclAsType(UML::NamedElement).name(diagramElement);}

case (self.kind = UMLDI::UMLLabelKind::sourceRole)

data := association.memberEnd->at(1).role();

case (self.kind = UMLDI::UMLLabelKind::targetRole)

data := self.owningElement.modelElement.oclAsType(UML::Association).memberEnd->at(2).role();

case (self.kind = UMLDI::UMLLabelKind::sourceMultiplicity)

data := self.owningElement.modelElement.oclAsType(UML::Association).memberEnd->at(1).multiplicity();

case (self.kind = UMLDI::UMLLabelKind::targetMultiplicity)

data := self.owningElement.modelElement.oclAsType(UML::Association).memberEnd->at(2).multiplicity();

case (self.kind = UMLDI::UMLLabelKind::title)

data := self.owningElement.oclAsType(UMLDI::UMLCompartment).title();

};

}

UMLCompartment

DGGroup

UMLDI

Rectangle

UMLLabel

Text

Group

PlaneElement

Page 24: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

24

Example: QVT Mapping from UML DI to DGabstract mapping DI::DiagramElement::diagramElementToGraphicalElement() : DG::GraphicalElement {

var s : DG::Style;

if self.localStyle->notEmpty() and self.localStyle.oclIsKindOf(UMLDI::UMLStyle) then

s := object DG::Style {if not localStyle.oclIsSet(fontName) then fontName := ds.fontName endif;if not localStyle.oclIsSet(fontSize) then fontSize := ds.fontSize endif;

}

endif;

if self.sharedStyle->notEmpty() and self.sharedStyle.oclIsKindOf(UMLDI::UMLStyle) then

s := object DG::Style {if not localStyle.oclIsSet(fontName) then fontName := ds.fontName endif;if not localStyle.oclIsSet(fontSize) then fontSize := ds.fontSize endif;

}

endif;

localStyle := s;

}

Page 25: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

25

Example: QVT Mapping from UML DI to DGmapping UML::Element::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement {

init {}

}

mapping UML::Classifier::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement {

init {

result := object DG::Rectangle { bounds := newBounds(shape.bounds) };

}

}

mapping UML::Property::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement {

init {

result := object DG::Text {

bounds := newBounds(shape.bounds);

data := self.name(shape);

alignment = DC::AlignmentKind::start };

}

}

mapping UML::Operation::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement {

init {

result := object DG::Text {

bounds := newBounds(shape.bounds);

data := self.name(shape);

alignment = DC::AlignmentKind::start };

}

}

Page 26: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

26

Example: QVT Mapping from UML DI to DGproperty interfaceRealizationStyle = object DG::Style {

strokeDashLength := Sequence {2, 2};

};

property interfaceRealizationMarker = object DG::Marker {

size := object DC::Dimension {width := 10; height := 10};

reference := object DC::Point {x := 10; y := 5};

member += object DG::Path {

command += object DG::MoveTo {point := object DC::Point{ x:=0; y:=0 } };

command += object DG::LineTo {point := object DC::Point{ x:=10; y:=5 } };

command += object DG::LineTo {point := object DC::Point{ x:=0; y:=10 } };

};

};

mapping UMLDI::UMLPlane::planeToGraphicalElement() : DG::Canvas

inherits DI::DiagramElement::diagramElementToGraphicalElement

{ ….

marker += interfaceRealizationMarker;

style += interfaceRealizationStyle;

}

mapping UML::Element::edgeToPolyline(edge:UMLDI::UMLEdge) : DG::Polyline {

point := edge.waypoint->collect(p|newPoint(p));

}

mapping UML::InterfaceRealization::edgeToPolyline(edge:UMLDI::UMLEdge) : DG::Polyline

inherits UML::Element::edgeToPolyline {

sharedStyle := interfaceRealizationStyle;

endMarker := interfaceRealizationMarker;

}

0,0

10,10

Page 27: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

27

Example: QVT Mapping from UML DI to DGquery UML::NamedElement::name(de : UMLDI::UMLDiagramElement) : String {

return self.name(de.isQualifiedName)

}

query UML::NamedElement::name(qualified : Boolean) : String {

return if qualified then self.qualifiedName else self.name endif

}

query UML::NamedElement::visibility() : String {

return switch {

case (self.visibility = UML::VisibilityKind::public) '+';

case (self.visibility = UML::VisibilityKind::private) '-';

case (self.visibility = UML::VisibilityKind::private) '#';

else ‘';

}

}

query UML::TypedElement::type(qualified : Boolean) : String {

return if self.type->notEmpty() then ' : ' + self.type.name(qualified) else '' endif

}

query UML::Property::name(de : UMLDI::UMLDiagramElement) : String {

return self.visibility() + self.derived_() + self.name(de.isQualifiedName) + self.type(de.isQualifiedName)

}

query UML::Property::derived_() : String {

return if self.isDerived then '/' else '' endif

}

query UML::Property::multiplicity() : String {

return '[' + self.lower.toString() + '..' + self.upper.toString() + ']'

}

query UML::Property::role() : String {

return self.visibility() + self.derived_() +self.name(false)

}

query UML::Operation::name(de : UMLDI::UMLDiagramElement) : String {

return self.visibility() + self.name(de.isQualifiedName) + '()' + self.type(de.isQualifiedName)

}

Page 28: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

28

Example: QVT Mapping from UML DI to DGhelper newPoint(p : DC::Point) : DC::Point {

return p.clone().oclAsType(DC::Point)

}

helper newBounds(b : DC::Bounds) : DC::Bounds {

return b.clone().oclAsType(DC::Bounds)

}

helper newColor(c : Color) : DC::Color {

return c.clone().oclAsType(DC::Color)

}

helper rgbColor(r : Integer, g : Integer, b : Integer) : DC::Color {

return object DC::Color { red := r; green := g; blue := b; }

}

helper knownColor(color : DC::KnownColor) : DC::Color {

return switch {

case (color = KnownColor::maroon) rgbColor(128, 0, 0);

case (color = KnownColor::red) rgbColor(255, 0, 0);

case (color = KnownColor::orange) rgbColor(255, 165, 0);

case (color = KnownColor::yellow) rgbColor(255, 255, 0);

case (color = KnownColor::olive) rgbColor(128, 128, 0);

case (color = KnownColor::purple) rgbColor(128, 0, 128);

case (color = KnownColor::fuchsia) rgbColor(255, 0, 255);

case (color = KnownColor::white) rgbColor(255, 255, 255);

case (color = KnownColor::lime) rgbColor(0, 255, 0);

case (color = KnownColor::green) rgbColor(0, 128, 0);

case (color = KnownColor::navy) rgbColor(0, 0, 128);

case (color = KnownColor::blue) rgbColor(0, 0, 255);

case (color = KnownColor::aqua) rgbColor(0, 255, 255);

case (color = KnownColor::teal) rgbColor(0, 128, 128);

case (color = KnownColor::silver) rgbColor(192, 192, 192);

case (color = KnownColor::gray) rgbColor(128, 128, 128);

case (color = KnownColor::black) rgbColor(0, 0, 0);

};

}

Page 29: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

29

Circularity Issue

QVT is mapping from a MOF model to a MOF model

MOF abstract syntax models are normally specified using UML diagrams (even if they are represented in XMI for interchange).

To avoid circularity, the UML notation subset used specifically for specifying MOF abstract syntax models must be defined independently of DD.

As with other MOF core circularity concerns, this is really a MOF issue, not a DD issue.

Page 30: ® IBM Software Group © 2006 IBM Corporation Diagram Definition: Revised Submission Maged Elaasar, IBM melaasar@ca.ibm.com ADTF, OMG March 2010, Washington.

IBM Software Group | Rational software

30

FTF Planned Activities

Fix issues with the Revised Submission

Define in Annex A a more elaborate example (subset of UML)

Define in Annex B a M2T mapping from DG to SVG Implement a reference implementation for this mapping