Title: MOF Meta-Models and UML Profiles
1MOF Meta-Models and UML Profiles
2Outline
- MDAs modeling level hierarchy
- Purposes of meta-models in MDA
- Meta-Object Facility (MOF) a standard language
for meta-modeling - Modeling with software abstractions beyond UML
- UML Profiles
- KobrA-2
- Multi-Agent Simulation
3MDAs Modeling Level Hierarchy
MOF OCL
Level M3
MOF OCL
Level M2
UML OCL
UML Profile
Special Purpose Modeling Language
AND -OR
AND -OR
Level M1
Running Application
Implementation Running on Platform
Level M0
4Example Meta-Model
inherits
1 ..
extends
CMOF Meta-Model of Use-Cases (simplified)
0 ..
participates
case
0 ..1
includes
e-Store
OrderItem
UML Model Use-Case Diagram
ValidateCart
5Example Meta-Meta-Model
CMOF Meta-Model of CMOF Meta-Model (Simplified)
1 ..
inherits
extends
CMOF Meta-Model of UML Use-Cases (Simplified)
0 ..
participates
case
0 ..1
includes
6Purposes of Meta-Models in MDA
- Define modeling languages
- Their abstract syntax
- Their formal semantics
- Define source and target anchors for model
transformations - What about APIs and Libraries?
- They are all written in a given language
- They are thus best viewed as built-in model
elements to reuse than as part of a modeling
language - Thus they should be part of platform models, not
of language meta-models
7What is Meta-Modeling?
- Meta-Modeling vs. Modeling
- Similar formalisms but different purposes
- One models applications and meta-models
languages and formalisms - Meta-Modeling vs. Ontology Engineering
- An ontology is a domain knowledge model, not a
meta-model - But a domain is an intermediate level of
abstraction and generality between application
and language - Meta-Modeling Methodologies
- Uncharted territory
- Should integrate and reuse principles and
techniques from - Application modeling (formalism similarities)
- Language design (purpose similarities)
- Ontology engineering (process similarities)
8OMGs Meta-Object Facility (MOF)
- Key idea
- Instead of defining entirely new languages for
the M2 and M3 levels - Reuse structural core of mature, well-known,
well-tooled M1 level language (UML
Infra-Structure) - Advantages of MOF over traditional formalisms
such as grammars to define languages - Abstract instead of concrete syntax (more
synthetic) - Visual notation instead of textual notation
(clarity) - Graph-based instead of tree-based (abstracts
from any reader order) - Entities (classes) have internal structure and
behavior (strings do not) - Relations include generalization and undirected
associations instead of only order - Specification reuse through inheritance
- Additional advantages with OCL
- Allows expressing arbitrary complex constraints
among language elements (more expressive) - Allows defining formal semantics without
mathematical syntax
9MOFMeta-Model Package Structure
UML2 Infra-Structure
10Essential MOF (EMOF) Meta-Model
- Minimum bootstrap elements for modeling,
meta-modeling and MDA tools - Includes only classes, attributes, operations,
packages and primitive types from UML2
Infra-Structure - Does not includes associations, which are
replaces by references (properties whose values
are classes instead of primitive types) - Any CMOF meta-model can be transformed into an
EMOF meta-model - EMOF extends UML2 Infra-Structure with elements
to represent - Instances and their reflective relations with
classes - Language extension mechanisms
11EMOF Meta-ModelElements Reused from UML2 Infra
12EMOF Meta-ModelElements Reused from UML2 Infra
13EMOF Meta-Model Elements Absent from UML2 Infra
- Reflection package
- Views any model element as an instance of a
meta-model meta-class - Provide operations that cut across MDA layers to
manipulate model and meta-model elements as
meta-objects of their meta-classes - Provides meta-meta-model of a generic reflective
API to programmatically manipulate models
14EMOF Meta-Model Elements Absent from UML2 Infra
- Extention package
- Any element can be tagged to extend modeling
language vocabulary
- Identifiers package
- OID class property with feature isID true
- Extent OID value range
- useContainment when true, all contained elements
are added to containing elements extents - Elements() returns extent members
- URIextent extent where OIDs are URIs instead of
properties
15Example of EMOF Meta-Model
EMOF Meta-Model of EMOF (simplified)
Class
Attribute
Reference
EMOF Meta-Model of Use-Cases (simplified)
e-Store
OrderItem
UML Model Use-Case Diagram
ValidateCart
16Part of UML2 Infra-StructureReused in CMOF but
not in EMOF
17Tailored Modeling with Software Abstractions
Beyond UML
- Software abstractions beyond UML can be
classified as - Specializing UML abstractions (i.e., UML2
meta-model elements) - Generalizing UML abstractions
- Being unrelated to UML abstractions
- Approaches
- No MOF, no UML (the Microsoft way)
- Create and use domain-specific or even
application-specific meta-modeling, modeling and
model transformation languages - Pure MOF, no UML
- Create domain-specific or application-specific
modeling language that does not reuse any UML
meta-model element but is specified as a MOF
meta-model - MOF meta-model reuse operators applied to UML
packages - Define MOF meta-model of new modeling language
that reuses UML meta-model elements and add new
ones - UML Profile approach (the IBM way)
- Define specializations of UML abstractions by
stereotyping UML meta-model elements - Can be carried out as follows
- Define MOF meta-model of new modeling language
- Associate every top-level element in this
meta-model to a stereotype of some generalizing
UML meta-model elements
18Tailored Modeling Domain-Specific Meta-Modeling
and Modeling Approach
- Advantage
- Perhaps easier to integrate with Visual Studio?
- Drawbacks
- For each new domain or application
- Need to redefine entire MDA language
infra-structure alternative to OMGs - Need to implement CASE tools for non-standard
languages
GUI Editor for D2 Diagrams
GUI Editor for D1 Diagrams
D1 Model Repository
19Tailored Modeling Pure MOF Approach
- Pure MOF approach
- Does not use UML
- Advantages
- No need to artificially relate new abstractions
to UML abstractions - Drawbacks
- Need to define entirely new meta-model that does
not reuse any elements consolidated by OMGs long
meta-modeling experience - Need to develop entirely new graphical notation
and editors - Need to develop all model manipulation services
(code generation, test generation, reverse
engineering) that UML CASE tools already provide
UML Editor
GUI Editor for D Diagrams
EMF
generates
Menu Editor for D Diagrams
20Tailored ModelingMeta-Model and MOF Reuse
Operators
- Advantages
- Reuses consolidated elements from UML2
meta-model - Drawbacks
- Need to extend UMLs graphical editors to draw
elements in D UML2 - Need to extend model manipulation services
(code generation, test generation, reverse
engineering) of UML CASE to modeling elements in
D UML2 - Current MOF operators do not cover UML2 concept
generalizing reuse, only reuse as is or as
specialization
ltlt reuse gtgt
UML Editor
GUI Editor for D Diagrams
EMF
generates
Menu Editor for D Diagrams
21Tailored Modeling UML Profile Approach
- UML2 meta-classes sub-categorized by stereotypes
- Sub-meta-class x stereotype
- The instances of a sub-meta-class S of
meta-class G are direct instances of S, not of G - The instances of a meta-class G stereotyped by S
are direct instances of G, for a stereotype has
no proper instances - Advantages
- Maximum reuse the entire OMG language
infra-structure - Maximum reuse of UML CASE tools (no need to
develop any new tool) - Drawbacks
- Risk to artificially recast modeling
abstraction as specializations of UML ones - Little to reuse for non-object oriented modeling
languages
EMF
meta-class
Package
Class
Profile
Stereotype
ExtensionEnd
Extension
UML Editor
icon
Property
Association
ProfileApplication
Image
22Example Profile KobrA-2 Component
- Restricts UML2 meta-model to the subset of
elements used as artifacts following the KobrA-2
methodology - Goals of upgrading KobrA-1 into KobrA-2
- Leverage latest MDA standards UML2 (especially
UML2 components), OCL2, MOF2, SPEM - Extend process to PSM modeling and
implementation - Turn process more model-driven by
- Clearly distinguishing between CIM and PIM
- Substitute all tabular natural language
artifacts by OCL constraints and expressions - Formalize process in SPEM
- Extend process with sub-steps dedicated to GUI
development
23K2CIMStructure
K2StructureModel
K2CIM
K2CIMBehavior
K2PIMStructureSpecification
K2PIMSpecification
K2PIMBehaviorSpecification
K2PIM
K2PIMStructureRealization
K2PIMRealization
K2PIMBehaviorRealization
nestedArtifact
K2JPMSStructureSpecification
Artifact
KobrA2Component
K2JPSMpecification
K2JPSMBehaviorSpecification
K2JavaPSM
K2JPSMStructurelRealization
K2JPSMRealization
K2JPSMBehaviorRealization
K2JavaCode
K2BehaviorSpecificationModel
KobrA-2 UML2 Profile
K2BehaviorRealizationModel
241..
K2StructureModel
K2ClassDiagram
1..
1..
1..
Component
Interface
Class
Association
Dependency
1..
Port
Artifact
InstanceSpecification
Manifestation
1..
K2ObjectDiagram
0..
ComponentInstance
Object
Link
Connector
1..
1..
KobrA-2 UML2 Profile
1..
K2ContractConstraint
K2BehaviorSpecificationModel
Artifact
Manifestation
0..
K2StateChart
ProtocolStateMachine
K2ActivityDiagram
K2BehaviorRealizationModel
Activity
1..
Constraint
Artifact
Manifestation
valueSpecification
K2SequenceDiagram
Interaction
OpaqueExpression
ExpressionInOCL
OpaqueBehavior
25MOF Meta-Model of a Simple Multi-Agent
Simulations Modeling Language (MASML)
26MOF Meta-Model of a Simple Multi-Agent
Simulations Modeling Language (MASML)
KBAgent
1..
Agent
ReasoningComponent
KnowledgeBase
KBSentence
1..
PersistentKB
KBAgent
KBComponent
VolatileKB
0..
1..
27UML2 Profile for MAS
MAS
Environment
Agent
ReasoningComponent
Sensor
Actuator
Percept
AgentAction
EnvironmentStateModel
KnowledgeBase
KBSentence
28Available UML Profiles
- By OMG
- Enterprise Application Integration (application
interoperability through standard metadata) - Enterprise Distributed Object Computing (EDOC)
- QoS and Fault Tolerance
- Schedulability, Performance and Time
- Testing
- Third parties
- Enterprise Java Beans (by Java Community
Process) - Software Services (by IBM, supported by Rational
Software Architect UML CASE tool) - Knowledge-Based Systems (University of York)
- Data Modeling (by agiledata.org)
- Framework Architectures (UML-F)
- Requirement Engineering with KAOS
- Formal Methods in B (UML-B)
- Embedded System Design