Post on 19-Dec-2015
Bridging existing Web Modeling Languages to Model-Driven Engineering:A Metamodel for WebMLAndrea Schauerhuber, Manuel Wimmer, Elisabeth Kapsammer
Workshop on Model-Driven Web Engineering (MDWE’06) in conj. with ICWE’06Tuesday, July 11, 2006Standford Linear Accelerator Center, Palo Alto, California
Andrea SchauerhuberWomen’s Postgraduate College for Internet TechnologiesInstitute of Software Technology and Interactive Systems
Vienna University of Technologyhttp://wit.tuwien.ac.at
2
Outline
Motivation Related Work Methodology & Conceptual Architecture Automatic Metamodel Generation Manual Refactorings Lessons Learned Outlook
3
Motivation
Most existing Web modeling languages not fully model-driven, i.e., they often provide code
generation facilities, only but no model transformation or a common format for
model exchange Metamodels or UML Profiles are a prerequisite for
model-driven engineering WebML is a prominent Web modeling language,
due to existing tool support (WebRatio) and applications in real world projects
WebML is not specified in terms of a metamodel but in terms of a DTD
A Metamodel for WebML
4
Related Work
A metamodel for WebML proposed by [Moreno et al., 2006]Why yet another metamodel for WebML?Developed in parallel, but … different goals: DSL vs. UML Profile different methodology:
bottom-up vs. top-down semi-automatic vs. manual
different application: transformation of existing WebML XML documents to
models vs. models from scratch Metamodels for other Web modeling languages
UWE [Koch et al., 2003], W2000 [Baresi et al., 2006], Netsilon [Muller et al., 2005] are based on MOF 1.4
We use new technologies (MOF 2.0, EMF, Ecore, ATL, oaW)
5
Methodology
Define WebML metamodel semi-automatically
What WebML to use?
WebRatio DTD: used as a basis for automatic generation of a first version of the metamodel
WebRatio functionality: used to manually incorporate concepts that could not be captured by the DTD
WebML literature: used to manually refine the generated metamodel
Step 1
Step 2
6
M2
M1
WebML Metamodel
«conformsTo»
«conformsTo»
WebML Model
WebML DTD
WebML XML Doc
Class
Class Class Class
Class
Class Class
Class
Class Class Class
Class
Class Class Class
Class
Class Class
Class
Class Class
Class
Class Class Class
Class
Class Class
Class
Class Class Class
Class
Class Class Class
Class
Class Class
Class
Class Class<!ELEMENT A><!ATTLIST A>
<!ELEMENT B><!ATTLIST B>
<!ELEMENT C><!ATTLIST C>
M3 Mapping
«conformsTo»
«conformsTo»
MOFDTD-Grammar
The Conceptual Architecture
«uses»
«parses» «generates»
MetaModelGenerator (MMG)
«parses» «generates»
<!ELEMENT A><!ATTLIST A>
<!ELEMENT B><!ATTLIST B>
<!ELEMENT C><!ATTLIST C>
XMI-Serializer<ecore class>
<ecore><ecore class><ecore att>
Omondo
Draft Metamodel
MetaModelGenerator (MMG)
User
DTD element type object
graph
Metamodel element object
graphDTD-Parser Transformer
«uses» «uses»
2.
Semanticenrichment
1.
TransformationRules Heuristics
Mapping
<!ELEMENT A><!ATTLIST A>
<!ELEMENT B><!ATTLIST B>
<!ELEMENT C><!ATTLIST C>
7
Step 1: Automatic Metamodel Generation
XML technical space Model technical space Various approaches examined [Wimmer et al., 2006] DTD, XML Schema vs. UML, ER, ORM Until now no approach to generate MOF-based
metamodels from DTDs Based on these approaches we developed
Set of Transformation Rules Rules for transforming XMLElementTypes Rules for transforming XMLAttributes
3 Heuristics (may not be applicable for all DTDs) IDREF(S) Resolution Boolean Identification Package Identification
8
*
ENTITYENTITY
RELATIONSHIPRELATIONSHIP
relationship<!ELEMENT RELATIONSHIP EMPTY>
entity 1
Step 1: Automatic Metamodel Generation
<!ATTLIST RELATIONSHIPname CDATA #IMPLIEDentity IDREF #REQUIRED>
<!ATTLIST ENTITYid ID #REQUIREDname CDATA #IMPLIED>
id:EStringid:EStringname:EString[0..1]name:EString[0..1]
name:EString[0..1]name:EString[0..1]entity:EObjectentity:EObject
An Example for Transformation Rules & Heuristics
DTD Metamodel
1) Create classes for XML element types2) Create containment references for XML
content particles3) Create attributes for XML attributes
1) Apply Heuristic IDREF Resolution
<!ELEMENT ENTITY (RELATIONSHIP*)><!ELEMENT ENTITY (RELATIONSHIP*)>ENTITY
<!ATTLIST ENTITYid ID #REQUIREDname CDATA #IMPLIED>
<!ATTLIST RELATIONSHIPname CDATA #IMPLIEDentity IDREF #REQUIRED>entity
9
Step1: Output - Metamodel Metrics
Automatically generated metamodel draft
EPackage 3
EClass 54
EAttribute 143
EBoolean 37
EInteger 0
EString 93
IDREF unresolved 12
EEnumeration 13
EReference 125
Containment 105
IDREF resolved 20
EEnumeration 13
EEnumLiteral 93
Superclasses 0
Subclasses 0
MAX EClasses/EPackage 49
MIN EClasses/EPackage 5
AVG EClasses/EPackage 27Metamodel metrics, [Ma et al., 2004]
10
Step 2: Manual Refactoring
DTD deficienciesUnknown referenced element type(s)Missing role conceptAwkward cardinalitiesXOR constraintsNo explicit grouping mechanismMissing inheritance conceptLimited set of datatypesNo bi-directional associations
Manual Refactorings necessary
11
Step 2: Manual Refactoring – Example 1
It is not possible to identify which element type(s) may be referenced from an IDREF-typed attribute
<!ELEMENT Link (…)>
<!ATTLIST Linktype (normal|automatic|transport) ‘normal’to IDREF #REQUIRED…>
<!ELEMENT IndexUnit (…, LINK*,…)>
Unknown Referenced Element Type(s)
Linktype:LinkType
EObjectto
1IndexUnitDataUnit
…
LinkableElement
link*
link*
link*
link*
<!ELEMENT Link (…)>
type (normal|automatic|transport) ‘normal’to IDREF #REQUIRED
<!ELEMENT IndexUnit (…, LINK*,…)>
to 1
12
Step 2: Manual Refactoring – Example 2
DTDs do not allow to express that an element type can be deployed in different contexts
<!ELEMENT ConnectUnit(SourceSelector?,TargetSelector?,…)>
<!ELEMENT Selector(SelectorCondition+)>
<!ELEMENT SourceSelector (SelectorCondition+)>
<!ELEMENT TargetSelector (SelectorCondition+)>
Missing Role Concept
0..1
0..1targetSelector
sourceSelectorConnectUnit
SourceSelector
TargetSelector
Selector
13
Step 2: Manual Refactoring – Example 3
Restricted mechanism of DTDs to specify cardinalities (e.g., 2..5)
<!ELEMENT AlternativePage (Page, Page+)><!ATTLIST AlternativePage …defaultPage IDREF #IMPLIED>
Awkward Cardinalities
page
defaultPage 0..1
1
page
PageAlternative
Page
1..*
page2..*
14
Step 2: Manual Refactoring – Example 4
DTDs provide no mechanism to express xor-constraints
<!ELEMENT Area (…,Area*,Page*,…)><!ATTLIST Area…defaultPage IDREF #IMPLIEDdefaultArea IDREF #IMPLIED…>
Missing XOR Constraints
defaultPage0..1
*page
0..1
defaultArea
* area
PageArea
{xor}
XOR
15
Step 2: Manual Refactoring – Example 5
No Explicit Grouping Mechanism
<!-- WebML.dtd -->
<!ENTITY % StructureDTD SYSTEM "Structure.dtd">
%StructureDTD;
<!ENTITY % NavigationDTD SYSTEM “Navigation.dtd">
%NavigationDTD;
WebML
<!-- Structure.dtd --><!ELEMENT Entity (…)><!ELEMENT Attribute EMPTY>…
<!-- Navigation.dtd --><!ELEMENT Link (…)>…
Structure
NavigationContent
Management
Access Control
HypertextOrganization
Hypertext
Content
<!ENTITY % StructureDTD SYSTEM "Structure.dtd">
%StructureDTD;
<!ENTITY % NavigationDTD SYSTEM “Navigation.dtd">
%NavigationDTD;
16
Step 2: Manual Refactoring – Example 6
Missing Inheritance Concept
to
1
link *LinkableElement
ContentUnit
Link
GetUnitEntryUnitDisplayUnit
SortableUnit DataUnit
HierarchicalIndexUnit
MultiChoiceIndexUnit IndexUnit
MultiDataUnit
ScrollerUnit
Hypertext1)
- normal- transport- automatic
«enumeration» LinkType
type:LinkType
ContentManagement1)
1 relationship1 entity
selector0..1
0..10..1
0..1targetselector
sourceselectorselector
to
to
*
*
0..1
0..1
okLink
koLink
OperationUnit
SetUnit ContentManagementUnit
RelationshipManagementUnit
ConnectUnit DisconnectUnit
Content::Relationship
DeleteUnitModifyUnitCreateUnit
Content::Entity
Hypertext::Selector
OKLink
KOLink
Hypertext::LinkableElement
EntityManagementUnit
1) Please note, that this is only an excerpt from the metamodel. See http://www.big.tuwien.ac.at/projects/webml/index.html for the full specification.
17
Step2: Output - Metamodel Metrics
Automatically generated metamodel draft
Refactored metamodel
EPackage 3 6
EClass 54 54
EAttribute 143 84
EBoolean 37 25
EInteger 0 2
EString 93 44
IDREF unresolved 12 0
EEnumeration 13 13
EReference 125 74
Containment 105 48
IDREF resolved 20 26
EEnumeration 13 8
EEnumLiteral 93 40
Superclasses 0 9
Subclasses 0 28
MAX EClasses/EPackage 49 24
MIN EClasses/EPackage 5 3
AVG EClasses/EPackage 27 10
18
Lessons Learned
DTDs are not appropriate for designing modeling languages
Technical problems Graphical editors (e.g., Omondo) have difficulties in
displaying large models Manual effort for reorganizing the graphical models (layout)
Eclipse plugins require a lot of memory Advantages of automatically generating a draft metamodel
Correct translation of concepts and their interrelationships Visualization of the language fosters understanding With minimal manual refactorings (IDREF) one is able to obtain
metamodel that is equivalent to the original DTD Models that are equivalent to the original XML documents
can be generated. Metamodel still can be improved and semantically
enriched by introducing generalization hierarchies, etc.
19
Outlook
Open Issues Extend the WebML Metamodel with WebML concepts
that have not been part of the DTD (Web Services, Process Modeling)
OCL constraints for Links Extend, improve, and evaluate DTD2MOF-Framework
Future Work Applying Aspect-Orientation to
the Model-Driven Development of Ubiquitous Web Applications1
Integration of Web modeling languages – towards a common understanding in the web modeling field.
1A. Schauerhuber, aspectUWA: Applying Aspect-Orientation to the Model-Driven Development of Ubiquitous Web Applications, Student Extravaganza: Spring School, AOSD'06, Bonn, Germany, March 19, 2006.
20
References
N. Moreno, P. Fraternalli, and A. Vallecillo. A UML 2.0 Profile for WebML Modeling. Workshop on Model-Driven Web Engineering (MDWE 2006), in conjunction with ICWE'06, Standford Linear Accelerator Center, Palo Alto, California, July 2006.
L. Baresi, S. Colazzo, L. Mainetti, and S. Morasca. W2000: A Modeling Notation for Complex Web Applications. In E. Mendes and N. Mosley (eds.) Web Engineering: Theory and Practice of Metrics and Measurement for Web Development. Springer, 2006.
L. Baresi, F. Garzotto, and M. Maritati. W2000 as a MOF Metamodel. In Proc. of the 6th World Multiconference on Systemics, Cybernetics and Informatics - Web Engineering track. Orlando, USA, July 2002.
N. Koch, A. Kraus. Towards a Common Metamodel for the Development of Web Applications. In Proc. of the 3rd International Conference on Web Engineering (ICWE 2003), July 2003.
P.-A. Muller, P. Studer, F. Fondement, J. Bézivin. Platform independent Web application modeling and development with Netsilon. Software & System Modeling, 4(4), November 2005.
M. Wimmer, A. Schauerhuber, E. Kapsammer, and G. Kramler. From Document Type Definitions to Metamodels: The WebML Case Study. Technical Report. Vienna University of Technology, March 2006.
H. Ma, W. Shao, L. Zhang, Z. Ma, and Y. Jiang. Applying OO Metrics to Assess UML Meta-models. In Proc. of the 7th International Conference on the Unified Modelling Language: Modelling Languages and Applications. Springer-Verlag LNCS 3273, 2004.