Faculty of Computer Science, Institute for Software- and Multimedia-Technology, Chair for Software Technology Matthias Bräuer Design and Prototypical Implementation of a Pivot Model as Exchange Format for Models and Metamodels in a QVT/OCL Development Environment Großer Beleg Final Presentation
Contents Introduction Research Methodology Results Evaluation TU Dresden Großer Beleg Final Presentation Slide 2 of 27
Contents Introduction Research Methodology Results Evaluation TU Dresden Großer Beleg Final Presentation Slide 3 of 27
Motivation Model-driven Software Development (MDSD) emerging paradigm for higher productivity and quality in software engineering increasing importance of domain-specific modeling languages (DSL) on meta layers M2 and M3 requires precise models, model transformations idea: use a standard constraint and model query language like OCL on instances of arbitrary DSLs TU Dresden Großer Beleg Final Presentation Slide 4 of 27
Goals design of a pivotal metamodel to integrate OCL with multiple DSLs OCL Pivot Model DSL implement an approach to realize the mapping between the Pivot Model and the target DSL TU Dresden Großer Beleg Final Presentation Slide 5 of 27
Example EMF Ecore small and specialized language for defining objectoriented metamodels meta-metalanguage (M3) Benefits of integration with OCL: express wellformedness rules over Ecore models transform Ecore models using QVT Example language defined with Ecore: Plugin Modeling Language (PML) TU Dresden Großer Beleg Final Presentation Slide 6 of 27
Example language defined with Ecore: Plugin Modeling Language (PML) TU Dresden Großer Beleg Final Presentation Slide 7 of 27
Contents Introduction Research Methodology Results Evaluation TU Dresden Großer Beleg Final Presentation Slide 8 of 27
Approach analysis of literature about metamodeling to identify foundational challenges analysis of related work to identify respective strengths and weaknesses: Dresden OCL2 Toolkit Kent OCL Library Epsilon Platform definition of a conceptual framework to guide research TU Dresden Großer Beleg Final Presentation Slide 9 of 27
Conceptual Framework Concepts Level Definition Level Execution Level TU Dresden Großer Beleg Final Presentation Slide 10 of 27
Applying the Framework requires integration of Ecore with OCL M3 M2 M1 Ecore PML a Plugin Model M0 a Plugin instance TU Dresden Großer Beleg Final Presentation Slide 11 of 27
Contents Introduction Research Methodology Results Evaluation TU Dresden Großer Beleg Final Presentation Slide 12 of 27
Design of the Pivot Model TU Dresden Großer Beleg Final Presentation Slide 13 of 27
Implementation of Model Adaptation knows OCL engine Pivot Model Target DSL «realize» adapt operates on Adapters TU Dresden Großer Beleg Final Presentation Slide 14 of 27
Presentation generically displaying Ecore models through the Pivot Model interface TU Dresden Großer Beleg Final Presentation Slide 15 of 27
Integrating the OCL Standard Library OCL Standard Library predefined types and operations some problems with integration: infinite number of OCL collection and tuple types all model types implicity derive from OclAny existing OCL engines: dynamic creation of Standard Library in the code complex, error-prone TU Dresden Großer Beleg Final Presentation Slide 16 of 27
Integrating the OCL Standard Library my solution: support templates (generics) in the Pivot Model model Standard Library as instance of Pivot Model integrate by loading serialized XMI and bind generic types when necessary TU Dresden Großer Beleg Final Presentation Slide 17 of 27
Presentation modeling the OCL Standard Library TU Dresden Großer Beleg Final Presentation Slide 18 of 27
Writing OCL expressions for Ecore models example: a wellformedness rule for PML -- a Plugin must have a valid id context Plugin inv: self.id->notempty() problem: existing OCL parser needs adaptation solution: alternative concrete syntax for OCL based on XML use EMF for serialization / deserialization TU Dresden Großer Beleg Final Presentation Slide 19 of 27
OCL in XML XOCL XML-based OCL <xocl:namespacexs pathname="pml"> <ownedrule name="idnotempty" kind="invariant" constrainedelement="plugin"> <specification body="self.id->notempty()"> <bodyexpression xsi:type="xocl:collectionoperationcallexpxs" referredcollectionoperation="notempty"> <source xsi:type="xocl:propertycallexpxs" referredpropertyname="id"> <source xsi:type="xocl:variableexpxs" referredvariable="//@ownedrule.0/@specification/@context"/> </source> </bodyexpression> </specification> </ownedrule> </xocl:namespacexs> TU Dresden Großer Beleg Final Presentation Slide 20 of 27
Presentation visually creating OCL expressions TU Dresden Großer Beleg Final Presentation Slide 21 of 27
Parsing OCL expressions adapter layer allows to add transient elements to a domain-specific model Constraint instances representing OCL expressions properties and operations defined by OCL expressions TU Dresden Großer Beleg Final Presentation Slide 22 of 27
Presentation parsing an XOCL file TU Dresden Großer Beleg Final Presentation Slide 23 of 27
Contents Introduction Research Methodology Results Evaluation TU Dresden Großer Beleg Final Presentation Slide 24 of 27
Evaluation comparison of effort to integrate a DSL Adapted metamodel Lines of code Dresden OCL2 Toolkit Kent OCL Pivot Model UML MOF Ecore Ecore 2124 1657 685 554 automatic generation of large parts of Pivot Model adapter layer possible TU Dresden Großer Beleg Final Presentation Slide 25 of 27
Contributions detailed analysis of conceptual challenges proposal of a conceptual framework thorough review of current Dresden OCL2 Toolkit carefully designed Pivot Model novel approach for integrating Standard Library clean and highly extensible design of an integration framework investigation of Execution Level in preparation of future developments (OCL interpreter) TU Dresden Großer Beleg Final Presentation Slide 26 of 27
The End Thank you for your attention! Questions? Comments? TU Dresden Großer Beleg Final Presentation Slide 27 of 27
Backup TU Dresden Großer Beleg Final Presentation Slide 28 of 27
Generics TU Dresden Großer Beleg Final Presentation Slide 29 of 27
Adaptation TU Dresden Großer Beleg Final Presentation Slide 30 of 27
Ontological Classification Problem two dimensions of metamodeling M2 Metaclass ontological-instance-of Class ontological-instance-of Object linguistic-instance-of linguistic-instance-of linguistic-instance-of M1 Species ontological-instance-of Dog ontological-instance-of Fido TU Dresden Großer Beleg Final Presentation Slide 31 of 27
Ontological Classification Problem In UML: Stereotypes and Profiles extend M2 concepts DSLs define entirely new ontology concepts on M2 M2 (UML metamodel) Stereotype Class 1..* -classifier InstanceSpecification M1 (UML model) «stereotype» Species «stereotype» «Species» Dog -name : String -weight : float fido : Dog name = "Fido" weight = 25.5 TU Dresden Großer Beleg Final Presentation Slide 32 of 27
System Instantiation Problem Transformation on the System layer requires instantiation of new System elements Instantiation semantics? Model Space describes M3: Meta-Metamodel describes instance-of M2: Metamodel describes instance-of M1: Model instance-of System Space describes M0: System instance-of TU Dresden Großer Beleg Final Presentation Slide 33 of 27
ModelFacade Repository Adaptation in Dresden OCL Toolkit UML-specific monolithic (33 methods) + getrefobject (mofid : String) : Object + getfeature (mofid : String) : List + getname (mofid : String) : String + getmultiplicity (mofid : String) : Multiplicity + getordering (mofid : String) : OrderingKind + getqualifier (mofid : String) : List + getnamespace (mofid : String) : Namespace + getupper (mofid : String) : int +... HashMap<String,Object> refobjects mofid 7D749D32- :00036B 7D749D32- :000364 7D749D32- :00035E 7D749D32- :000352 refobject Netbeans Metadata Repository (MDR) Custom Repository TU Dresden Großer Beleg Final Presentation Slide 34 of 27
Mapping «interface» OclFactory getoclrepresentationfor(type : OclType, o : Object) : OclRoot reconvert(targettype : NonOclType, oclobject : OclRoot) : Object getoclmodeltypefor(pathname : String) : OclModelType getoclenumtypefor(pathname : String) : OclEnumType getocltupletype(names : String[], types : OclType[]) : OclTupleType... OclModelObject java.lang.object OclEnumLiteral OclModelType java.lang.class java.lang.enum OclSequence java.util.list OCL Space Java Space TU Dresden Großer Beleg Final Presentation Slide 35 of 27