1 / 30

Diagram Definition: Revised Submission

Diagram Definition: Revised Submission. ADTF, OMG March 2010, Washington DC. Maged Elaasar, IBM melaasar@ca.ibm.com. DD Joint Submission Team. Submitters Adaptive Deere & Company Fujitsu International Business Machines Model Driven Solutions Sparx Systems Supporters Trisotech

truong
Télécharger la présentation

Diagram Definition: Revised Submission

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Diagram Definition: Revised Submission ADTF, OMG March 2010, Washington DC Maged Elaasar, IBM melaasar@ca.ibm.com

  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

  3. Diagram Definition Time Line RFP Initial Submission Revised Submission Voting September 2007 February 2009 May 2010 September 2010

  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

  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

  6. Outline • DD Architecture • DI Metamodel • Example: UML DI Metamodel • DG Metamodel • Example: QVT Mapping from UML DI to DG

  7. DD Architecture MOF Mapping Language MOF M3 spec Abstract Syntax Diagram Syntax Concrete Syntax DI M2 spec CS Mapping Specification AS AS DI DG Model Diagram Graphics M1 user CS Mapping Model (interchanged) Controller (executed) View (rendered) Instantiates Specializes References DD Spec Language Spec DI : Diagram Interchange DG: Diagram Graphics AS: Abstract Syntax CS : Concrete Syntax

  8. Example : UML DD Architecture MOF Mapping Language MOF M3 Abstract Syntax Diagram Syntax Concrete Syntax DI M2 UML Mapping Specification UML UML DI DG M1 UML Mapping Model Controller View Instantiates Specializes References DD Spec UML Spec DI : Diagram Interchange DG: Diagram Graphics

  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

  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

  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

  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

  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

  14. Example: UML DI Metamodel

  15. Example: UML DI Metamodel

  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

  17. Diagram Graphics (DG) Metamodel • Many primitive graphical elements are defined • Others can be defined at M1

  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

  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

  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

  21. PlaneElement Group Example: QVT Mapping from UML DI to DG modeltype 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(); } mappingUMLDI::UMLPlane::planeToGraphicalElement() : DG::Canvas inherits DI::DiagramElement::diagramElementToGraphicalElement { member += self.planeElement->map planeElementToGraphicalElement(); … } … } UMLPlane UMLDI DG Canvas

  22. Text Group UMLCompartment UMLLabel Example: QVT Mapping from UML DI to DG UML::Element mappingDI::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(); }; } } mappingUMLDI::UMLShape::shapeToGraphicalElement() : DG::Group inherits DI::DiagramElement::diagramElementToGraphicalElement { member += self.umlElement.map shapeToGraphicalElement(self); member += self.label.map labelToGraphicalElement(); member += self.compartment->map compartmentToGraphicalElement(); } mappingUMLDI::UMLEdge::edgeToGraphicalElement() : DG::Group inherits DI::DiagramElement::diagramElementToGraphicalElement { member += self.umlElement.map edgeToPolyline(self); member += self.label.map labelToGraphicalElement(); } UMLShape UMLEdge UMLLabel UMLDI DG Group Group GraphicalElement Polyline Text

  23. Group PlaneElement Example: QVT Mapping from UML DI to DG UMLCompartment UMLLabel mappingUMLDI::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(); } mappingUMLDI::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(); }; } UMLDI DG Group Rectangle Text

  24. Example: QVT Mapping from UML DI to DG abstractmappingDI::DiagramElement::diagramElementToGraphicalElement() : DG::GraphicalElement { var s : DG::Style; ifself.localStyle->notEmpty() andself.localStyle.oclIsKindOf(UMLDI::UMLStyle) then s := object DG::Style { ifnot localStyle.oclIsSet(fontName) then fontName := ds.fontName endif; ifnot localStyle.oclIsSet(fontSize) then fontSize := ds.fontSize endif; } endif; ifself.sharedStyle->notEmpty() andself.sharedStyle.oclIsKindOf(UMLDI::UMLStyle) then s := object DG::Style { ifnot localStyle.oclIsSet(fontName) then fontName := ds.fontName endif; ifnot localStyle.oclIsSet(fontSize) then fontSize := ds.fontSize endif; } endif; localStyle := s; }

  25. Example: QVT Mapping from UML DI to DG mappingUML::Element::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement { init {} } mappingUML::Classifier::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement { init { result := object DG::Rectangle { bounds := newBounds(shape.bounds) }; } } mappingUML::Property::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement { init { result := object DG::Text { bounds := newBounds(shape.bounds); data := self.name(shape); alignment = DC::AlignmentKind::start }; } } mappingUML::Operation::shapeToGraphicalElement(shape:UMLDI::UMLShape) : DG::GraphicalElement { init { result := object DG::Text { bounds := newBounds(shape.bounds); data := self.name(shape); alignment = DC::AlignmentKind::start }; } }

  26. Example: QVT Mapping from UML DI to DG property 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 } }; }; }; mappingUMLDI::UMLPlane::planeToGraphicalElement() : DG::Canvas inherits DI::DiagramElement::diagramElementToGraphicalElement { …. marker += interfaceRealizationMarker; style += interfaceRealizationStyle; } mappingUML::Element::edgeToPolyline(edge:UMLDI::UMLEdge) : DG::Polyline { point := edge.waypoint->collect(p|newPoint(p)); } mappingUML::InterfaceRealization::edgeToPolyline(edge:UMLDI::UMLEdge) : DG::Polyline inherits UML::Element::edgeToPolyline { sharedStyle := interfaceRealizationStyle; endMarker := interfaceRealizationMarker; } 0,0 10,10

  27. Example: QVT Mapping from UML DI to DG query UML::NamedElement::name(de : UMLDI::UMLDiagramElement) : String { returnself.name(de.isQualifiedName) } query UML::NamedElement::name(qualified : Boolean) : String { returnif qualified thenself.qualifiedName elseself.name endif } query UML::NamedElement::visibility() : String { returnswitch { 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 { returnifself.type->notEmpty() then ' : ' + self.type.name(qualified) else '' endif } query UML::Property::name(de : UMLDI::UMLDiagramElement) : String { returnself.visibility() + self.derived_() + self.name(de.isQualifiedName) + self.type(de.isQualifiedName) } query UML::Property::derived_() : String { returnifself.isDerived then '/' else '' endif } query UML::Property::multiplicity() : String { return '[' + self.lower.toString() + '..' + self.upper.toString() + ']' } query UML::Property::role() : String { returnself.visibility() + self.derived_() +self.name(false) } query UML::Operation::name(de : UMLDI::UMLDiagramElement) : String { returnself.visibility() + self.name(de.isQualifiedName) + '()' + self.type(de.isQualifiedName) }

  28. Example: QVT Mapping from UML DI to DG helper knownColor(color : DC::KnownColor) : DC::Color { returnswitch { 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); }; } helper 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 { returnobject DC::Color { red := r; green := g; blue := b; } }

  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.

  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

More Related