D. LopesA Step Forward in Semi-automatic Metamodel Matching
A Step Forward in Semi-automatic Metamodel Matching: Algorithms and Tool
A Step Forward in Semi-automatic Metamodel Matching: Algorithms and Tool
1
José de Sousa Jr1, Denivaldo Lopes1, Daniela Barreiro Claro2 and Zair Abdelouahab1
1 Federal University of Maranhão - UFMA, São Luís - MA, Brazil2 Federal University of Bahia - UFBA, Salvador - BA, Brazil
UFMA UFBA
ICEIS 2009
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Agenda
• Introduction– Context
– Problem
– Motivation
• An Approach for Metamodel Matching– Foundation for Metamodel Matching
– Another Algorithm for Metamodel Matching
2
– Another Algorithm for Metamodel Matching
• Extending and Adapting SAMT4MDE– Modeling
– Prototyping
– Tests
• Conclusions
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Introduction
• Context– The complexity of producing software systems has
increased due:
• Continuous evolution of the requirements.
• The creation of new technologies.
• Integration with legacy systems.
3
– The phases of software development, maintenance
and evolution become more difficult.
– Model Driven Engineering (MDE) has made the
management of this complexity possible.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Introduction
• Context– In MDE context, models are formal entities that can
be understood and processed by computers.
– Examples of MDE:
• Model Driven Architecture (MDA) from OMG.
4
• Eclipse Modeling Framework (EMF) from Eclipse Project.
• Software Factories from Microsoft.
– In model driven approaches, model transformation is
the basic operation to manage models.
Model A Model B
Transformation Definition
Transformation Engine
execute
input output
Main point to
achieve
transformation.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Introduction
• Context– However, the manual creation of transformation
definitions is a programming activity.
• It is error-prone and a tedious task.
– We need more than transformation definition.
5
– We need more than transformation definition.
The insight is to apply
MDE concepts to
develop MDE.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Introduction
• Context
6
* Lopes, D.: Study and Applications of the MDA Approach in Web Services Platforms, Ph.D.
Thesis, University of Nantes (2005)
Mapping Specification and Transformation Definition
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Background
• Context
(or mapping specification)
contains the correspondences
between the source and the
Platform-Independent
Model (PIM)
7
* Lopes, D.: Study and Applications of the MDA Approach in Web Services Platforms, Ph.D.
Thesis, University of Nantes (2005)
between the source and the
target metamodel.
(or transformation definition)
contains the operational rules
to transform a model into
another.
Mapping Specification and Transformation Definition
Platform-Specific
Model (PSM)
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Background
• Context
However, create manually
mapping models is not easy.
8
* Lopes, D.: Study and Applications of the MDA Approach in Web Services Platforms, Ph.D.
Thesis, University of Nantes (2005)
mapping models is not easy.
How support the semi-automatic
creation of mapping model (or
mapping specification)?
How match two metamodels?
Mapping Specification and Transformation Definition
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Introduction
• Problem
– How support the semi-automatic creation of
mapping specification in Model Driven
Engineering (MDE)?
9
• Motivation
– Schema matching was applied with success
in other fields :
• Database integration and evolution.
• E-business.
• Data warehousing.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Agenda
• Introduction– Context
– Problem
– Motivation
• An Approach for Metamodel Matching– Foundation for Metamodel Matching
– Another Algorithm for Metamodel Matching
10
– Another Algorithm for Metamodel Matching
• Extending and Adapting SAMT4MDE– Modeling
– Prototyping
– Tests
• Conclusions
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Foundation for Metamodel Matching
– A transformation definition can be defined as:
( )( ) bcMMa MsMMCMsMTransfba
/)(/,/ 21 →→
11
c
bacMM
b
a
M
MMMC
MsM
MsM
where
ba
metamodel theusing
created and between model mapping theis /
, metamodel theusing created system afor model a is
, metamodel theusing created system afor model a is
2
1
→
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Foundation for Metamodel Matching
– The operator match can be defined as:
( )ba MMba CMMMatch
→=,
12
How implement this operator?
What are the features to be considered in
the algorithm executed by this operator?
D. LopesA Step Forward in Semi-automatic Metamodel Matching
≠−
≅
=
=
xi
xi
xi
xi
ba
ba
ba
ba
11
11
11
11
if 1
if 0
if 1
),(ϕ
= ba if 1
1. Create C.
2. Initialize C.
3. Find leaf classes.
4. Select equal or similar classes
5. After iterating (4) to a fix point, put each c1p in C.
ϕ is calculated using dictionaries,
taxonomies, crosskind
An Approach for Metamodel Matching
• Foundation for Metamodel Matching
– An initial algorithm for metamodel matching*.
OK!
This work but is not enough!
We need more than metamodel
13
≠−
≅
=
=
yj
yj
yj
yj
ba
ba
ba
ba
22
22
22
22
if 1
if 0
if 1
),('ϕ
≠−
≅
=
=
zk
zk
zk
zk
ba
ba
ba
ba
33
33
33
33
if 1
if 0
if 1
),(''ϕ
5. After iterating (4) to a fix point, put each c1p in C.
6. Select equal or similar data types
7. After iterating (6) to a fix point, put each c2q into C.
8. Select equal or similar enumerations
9. After iterating (8) to a fixpoint, put each c3s into C.
taxonomies, crosskind
relationships and discrete values.
* Lopes, D., Hammoudi, S., Abdelouahab, Z.: Schema Matching in the Context of Model Driven Engineering: From Theory to Practice. In Proceedings of SCSS 2005, pp. 219-227 (2005).
We need more than metamodel
matching based on dictionaries,
taxonomies, crosskind
relationships and discrete values.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching
– Our contribution is:
• another algorithm based on structural comparison between a class and its neighbor classes.
– Our algorithm proposal is an extension and
enhancement of the algorithm presented by U. Chukmol
14
enhancement of the algorithm presented by U. Chukmol
et al *.
– We adapt and extend this algorithm to handle
metamodel matching.
* Chuckmol, U., Rifaiem, R., Benharkat, N.: EXSMAL: EDI/XML Semi-Automatic Schema Matching Algorithm. In: Proc. the Seventh IEEE Int. Conference on E-Commerce Technology, pp. 422-425 (2005).
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching
– The similarity function between two classes c1 and c2 is
given by:
( )
coefStructccstructSim
coefBaseccbasicSimccsimilarity
*),(
),(, 2121 +∗=
15
coefStructccstructSim *),( 21
1 and
,10
,1 0
=+
≤≤
≤≤
coefStructcoefBase
coefStruct
coefBasewhere
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching
– The value of similarity(c1,c2) is compared to a threshold
value in the range [0,1].
– If a similarity is greater than threshold value, then c1
and c2 are correspondent.
16
and c2 are correspondent.
– Threshold value is an important point to take a
decision:
• If the value is low, many elements will be considered correspondent in a wrong way (false positive).
• If the value is high, many elements will not be considered as correspondent (false negative).
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– The structural neighbors of a class C is constituted of:
<ancestor(C), sibling(C),immediateChild(C),leaf(C)>
17
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching
– The structural similarity is obtained from partial
similarities:
• ancestorSimClass(c1,c2)
• siblingSimClass(c1,c2)
Each function populates an array M with dimension
m1 x m2.
where:
18
• immediateChildSimClass(c1,c2)
• leafSimClass(c1,c2)
where:
m1 is the size of the set of
classes related to c1.
m2 is the size of the set of
classes related to c2.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– Algorithm for determining similarity between pairs of
ancestors, ancestorSimClass(c1,c2).
for i = 0 until size of (ancestor(c1)) do
for j = 0 until size of (ancestor(c2)) do
M[i][j] <- basicSim (ancestor(c1).get(i),
ancestor(c2).get(j));
19
ancestor(c2).get(j));
endfor;
endfor;
Only based on taxonomies and
dictionaries.
Means that ancestor class of
class c1 (R0) has a similarity
value of 0.7 in relationship to
ancestor class of c2 (C1).
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– After the creation of M, each function of partial similarity
invokes a function agg.
float agg(float m[][], float thr, float lastvl) {
float average = avg(m, lastvl);
float standardDeviation = sd(m, lastvl);
20
float vc = (float) (standardDeviation / average);
float result = 0;
if (thr >= vc) { return average;}
else {
float lastvl = average * (1 - thr);
result = agg (m, thr, lastvl);
}
return result;
}
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– After the creation of M, each function of partial similarity
invokes a function agg.
float agg(float m[][], float thr, float lastvl) {
float average = avg(m, lastvl);
float standardDeviation = sd(m, lastvl);
21
float vc = (float) (standardDeviation / average);
float result = 0;
if (thr >= vc) { return average;}
else {
float lastvl = average * (1 - thr);
result = agg (m, thr, lastvl);
}
return result;
}
( ))2(*)1(
]][[
)1(
1
)2(
1
cancestorcancestor
jiM
avg
cancestor
i
cancestor
j∑ ∑=
=
=
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– After the creation of M, each function of partial similarity
invokes a function agg.
float agg(float m[][], float thr, float lastvl) {
float average = avg(m, lastvl);
float standardDeviation = sd(m, lastvl);
22
float vc = (float) (standardDeviation / average);
float result = 0;
if (thr >= vc) { return average;}
else {
float lastvl = average * (1 - thr);
result = agg (m, thr, lastvl);
}
return result;
}
( )
)2(*)1(
]][[)1(
1
)2(
1
2
cancestorcancestor
avgjiMsd
cancestor
i
cancestor
j∑ ∑= =−
=
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– After the creation of M, each function of partial similarity
invokes a function agg.
float agg(float m[][], float thr, float lastvl) {
float average = avg(m, lastvl);
float standardDeviation = sd(m, lastvl);
23
float vc = (float) (standardDeviation / average);
float result = 0;
if (thr >= vc) { return average;}
else {
float lastvl = average * (1 - thr);
result = agg (m, thr, lastvl);
}
return result;
}
average
viationstandardDeeficientvarianceCo =
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– After the creation of M, each function of partial similarity
invokes a function agg.
float agg(float m[][], float thr, float lastvl) {
float average = avg(m, lastvl);
float standardDeviation = sd(m, lastvl);
If threshold ≥ vc, the variance coefficient is below the established limit, then the
average can be considered a reliable value, and the function agg returns an
average value.
If threshold < vc, the function agg excludes the values of M that are below avg*(1-
threshold), because these values are contributing to dispersion of the average.
After, agg calculates new measures. This procedure continue until threshold ≥ vc.
24
float vc = (float) (standardDeviation / average);
float result = 0;
if (thr >= vc) { return average;}
else {
float lastvl = average * (1 - thr);
result = agg (m, thr, lastvl);
}
return result;
}
D. LopesA Step Forward in Semi-automatic Metamodel Matching
An Approach for Metamodel Matching
• Another Algorithm for Metamodel Matching– Function structSim(c1,c2) is given by:
coefimmCccsshildSimClaimmediateC
coefSibccClasssiblingSim
coefAncccmClassancestorSiccstructSim
*)2,1(
*)2,1(
*)2,1(),( 21
+
+
+=
25
coefLeafccssleafSimCla
coefimmCccsshildSimClaimmediateC
*)2,1(
*)2,1( +
1=+++ coefLeafcoefimmCcoefSibcoefAnc
where
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Agenda
• Introduction– Problem
– Motivation
• An Approach for Metamodel Matching– Foundation for Metamodel Matching
– Another Algorithm for Metamodel Matching
• Extending and Adapting SAMT4MDE
26
• Extending and Adapting SAMT4MDE– Modeling
– Prototyping
– Tests
• Conclusions
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Extending and Adapting SAMT4MDE
• Modeling: Semi-Automatic Tool for MDE
ValidateAction GenerateLangAction MatchAction
1
+matchClasses(in classMa, in classMb)
+matchDataTypes(in dTMa, in dTMb)
+matchEnum(in enumMa, in enumMb)
+basicSimClass(in classA, in classB)
+structSimClass(in classA, in classB)
OptmizedMatch
27
+setMouseListener(in mouseControl)
+makeContributions()
-adapterEditingDomain
MappingTreeViewer
11 1 1
1
1
+match()
+init(in pckA, in pckB)
«interface»
ITFMatchEngine+matchClasses(in classMa, in classMb)
+matchDataTypes(in dTMa, in dTMb)
+matchEnum(in enumMa, in enumMb)
+phiClass(in classA, in classB)
+phiEnum(in enumA, in enumB)
+phiDataType(in dTA, in dTB)
Match
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Extending and Adapting SAMT4MDE
• Prototyping
28
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Extending and Adapting SAMT4MDE
• Tests
29
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Extending and Adapting SAMT4MDE
• Tests
30
Results matching UML metamodel and Java
metamodel
Similarity = 0.68
Precision = 0.84
Recall = 0.90
F-Measure = 0.87
Overall = 0.73
threshold=0.6
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Agenda
• Introduction– Context
– Problem
– Motivation
• An Approach for Metamodel Matching– Foundation for Metamodel Matching
– Another Algorithm for Metamodel Matching
31
– Another Algorithm for Metamodel Matching
• Extending and Adapting SAMT4MDE– Modeling
– Prototyping
– Tests
• Conclusions
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Conclusion
• Contribution
– An algorithm for metamodel matching based
on structural similarities.
– The implementation in a tool capable of semi-
automatically creating mapping specifications.
32
• Future works
– Minimize the errors in the matching (i.e. false
positives and false negatives).
– Introduce semantic analysis and machine
learning.
D. LopesA Step Forward in Semi-automatic Metamodel Matching
Thank you very much for your attention!
Questions?
AcknowledgementsThis research work is supported by
33
Conselho Nacional de PesquisaFundação de Amparo à Pesquisa e ao Desenvolvimento
Científico e Tecnológico do Maranhão
-
Governo do Estado do Maranhão
Contacts – Denivaldo Lopes (e-mail: [email protected] )
– José de Sousa Jr (e-mail: [email protected])
– Daniela Barreiro Claro (e-mail: [email protected])
– Zair Abdelouahab (e-mail: [email protected])