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
- Multi-Agent Simulations
- Others
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
4Purposes 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
5What 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)
6OMGs 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) can have behavior (grammar
symbols do not) - Relations between elements include
generalization and undirected associations
instead of only composition and 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
7MOFMeta-Model Package Structure
UML2 Infra-Structure
8Essential 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) - Basis for Ecore the metametamodel implemented by
the Eclipse Modeling Framework - Any CMOF meta-model can be transformed into an
EMOF meta-model - EMOF extends UML2 Infra-Structure with elements
to represent - Instances unique identifiers
- Their reflective relations with classes
- Minimal tag-value based extension mechanism
9EMOF Basic Package
10EMOF Basic Package
11EMOF Reflection and Common Packages
- 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
12EMOF Meta-Model Identifier Package
- OID class property with feature isID true or URI
- Extent OID value range
- useContainment() when true, all contained
elements are added to containing elements
extents(recursive containment) - e.g., if object o1 has property p1 which
containsobjects o2, which in turns has property
p2 whichcontains object o3, when
useContainment() is truethen the extent for o1
includes o1, o2, o3 - Elements() returns extent members
- URIExtent extent where OIDs are URIsinstead of
properties - A URI (Universal Resource Identifier) is either,
- A URL (Universal Resource Locator) providing a
name for a resource accessible on a network and
a mean to retrieve it or - A URN (Universal Resource Name) providing a name
for a resource in a namespace.
URI syntax and examples URI syntax and examples URI syntax and examples URI syntax and examples URI syntax and examples
scheme authority path query fragment
foo ///example.com8042 /over/there ?nameferret nose
urn exampleanimalferretnose
13EMOF Extension Package
- Any element can be tagged to extend modeling
language vocabulary
14CMOF Construct Package
15CMOF Reflection
To identify operation parameters by names instead
of merely by position
16Is UML2 Enough? Too Much?
- UML2 covers domain and platform independent
modeling concepts for the object-oriented,
relational, imperative, concurrent, event-based,
distributed and constraint (through OCL)
computational paradigms - It does not cover
- Object-oriented reflection
- Functional paradigm which includes powerful
generative meta-programming and type inference - Rule-based paradigm which includes powerful
model transformation mechanisms and general
logical inference - Domain-specific modeling concepts
- Platform-specific abstractions
- So it is not enough for key applications and
domains - UML2 thus needs an extension mechanism
- But isnt UML2 rather already too much?
- Yes, it is only a vast menu of concepts only a
few of which are practically useful for a
particular application or application domain - To be highly reusable it is also necessarily very
under-constrained - So UML2 also needs a reduction mechanism allowing
a methodology to choose a relevant subset of its
metamodel and add more stringent OCL constraints
among the elements of such subset
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 which 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
18Tailored Modeling Domain-Specific Meta-Modeling
and Modeling Approach
- Advantage
- No need to understand complex, large and at times
under-examplified MOF2 and UML2 specifications - 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
- 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
Promotes property value to the metaclass level
EMF
UML Editor
22UML2 Profiles
ltltagentgtgt ag1
ltltagentgtgt ag2
ltltproxygtgt
- // Creating agent stereotype
- a Factory.create(metaclassStereotype)
- a.set(propertyname, valueltltagentgtgt)
- // Creating Components a1 and a2
- a1 Factory.create(metaclassComponent)
- a1.set(propertyname, valueag1)
- a2 Factory.create(metaclassComponent)
- a2.set(propertyname, valueag2)
- // Stereotyping a1 as agent
- a1e Factory.create(metaclassExtension)
- a1.set(propertyExtension, valuea1e)
- a1ee Factory.create(metaclassExensionEnd)
- a1e.set(propertyownedEnd, valuea1ee)
- a1ee.set(propertytype, valuea)
// Stereotyping a2 as agent a2e
Factory.create(metaclassExtension) a2.set(propert
yExtension, valuea2e) a2ee Factory.create(meta
classExensionEnd) a2e.set(propertyownedEnd,
valuea2ee) a2ee.set(propertytype, valuea) //
Create proxy stereotype p Factory.create(metacla
ssStereotype) p.set(propertyname,
valueltltproxygtgt) // Creating Association
between a1 and a2 a12 Factory.create(metaclassA
ssociation) a12e1 Factory.create(metaclassPrope
rty) a12e2 Factory.create(metaclassProperty) a1
.set(propertyownedAttributes, valuea12e1) a2.set
(propertyownedAttributes, valuea12e2) a12.set(pr
opertymemberEnd, valuea12e1) a12.set(propertyme
mberEnd, valuea12e1)
Component
Associaton
Agent
Proxy
// Stereotyping a12 as proxy a12e
Factory.create(metaclassExtension) a12.set(proper
tyExtension, valuea12e) a12ee
Factory.create(metaclassExensionEnd) a12e.set(pro
pertyownedEnd, valuea12ee) a12ee.set(propertyty
pe, valuep)
23UML2 Profiles
- // Creating S1 and S2 stereotypes
- s1 Factory.create(metaclassStereotype)
- s1.set(propertyname, valueltltS1gtgt)
- s1 Factory.create(metaclassStereotype)
- s1.set(propertyname, valueltltS2gtgt)
- // Creating classes C1 and C2
- c1 Factory.create(metaclassClass)
- c1.set(propertyname, valueC1)
- c2 Factory.create(metaclassClass)
- c2.set(propertyname, valueC2)
- // Creating instanceSpecification i1 of C1
- i1 Factory.create(metaclassInstanceSpecificatio
n) - i1.set(propertyname, valuei1)
- i1.set(propertyclassifier, valuec1)
- // Stereotyping i1 as ltltS1gtgt
- c1e Factory.create(metaclassExtension)
- c1.set(propertyExtension, valuec1e)
- c1ee Factory.create(metaclassExensionEnd)
- c1e.set(propertyownedEnd, valuec1ee)
neither direct nor inherited association between C
1 and C2
C1
C2
S2 only a stereotype of C2 but not a
sub-metaclass of C2
S1 only a stereotype of C1 but not a
sub-metaclass of C1
X
S1
S2
No allowed association between S1 and S2
i1 ltltS1gtgt C1
i2 ltltS2gtgt C2
instance i1 cannot be of S1 only of C11 w/
property stereotype S1
instance i2 cannot be of S2 only of C2 w/
property stereotype S2
X
i1 and i2 cannot be linked for lack of an
association between their respective classes C1
and C2 but reuse of concrete syntax of C1 and C2
24UML2 Extension via Sub-Metaclasses
superclass
- // Creating classes C1, C2, S1, S2
- c1 Factory.create(metaclassClass)
- c1.set(propertyname, valueC1)
- c2 Factory.create(metaclassClass)
- c2.set(propertyname, valueC2)
- s1 Factory.create(metaclassClass)
- s1.set(propertyname, valueS1)
- s2 Factory.create(metaclassClass)
- s2.set(propertyname, valueS2)
- // Specializing C1 by S1 and C2 by S2
- s1.set(propertysuperclass, valuec1)
- s2.set(propertysuperclass, valuec2)
- // Creating Association between S1 and S2
- s12 Factory.create(metaclassAssociation)
- s12e1 Factory.create(metaclassProperty)
- s12e2 Factory.create(metaclassProperty)
- s1.set(propertyownedAttributes, values12e1)
// Creating instanceSpecification i1 of S1 i1
Factory.create(metaclassInstanceSpecification) i1
.set(propertyname, valuei1) i1.set(propertycl
assifier, values1) // Creating
instanceSpecification i2 of S2 i2
Factory.create(metaclassInstanceSpecification) i2
.set(propertyname, valuei2) i2.set(propertycl
assifier, values2) // Creating
instanceSpecification of S12 is12
Factory.create(metaclassInstanceSpecification) is
12.set(propertyclassifier, values12)
Class
ownedAttribute
Property
menberEnd
Association
25UML2 Extension via Sub-MetaClasses and Stereotype
26A UML2 Profile Definition Process
- Create a special purpose meta-model of an
application domain, language or platform - Identify the top-level meta-classes s1, ..., sn
of this meta-model (i.e., those with no
generalizations) - Identify in the UML2 meta-model, the concrete
meta-classesg1, ..., gn that are natural
semantic generalizations of s1, ..., sn
(respectively) - Extend the UML2 meta-model by defining s1, ...,
sn as sub-meta-classes of g1, ..., gn
(respectively) - Add OCL constraints on s1, ..., sn that specify
how they specializeg1, ..., gn (respectively)
27MOF Meta-Model of a Simple Multi-Agent
Simulations Modeling Language (MASML)
28MOF Meta-Model of a Simple Multi-Agent
Simulations Modeling Language (MASML)
KBAgent
1..
Agent
ReasoningComponent
KnowledgeBase
KBSentence
1..
PersistentKB
KBAgent
KBComponent
VolatileKB
0..
1..
29UML2 Profile for MAS
- OCL Constraints
- context Agent invinterfacelet r required and
(i Sensor or Actuator)in r.oclIsKindOf(i) - context Agent invsignal let s
required.ownedReception.signal in
s.oclIsKindOf(Percept or AgentAction) - context Sensor invagentabstraction.oclIsKindOf(A
gent) - ...
MAS
Component isActive true
Environment
Agent
ReasoningComponent
Component
Sensor
Interface
Actuator
Percept
Signal
AgentAction
EnvironmentStateModel
KnowledgeBase
Model
KBSentence
30Available 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