Title: A Verification Mechanism for Weaving in Extensible AOM Languages
1A Verification Mechanismfor Weaving in
Extensible AOM Languages
ADI2007 _at_ ECOOP2007
- Naoyasu Ubayashi, Yusaku Maeno, Kazuhide Noda and
Genya Otsubo
July 30, 2007
2Outline
- Motivation
- AspectM an extensible AOM language
- Verification mechanism
- Conclusion
3 4Extensible AOM language
- AOM (Aspect-oriented Modeling) languages can cope
with concerns at the early stages of the software
development phases. - We previously proposed a UML-based AOM language
called AspectM. - AspectM is an extensible AOML based on MMAP
(Metamodel Access Protocol). - The extension mechanism in AspectM is effective
for constructing domain-specific modeling
languages.
5Problems in extensible AOM languages
- It is not necessarily easy to check model
consistency and aspect interference.
Verification mechanism
Does a base model conform to metamodel ?
Does a woven model include cyclic inheritances?
Does a pointcut select join points correctly ?
Extensible AOM Language
A modeler can extend metamodel. A modeler can add
new aspects that include user-defined
JPMs. (user-defined pointcuts, etc)
6- 2. AspectM
- an extensible AOM language
7AspectM
Aspect name Logging
Pointcut cname(Customer) cname(Invoice)
AspectM JPM????????
8AspectM is nice, but
- There might be situations in which a modeler
wants to introduce domain-specific notations and
JPMs.
isUserAssignedfalse
isUserAssignedtrue
isUserAssignedfalse
pointcut-body !DCEntityContract_UniqueId_isUse
rAssigned() advice-body ltltDCLoggerOperationgtgtl
og()
9AspectM extension mechanism
Meta level
reify
modify the AspectM metamodel
protocols
extension point
DSL Components
MMAP
Editing-time structural reflection
Base level
reflect
introduce a new kind of domain-specific model
element
new model element
Reflective Model Editor
10MMAP
AspectM metamodel
Extension points
Class Element
- Class, Attribute, Operation
- PA, CM, NE, OC, RN, RL, IH
Extension operations
- define subclasses
- add attributes to subclasses
- create associations among subclasses
- add constraints using OCL
Aspect Element
Primitive predicates
- predicates for navigating the AspectM metamodel
extension point
example of extension operations
11Metamodel navigation
DCEntityContract_UniqueId_isUserAssigned (c)
meta-class-of ("DCEntityContract", c)
member-of (a, c) meta-class-of
("UniqueId", a) member-of
("isUserAssigned", "UniqueId") value-of
("true", "isUserAssigned")
member-of
meta-class-of
meta-class-of
Meta level
member-of
Base level
value-of
12Overview of reflective model editor
Base Editor
Extension Procedure
Meta Editor
- Execute extension operations.
- Assign a graphic notation to a new model element.
- Regenerate the metamodel.
- Restart the base editor.
13Demonstration
Invoke the Meta Editor
Overview of Reflective Model Editor
Base Editor
Extension Procedure
Meta Editor
- Execute extension operations
- Assign a graphic notation to a new model element
- Regenerate the metamodel
- Restart the base editor
Base Editor
14Show an extension point
Rebuild the Base Editor
Create a new metaclass
Execute extension operations (add attribute,
association, )
Assign a graphic notation
Meta Editor
15New model elements are added to the pallet
Base Editor
16Meta Editor
Base Editor
17- 3. Verification mechanism
18What should be checked ?
- Structural correctness (Syntax check)
- Intention of a modeler (Semantic check)
19Syntax Check Structural correctness
- Consistency between base models and metamodel
- Base models might not conform to metamodel if it
evolves (metamodel can be modified by a modeler). - A woven model might not conform to metamodel even
if each base model before weaving conforms to
metamodel (aspects can be added by a modeler). - A woven model might include inference including
name conflicts, multiple inheritance and cyclic
inheritance.
evolution (introduce new elements)
Extended Metamodel V1
Extended Metamodel V2
Extended Metamodel
check conformance inference
check conformance
weaving
Woven model
Base model
20Model structure checker
- Generate a default schema from the original
metamodel. - Check whether the metamodel is extended.
- Redefine the schema if extended.
- Check whether a base model conforms to the
extended metamodel.
1 ltxsdcomplexType name"ClassType"gt 2
ltxsdchoice maxOccurs"unbounded" minOccurs"0"gt
3 ltxsdelement name"Attribute"
type"AttributeType"/gt 4 ltxsdelement
name"Operation" type"OperationType"/gt 5
ltxsdelement nameTransactionOperation"
type" TransactionOperationType"/gt 6
lt/xsdchoicegt 7 ltxsdattribute name"name"
type"Name" use"required"/gt 8
ltxsdattribute name"isAbstract" type"Boolean"
use"optional"/gt 9 lt/xsdcomplexTypegt 10 11
ltxsdcomplexType name" TransactionOperationType
"gt 12 ltxsdcomplexContentgt 13
ltxsdextension baseOperationType/gt 14
lt/xsdcomplexContentgt 15 lt/xsdcomplexTypegt
21Semantic Check Intention of a modeler
- Assertions for checking (un)favorable properties
- Captured join points might not be the points
intended by a modeler. - Intended results might not be obtained when a
modeler makes a mistake in specifying the
precedence. - The mixture of illegal pointcut designators and
illegal aspect precedence might cause an
unexpected weaving.
specified by predicates
super_class_of (c1, c2) attribute_of (a,
c) operation_of (o, c) advice_of (a,
o) class_exist (c) related_to (c1,
c2) aggregate(c1, c2) composed_of (c1, c2)
Assertions
check assertions
base and meta models can be navigated using
predicates
Woven model
22Assertion checker
- Translate base and meta models into Prolog facts.
- Generate Prolog queries from assertions.
- Check the satisfiability.
A model represented in XML ltownedElement
name"TransOp" xsitype"asmTransactionOperati
on" /gt Prolog facts modelElement(
property('tagName', 'ownedElement'),
property('name', 'TransOp'),
property('xsitype',
'asmTransactionOperation'))
Assertion for checking the effect of a single
aspect can be automatically generated.
Translate
Check
Assertion operation_of ('TransOp', 'C')
23 24Conclusion Future work
- We clarified how the metamodel extension affects
the verification of the weaving. - We proposed a verification mechanism for weaving
in extensible AOM languages. - Currently, only simple cases are shown.
- We must prepare verification mechanisms
corresponding to the purpose of AO modeling
(Behavior modification, Refinement (MDA) ) - Constraints specified in metamodel can be useful
for verifying a weaving.
25Constraint preservation
- In AspectM, pre-/post-conditions and invariants
can be specified for rigorous modeling. - However, a weaving might break the constraint
specified in a model before weaving.
What kind of weaving should be allowed ?
For example, behavior subtyping ( MDA, ), and
so on.
A first step towards verifying model weaver
26 27Implementation (1) -- Reflective model editor
Core Editor Generator
Modeler
Eclipse Modeling Framework
Code Generator for EMF
Metamodel for EMF
Code of Model Editor
Meta Editor
Map model for GMF
Graphical Modeling Framework
Extended Metamodel
Tool model for GMF
Base Editor
Code Generator for GMF
Code of Graphic Editor
Graph model for GMF
Graphic Editor Generator
Interface
28Implementation (2) -- Model weaver
Model Weaver
Model Editor
Weaving
write
Non Woven Model
Woven Model
Base Editor
analyze pointcut
convert
Fact
Modeler
Prolog