520 likes | 688 Vues
MDE standards. MOF. Meta Object Facility. MOF defines the language for defining modeling languages (meta-models) A meta-model defines concepts of the modeling language and their relationships (thanks to classes). A model is composed of model elements (that are instances of classes). MOF.
E N D
MOF Meta Object Facility
MOF defines the language for defining modeling languages (meta-models) A meta-model defines concepts of the modeling language and their relationships (thanks to classes). A model is composed of model elements (that are instances of classes). MOF UML Modèle Modèle Modèle UML UML What is MOF? Meta-meta-model Meta-model Model
Class Diagram and meta-model • A class diagram represents a graph of connected classes and packages. • Classes are used to specify concepts of the modeling language • Packages are used to group classes • A meta-model is a set of packages • A meta-model is presented by a set of class diagrams
Class • A class defines the common structure of a set of model elements (that are instances of the class). • A class : • Has a name • Contains attributes that specify the model element properties • Contains operations that specify the model element responsibilities (a model is productive) • Graphically, a class is a rectangle that contains a string (the name of the class). The rectangle can also be composed of three parts (name, attributes, operations).
Attributes • Attribute syntax :visibility name : type • Visibility is: • ‘+’ public • ‘#’ protected • ‘-’ private • MOF defines its own primitive types • Integer, real, string, … • Attribute can be class level attribute, they are underlined. • Attribute can be derived, they are prefixed by ‘/’.
Operations • Syntax: visibility name(parameter):return • Parameter syntax: kind name : type • kind: • in, out, inout • The MOF does not define any concept for specifying the behavior of an operation
Inheritance • Inheritance between two classes means that sub class is more specific than the super class. • Multiple inheritance is allowed
Associations • Associations connect two classes. • When two classes are associated, model elements instances of those classes can be linked. • One association is composed of two association ends. • Association end: • Has a name • A multiplicity (0, 1, *, 1..*, …) • An aggregation kind (composite, aggregate, none) • Other properties: Navigable, Changeable
Associations A student attends at some courses. A student knows the courses he/she attends at. A course is attended by some students (0 or more).
Packages • A package groups model elements • A package is a namespace • A package can import or merge other packages
The MOF itself • Everything is a model element • A namespace is a model element that contains model elements • A generalizable element is a namespace that can have a super type • A classifier is a generalizable element • A typed element has a type which is a classifier
The MOF itself • Classes, associations and datatypes are classifier. • A typed element have a class, an association or a datatype as a type
The MOF itself • Namespaces can own features (so classes and associations) • An association has two association ends! • References are structural feature that reference and expose association end.
The MOF itself • Behavioral features are features that are also namespace • Operations and exception are behavioral features • Operation can raise exceptions.
MOF2.0 = CMOF & EMOF • MOF2.0 defines two variants • EMOF (Essential) : Meta-models do not contain association (only references between classes). • CMOF (Complete) : Meta-models can contain associations. CMOF reuses EMOF
MOF Synthesis • MOF fully formalize meta-model definition • MOF is OO, it eases meta-model reuse • MOF adds operations to meta-models in order to make them productive
UML Unified Modeling Language
UML defines concepts for building class diagrams MOF also defines concepts for building class diagrams => Capitalization of those concepts : UML2.0 Infrastructure MOF UML 2.0 Infrastructure/Superstructure UML Infra UML Super UML2.0 Infrastructure is not assigned to specific meta-layer.
Action A pin is a typed element and multiplicity element that provides provide values to actions and accept result values from them.
Action Actions for create or delete objects Actions for calling operations.
Activity An activity is the specification of parameterized behavior as the coordinated sequencing of subordinate units whose individual elements are actions.
Activity diagram « data store »
State Machine • State machines can be used to express the behavior of part of a system. • Behavior is modeled as a traversal of a graph of state nodes interconnected by one or more joined transition arcs that are triggered by the dispatching of series of (event) occurrences. • A state machine owns one or more regions, which in turn own states and transition arcs.
State & doActivity • An optional behavior that is executed while being in the state. The execution starts when this state is entered, and stops either by itself or when the state is exited whichever comes first.
And • Scenario • Component • Deployment • Collaboration • Template • Profile • UML-RT (UML for real time) • SysML (UML for system engineering) • …
UML Synthesis • UML is the richer meta-model for modeling systems • The UML meta-model formalizes all concepts and their relationships • The notion of diagram is defined on top of the meta-model • A diagram is only a view on a UML model • UML tries to cover all preoccupations (static, dynamic, runtime, …) • UML can be extended dynamically (profile) or statically (extension of the meta-model)
OCL Object Constraint Language
OCL • OCL is a language for defining expressions on UML models • An OCL expression has no side effect on the UML model • The OCL language is defined by a meta-model • The OCL meta-model is linked to the UML meta-model • OCL also defines a concrete language (textual) that is based on top of the meta-model • OCL defines its own semantic thanks to UML models
OCL Expression • An OCL expression is an expression that can be evaluated in a given environment. • Every OCL expression has a type that can be statically determined by analyzing the expression and its context. • Evaluation of an expression results in a value. Expressions with boolean result can be used as constraints. • The environment of an OCL expression defines what model elements are visible and can be referred to in an expression. The environment is defined by the ModelElement to which the OCL expression is attached.
OCL Expression • A PropertyCallExp is an OCL expression that refers to a property (attribute or operation). Its result value is the evaluation of the corresponding property. • A ModelPropertyCallExp is a PropertyCallExp that refers to a classifier. • A VariableDeclaration declares a variable name and binds it to a type.
OCL Library • The OCL Library defines operations on primitive types • OclAny = (object2 : OclAny) : Boolean True if self is the same object as object2. • Real <= (r : Real) : Boolean True if self is less than or equal to r. • String, Interger, ... • Those operations can be called within OCL expression (ModelPropertyCallExp)
OCL Syntax • The concrete syntax of OCL is described in the form of an a full attribute grammar. • Each production of the attribute grammar is linked to a element of the OCL meta-model. • The mapping from the concrete syntax to the meta-model is then fully formalized.
OCL Semantic • The OCL semantic is fully defined thanks to UML models • The set of possible values that evaluations of expressions may yield is called the semantic domain • The semantic domain is described in the form of a UML package, containing a UML class diagram, classes, associations, and attributes. The real semantic domain is the (infinite) set of instances that can be created according to this class diagram. • The semantic of an OCL expression is given by association: each value defined in the semantic domain is associated with a type defined in the abstract syntax, each evaluation is associated with an expression from the abstract syntax.
OCL and UML • OCL is bounded to UML1.4 • No alignment with UML2.0 and MOF2.0 • Whereas it is used to constraint meta-model!
OCL Synthesis • OCL is really well defined • Abstract syntax • Concrete syntax • Semantic • OCL can be used to constrain UML models but also to query them • OCL should be updated (UML2.0 and MOF2.0) but nobody wants to do it
MOF2.0 Q/V/T Quiery View Transformation
QVT • QVT defines a standard language for modeling model transformations • QVT enables model transformations capitalization and productivity • After 5 years of work, QVT is a standard (October 2005)
QVT approaches • QVT has a hybrid declarative/imperative nature. • A model transformation can be expressed as a set of relations (declarative) • A model transformation can be expressed as a set of operations (imperative). • Abstract and concrete syntax are provided for both approaches.
Relations • A relation can be constrained by two sets of predicates, a when clause and a where clause. • The when clause specifies the conditions under which the relationship needs to hold. • The where clause specifies the condition that must be satisfied by all model elements participating in the relation. • A pattern is a set of variable declarations and predicates, which when evaluated in the context of a model, results in a set of bindings for the variables.
Operations • An operational transformation represents the definition of a unidirectional transformation that is expressed imperatively. • It has a model signature indicating the models involved in the transformation. • It defines an entry operation, named main, which represents the initial code to be executed to perform the transformation.
QVT Synthesis • QVT seems to be very powerful • But it is too young to clearly measure its advantages and drawbacks • No tool, no prototype • Always the same sample (UML 2 RDB)