Generating DDI 4 in the Language of your

  • Slides: 109
Download presentation
Generating DDI 4 in the Language of your Choice Model Driven Architecture for Metadata

Generating DDI 4 in the Language of your Choice Model Driven Architecture for Metadata Standards in Practice Tutorial at EDDI 19, the 11 th Annual European DDI User Conference December 2, 2019, Tampere, Finland Joachim Wackerow, GESIS – Leibniz Institute for the Social Sciences License: Creative Commons Attribution 4. 0 International (CC BY 4. 0), Web page: https: //ddi-alliance. atlassian. net/wiki/x/AQC 7 Kw Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice /109

Overview • Part I – Overview – DDI 4 Core – Model-driven approach for

Overview • Part I – Overview – DDI 4 Core – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 2/109

Work in Progress • This is a warning • DDI 4 Core model can

Work in Progress • This is a warning • DDI 4 Core model can change prior to publication • This approach using Eclipse tools is explorative • Any feedback while and after tutorial is appreciated • Multiple approaches for code generating currently used for DDI 4 Core Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 3/109

DDI 4 Core – Features • Part I – Overview – DDI 4 Core

DDI 4 Core – Features • Part I – Overview – DDI 4 Core • Features • • Model structure and technical details UML primer UML subset UML example and its representations – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 4/109

What is the new DDI 4 product? • Key messages: – The DDI 4

What is the new DDI 4 product? • Key messages: – The DDI 4 CORE product is a small, contained set of content – Three key content areas: 1. Concepts and Variables: Variable Cascade, Format Description, Classifications 2. UML Model: Data Description, Data Management, Representations 3. Process Model: based on the W 3 C PROV model – It does NOT replace DDI-C and DDI-L – it will complement them, and provide better capacity to provide access to DDI-enabled data via the web (particularly semantic web technologies) Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 5/109

Main Features of DDI 4 Core • Domain-independent focus • Concepts and Variables: Variable

Main Features of DDI 4 Core • Domain-independent focus • Concepts and Variables: Variable Cascade, Format Description, Classifications • Data Description, Data Management, Representations – Many new and legacy data structures Approach is based on a single datum/cell • Process description – Based on W 3 C PROV (provenance) and parts of BPMN (Business Process Model and Notation) • UML model – Purposes are: easy approachability, stability, and sustainability – Generated representations in • XML Schema (for preservation and exchange) • OWL/RDF-S (for discovery), draft – Portable form as OMG Canonical XMI for further modeling • Alignement with other standards Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 6/109

Core UML Model Thanks to Jay Greenfield Tutorial: Generating DDI 4 in the Language

Core UML Model Thanks to Jay Greenfield Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 7/109

Concepts and variables Thanks to Jay Greenfield Tutorial: Generating DDI 4 in the Language

Concepts and variables Thanks to Jay Greenfield Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 8/109

Variable Cascade From concept to data value • Concept – The concept layer provides

Variable Cascade From concept to data value • Concept – The concept layer provides an overarching concept from which a variable is defined. Examples include gender, income, occupation, and wages. • Conceptual Variable – The conceptual variable includes the concept as the meaning of the variable, the associated unit type, and the categories the variable may assign. Note, these categories might be enumerated or described by a set of rules. The categories include processing or sentinel categories. These include reasons why data might be missing or incomplete. • Represented Variable – The represented variable includes everything already specified for the conceptual variable plus the way the categories are represented, the intended datatype, a unit of measure if applicable, and any precision (e. g. , number of decimal places) if applicable. • Instance Variable – The instance variable includes everything already specified for the represented variable plus the representations for any sentinel (processing) categories. • Value Mapping – The value mapping provides the means to find and retrieve data corresponding to the instance variable defined above out of a record in a file. It includes the specification of a physical datatype. Each of the upper four layers may be reused to help specify layers underneath. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 9/109

DDI 4 Core: Four Main Data Structures • Unit-record (“wide”) data (e. g. ,

DDI 4 Core: Four Main Data Structures • Unit-record (“wide”) data (e. g. , traditional rectangular data) • “Long” data (event data, spells, sensor flows, etc. ) • Multi-dimensional data (aggregates, indicators, time series, etc. ) • Key-value data (“big” data, data lakes, unstructured data, etc. ) Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 10/109

DDI 4 Core: Process Model Supports three main uses which are of growing importance

DDI 4 Core: Process Model Supports three main uses which are of growing importance in research, especially as increased emphasis is placed on transparency. • The first is a description of provenance at the level of the systems which manage data; • the second is reproducibility (e. g. , does the information exist to reproduce findings? ), and • the third is computational reproducibility (can the reproducibility be performed by computers? ). All three uses require a similar set of information, of increasing detail. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 11/109

Interoperability • UML model enables … – combination with other standards and models in

Interoperability • UML model enables … – combination with other standards and models in other domains – generation of syntax representations • common in other domains • also future ones – further processing for other purposes • DDI 4 Core is available as Canonical XMI Other Standards DDI 4 Syntax Representations Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 12/109

Canonical XMI • The XML Metadata Interchange (XMI) is an OMG standard for exchanging

Canonical XMI • The XML Metadata Interchange (XMI) is an OMG standard for exchanging metadata information via XML – Issue: flexibility of XMI causes many interoperability limitations • Canonical XMI is a portable XMI flavor which can be imported in many UML tools – Details described in XMI 2. 5. 1 specification, appendix B – Issue: tools don’t export to Canonical XMI � Canonical XMI enables interoperability Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 13/109

DDI 4 Core - Model Structure and Technical Details • Part I – Overview

DDI 4 Core - Model Structure and Technical Details • Part I – Overview – DDI 4 Core • Features • Model structure and technical details • UML primer • UML subset • UML example and its representations – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 14/109

Model Organization Focus on DDI 4 Core. PIMLibrary Tutorial: Generating DDI 4 in the

Model Organization Focus on DDI 4 Core. PIMLibrary Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 15/109

Enterprise Architect Model • DDI 4 Core is realized in the commercial UML software

Enterprise Architect Model • DDI 4 Core is realized in the commercial UML software Enterprise Architect – Available as Enterprise Architect file (warning: work in progress) – Can be viewed in the free Enterprise Architect Viewer, read-only 'Lite' Edition: description, download • Exported to EA XMI and transformed by custom XSLT to Canonical XMI Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 16/109

UML Primer • Part I – Overview – DDI 4 Core • Features •

UML Primer • Part I – Overview – DDI 4 Core • Features • Model structure and technical details • UML primer • UML subset • UML example and its representations – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 17/109

UML Class Diagram Primer Some Specific DDI 4 Rules • Class – Name is

UML Class Diagram Primer Some Specific DDI 4 Rules • Class – Name is unique in the model – Attribute (has a multiplicity definition) – Can inherit properties and associations from a superclass, usingle inheritance • Association – – – • Has a name Has multiplicity definitions Only binary and directed Shared aggregation, has only documentary meaning Composite aggregation Datatypes – Primitives – Enumerations – Structured data types • Resources – UML Diagram website and related index – OMG specification UML 2. 5. 1 Multiplicity is formally defined as a lower and upper bound. Simply put: a multiplicity is made up of a lower and an upper cardinality. A cardinality is how many elements are in a set. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 18/109

 • Navigability – Can be understood as a recommendation for efficient direction •

• Navigability – Can be understood as a recommendation for efficient direction • Multiplicity – “A specification of the range of allowable cardinality values - the size - that a set may assume. ” Source: The Unified Modeling Language Reference Manual Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 19/109

DDI 4 Core Example – Class Diagramm Attribute Class name Attribute data type Association

DDI 4 Core Example – Class Diagramm Attribute Class name Attribute data type Association name Generalization Aggregation Multiplicity Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 20/109

UML Subset • Part I – Overview – DDI 4 Core • Features •

UML Subset • Part I – Overview – DDI 4 Core • Features • Model structure and technical details • UML primer • UML subset • UML example and its representations – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 21/109

Subset of UML Class Diagram Items for DDI 4 • Packaging – – •

Subset of UML Class Diagram Items for DDI 4 • Packaging – – • Class definition – – • – Association – only binary, directed associations, with association name (DDI 4 usage violates currently the requirement of unique names in a package), without association end (role) names, both ends have multiplicity definitions Generalization – inherits all attributes and associations of the whole inheritance tree, only single inheritance Data types – – – • Class – template for creating objects, each related object can be identified by a DDI URN (persistent identifier) Property – used for attributes and association ends, have multiplicity definition Relationships – • Model – only one model Package – multiple packages, can be nested Data. Type – structured data types, attribute type definitions could relate to primitive data types or other structured data types Enumeration – set of named values Enumeration. Literal – used in Enumeration Literal. Integer – used in multiplicity definition Literal. Unlimited. Natural – used in multiplicity definition Primitive. Type • Boolean • Integer • Real • String • Unlimited. Natural Documentation – Comment – can be attached to any item The UML items are used in XMI representation with the prefix „uml: “ like „uml: Class“. Links of items go to pages of XMI validator of NIST. Useful UML documentation: UML Diagrams by Kirill Fakhroutdinov Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 22/109

Advantages of the Used UML Class Diagram Subset • Powerful enough for modeling purposes

Advantages of the Used UML Class Diagram Subset • Powerful enough for modeling purposes regarding DDI 4 • The focus on few popular UML items results in … – Simpler modeling – Easier understanding – Portable to many UML tools – Many mapping options to target languages Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 23/109

DDI 4 UML Object Inventory Tutorial: Generating DDI 4 in the Language of your

DDI 4 UML Object Inventory Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 24/109

UML Example and its Representations • Part I – Overview – DDI 4 Core

UML Example and its Representations • Part I – Overview – DDI 4 Core • • Features Model structure and technical details UML primer UML subset • UML example and its representations – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 25/109

DDI 4 Core Example – Class Diagramm Tutorial: Generating DDI 4 in the Language

DDI 4 Core Example – Class Diagramm Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 26/109

DDI 4 Core „Category“ – Canonical XMI Tutorial: Generating DDI 4 in the Language

DDI 4 Core „Category“ – Canonical XMI Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 27/109

Class/Superclass Relationship in XSD Tutorial: Generating DDI 4 in the Language of your Choice

Class/Superclass Relationship in XSD Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 28/109

OWL Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven

OWL Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 29/109

OWL – 2 Tutorial: Generating DDI 4 in the Language of your Choice -

OWL – 2 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 30/109

Model-Driven Approach • Part I – Overview – DDI 4 Core – Model-driven approach

Model-Driven Approach • Part I – Overview – DDI 4 Core – Model-driven approach for DDI 4 • Generation of specific representations: XSD, OWL, R, re. ST, DOT • Generation of any syntax representation • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 31/109

Model Driven Architecture - MDA • Model Driven Architecture® (MDA®) is an approach to

Model Driven Architecture - MDA • Model Driven Architecture® (MDA®) is an approach to software design, development and implementation spearheaded by the OMG – The Object Management Group (OMG) is a computer industry standards consortium. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 32/109

OMG‘s Description of MDA • Software development in the MDA starts with a Platform-Independent

OMG‘s Description of MDA • Software development in the MDA starts with a Platform-Independent Model (PIM) of an application's business functionality and behavior – constructed using a modeling language based on OMG's Meta Object Facility (MOF). • This model remains stable as technology evolves, extending and thereby maximizing software ROI (return on investment). • MDA development tools, available now from many vendors, convert the PIM first to a Platform-Specific Model (PSM) and then to a working implementation on virtually any middleware platform. • Web Services, XML/SOAP, EJB, C#/. Net, OMG's own CORBA, or others. • Portability and interoperability are built into the architecture. • OMG's industry-standard modeling specifications support the MDA: The MOF; UML; the Common Warehouse Metamodel (CWM); and XML Metadata Interchange (XMI). Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 33/109

Model-Driven Approach • • High quality Consistency Code generation on basis of the model

Model-Driven Approach • • High quality Consistency Code generation on basis of the model Changes in the model will be automatically be reflected the next time the code is generated Life cycle development is faster Information living in the model not documents Models (graphical representation) are good for sharing information with both „business people“ and „technical people“ Model is center of „truth“ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 34/109

PIM, PSM, and Code • Platform-independent model (PIM) – „A model that is independent

PIM, PSM, and Code • Platform-independent model (PIM) – „A model that is independent of implementation technology that is also at a high level of complexity. “ • Platform-specific model (PSM) – „A model created by transforming a PIM tailored to specify your system in terms of implementation constructs available in one specific technology. “ • Code – „Code is generated by the transformation of PSMs. “ Citations from: The Object Primer. Agile Model-Driven Development with UML 2. 0. Scott W. Ambler. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 35/109

Code Generation • Why to Use Code Generation – Productivity: write the generator once

Code Generation • Why to Use Code Generation – Productivity: write the generator once – Simplification: generate your code from some abstract description – Portability: target a different language or framework – Consistency: get always the code you expect • Why Not to Use Code Generation – Maintenance: dependency on tools – Complexity: tend to be more complex than code written by hand Source: A Guide to Code Generation, May 9, 2018/in Code processing, Domain specific languages, Model driven development, Software Engineering /by Gabriele Tomassetti Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 36/109

Model-Driven Approach Other Metadata Standards • ISO 19136 -1 Geography Markup Language (GML) –

Model-Driven Approach Other Metadata Standards • ISO 19136 -1 Geography Markup Language (GML) – – Uses UML in Enterprise Architect Representation in XSD Example documentation Best practices for modelling • Fast Healthcare Interoperability Resources (FHIR) – Uses own modeling language – Representations in UML diagrams, XML, JSON, Turtle • Statistical Data and Metadata e. Xchange (SDMX) – Uses UML in a PDF document – Representations in XSD, JSON, CSV • Generic Statistical Information Model (GSIM), reference model – Uses UML in Enterprise Architect • United Nations Centre for Trade Facilitation and Electronic Business (UN/CEFACT) – Uses own modeling language UMM – Representation in XSD Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 37/109

Model-Driven Approach for DDI 4 • Part I – Overview – DDI 4 Core

Model-Driven Approach for DDI 4 • Part I – Overview – DDI 4 Core – Model-driven approach for DDI 4 • Generation of specific representations: XSD, OWL, R, re. ST, DOT • Generation of any syntax representation • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 38/109

Levels of DDI 4 MDA Description Format Purpose Complete UML model (DDI 4 Core.

Levels of DDI 4 MDA Description Format Purpose Complete UML model (DDI 4 Core. PIM) with relations to other standards, design patterns, and diagram, includes next level below UML as Enterprise Architect format (EAP) Conceptual and documentation as platformindependent model (PIM) Class diagram (DDI 4 Core. PIMLibrary) UML as EAP and Canonical XMI (CX) Formal definition of conceptual level, PIM XML Schema UML CX and XSD Formal definition of implementation level as platform-specific level (PSM) and specific syntax OWL vocabulary UML CX and OWL/RDF-S Formal definition of implementation level as PSM and specific syntax Other target representations UML CX and specific type PSM and specific syntax XML instance XML Metadata in structured and standardized form RDF instance RDF Metadata in structured and standardized form Instances in other syntaxes … Metadata in structured and standardized form Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 39/109

DDI 4 Core Production and Exploration DDI 4 Core. PIM as EAP DDI 4

DDI 4 Core Production and Exploration DDI 4 Core. PIM as EAP DDI 4 Core. PIMLibrary as EAP and EAP XMI XSLT Canonical XMI (CX) XSLT ipt Jav a scr Documentation as restructered. Text and dot text el to Mod eleo Acc T L XS XML Schema as UML CX and XSD OWL/RDF-S as UML CX and XSD Other target representations Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 40/109

Modeling, Representation, Testing • DDI 4 Core can change up to the publication date

Modeling, Representation, Testing • DDI 4 Core can change up to the publication date • DDI 4 additions will be added later to DDI 4 Core • Model-driven generation of syntax representations can immediately reflect the changes • Unit tests for validation • � High-quality development Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 41/109

Round Trip of Metadata in Multiple Representations • Consistency of model and syntax representations

Round Trip of Metadata in Multiple Representations • Consistency of model and syntax representations are crucial • Simple subset of UML class diagram features enables the mapping to multiple syntax representations even if the concepts of the representations might be different Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 42/109

Generation of Specific Representations: XSD, OWL, R, re. ST, DOT • Part I –

Generation of Specific Representations: XSD, OWL, R, re. ST, DOT • Part I – – Overview DDI 4 Core Model-driven approach for DDI 4 • Generation of specific representations: XSD, OWL, R, re. ST, DOT • Generation of any syntax representation • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 43/109

XML Schema (XSD) for XML instances • Purpose: preservation and exchange • Document on

XML Schema (XSD) for XML instances • Purpose: preservation and exchange • Document on mapping rules – Does currently not use inheritance by extension to abstract classes • XSLT stylesheet for transformation – Repository: xmi 2 xmi 4 xsd. xsl, xmi 2 xsd. xsl Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 44/109

XSLT Stylesheet Code and resulting XML Schema XSLT XML Schema Tutorial: Generating DDI 4

XSLT Stylesheet Code and resulting XML Schema XSLT XML Schema Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 45/109

OWL Vocabulary for RDF Instances • Purpose: discovery in the Linked Data web •

OWL Vocabulary for RDF Instances • Purpose: discovery in the Linked Data web • Mapping is documented in the DDI 4 Prototype package – “mapping from UML models to RDF models. html” • Draft, doesn’t use other RDF vocabularies • Generator in Javascript, currently burried in larger package • Generates OWL and Sh. Ex (RDF validation) Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 46/109

OWL: Item „Concept“ Tutorial: Generating DDI 4 in the Language of your Choice -

OWL: Item „Concept“ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 47/109

Library for the R Language for Statistical Computing • Python generator program – Parser

Library for the R Language for Statistical Computing • Python generator program – Parser for XMI – Generation part • R 6 classes in R follow object-oriented rules • Repository Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 48/109

Python Program for Generation of R Tutorial: Generating DDI 4 in the Language of

Python Program for Generation of R Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 49/109

R: Item „Concept“ 343 lines of code including householding functions Tutorial: Generating DDI 4

R: Item „Concept“ 343 lines of code including householding functions Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 50/109

Generation of re. Structured. Text (re. ST) and DOT(Graphviz) • Both together are used

Generation of re. Structured. Text (re. ST) and DOT(Graphviz) • Both together are used as documentation system for DDI 4 • re. ST is part of Python's Sphinx document generation system • re. ST is related to Markdown • DOT (graph description language) usually processed by Graphviz (Graph Visualization Software) • Repository of XSLT stylesheets Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 51/109

XMI Parser in Java SDMetrics Open Core • • • Can read Canonical XMI

XMI Parser in Java SDMetrics Open Core • • • Can read Canonical XMI Free part of commercial software SDMetrics Example in SDMetrics. Open. Core/src/com/ sdmetrics/model/package. html Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 52/109

Generation of Any Syntax Representation • Part I – – Overview DDI 4 Core

Generation of Any Syntax Representation • Part I – – Overview DDI 4 Core Model-driven approach for DDI 4 • Generation of specific representations: XSD, OWL, R, re. ST, DOT • Generation of any syntax representation • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 53/109

OMG Standards • UML 2. 4. 1 (most common in tools) with documentation of

OMG Standards • UML 2. 4. 1 (most common in tools) with documentation of 2. 5. 1 (better than 2. 4*) • XMI 2. 4. 1 (most common in tools) with documentation of 2. 5. 1 (better than 2. 4*) • QVT - Meta Object Facility (MOF) 2. 0 Query, View, and Transformation specification • MOFM 2 T - MOF Model to Text Transformation Language • OCL - Object Constraint Language Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 54/109

Model to Text • MOF Model to Text Transformation Language (Mof 2 Text or

Model to Text • MOF Model to Text Transformation Language (Mof 2 Text or MOFM 2 T) is an Object Management Group (OMG) specification for a model transformation language • Specifically, it can be used to express transformations which transform a model into text (M 2 T), for example a platform-specific model into source code or documentation • MOFM 2 T is one part of OMG's Model-driven architecture (MDA) and reuses many concepts of MOF, OMG's metamodeling architecture • Whereas MOFM 2 T is used for expressing M 2 T transformations, OMG's QVT is used for expressing M 2 M transformations. From wikipedia Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 55/109

DDI 4 Factory – Possible Setup Based on OMG Standards and Eclipse Tools Model

DDI 4 Factory – Possible Setup Based on OMG Standards and Eclipse Tools Model EMF Ecore / Canonical XMI PIM Including design patterns etc. Library PSM per Representation Library Tool Method Model transformation to reduce complexity UML Tool for creation, validation, and export Eclipse Modeling Tools Papyrus (Epsilon), commercial tools OMG QVT Operational OMG MOFM 2 T Eclipse QVT Operational Eclipse Acceleo Model to Model Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice Model to Text 56/109

Eclipse Environment • Part I – – Overview DDI 4 Core Model-driven approach for

Eclipse Environment • Part I – – Overview DDI 4 Core Model-driven approach for DDI 4 • Part II – Eclipse environment • Papyrus – UML tool • QVTo – Model to model • Acceleo – Model to text – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 57/109

Eclipse IDE • Integrated development environment – Using IDE will cost you less time

Eclipse IDE • Integrated development environment – Using IDE will cost you less time and effort – Auto completion- one of the best features, you don’t have to remember all – Error debugging is easy , you can easily navigate to Error line – All files can be viewed and managed at same screen – Downloading requires packages at ease • It is free and open source • Industrial level of development • It supports many languages Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 58/109

Eclipse Tools • Papyrus – UML editor • QVTo – Implementation of the OMG

Eclipse Tools • Papyrus – UML editor • QVTo – Implementation of the OMG specification MOF Query, View, and Transformation (QVT), part Operational Mappings • Acceleo – Implementation of the OMG specification MOF to Text Template Language (Mof 2 Text) Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 59/109

Papyrus • UML editor – Creating UML class diagrams and other • Formal definition

Papyrus • UML editor – Creating UML class diagrams and other • Formal definition • Visualizing diagrams – Validation of UML definition Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 60/109

Papyrus – Model Import - 1 1. Select perspective „Papyrus“ 2. Right click on

Papyrus – Model Import - 1 1. Select perspective „Papyrus“ 2. Right click on folder „XMI“ 2. Select „Import“ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 61/109

Papyrus – Model Import - 2 1. Select „File System“ 2. Put in directory

Papyrus – Model Import - 2 1. Select „File System“ 2. Put in directory name Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 3. Select Canonical XMI file name 62/109

Papyrus – New Model - 1 Right-click on target folder „model“ Tutorial: Generating DDI

Papyrus – New Model - 1 Right-click on target folder „model“ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 63/109

Papyrus – New Model - 2 Tutorial: Generating DDI 4 in the Language of

Papyrus – New Model - 2 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 64/109

Papyrus – New Model - 3 Tutorial: Generating DDI 4 in the Language of

Papyrus – New Model - 3 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 65/109

Papyrus – New Model - 4 Tutorial: Generating DDI 4 in the Language of

Papyrus – New Model - 4 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 66/109

Papyrus After Creation of New Model Tutorial: Generating DDI 4 in the Language of

Papyrus After Creation of New Model Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 67/109

Papyrus - Import XMI into Model - 1 rt. o p m e i

Papyrus - Import XMI into Model - 1 rt. o p m e i g a k ac p ith m a n s i n co re ot e m m el w d o t sul e R. d de N Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 68/109

Papyrus - Import XMI into Model - 2 rt. o p m e i

Papyrus - Import XMI into Model - 2 rt. o p m e i g a k ac p ith m a n s i n co re ot e m m el w d o t sul e R. d de N Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 69/109

Papyrus - Import XMI into Model - 3 rt. o p m e i

Papyrus - Import XMI into Model - 3 rt. o p m e i g a k ac p ith m a n s i n co re ot e m m el w d o t sul e R. d de N Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 70/109

Papyrus - After Import of XMI rt. o p m e i g a

Papyrus - After Import of XMI rt. o p m e i g a k ac p ith m a n s i n co re ot e m m el w d o t sul e R. d de N Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 71/109

Workaround for Using Canonical XMI in Eclipse The goal is to use the Canonical

Workaround for Using Canonical XMI in Eclipse The goal is to use the Canonical XMI file in a Papyrus project. Three observed issues: • An import results in two files and the use of the XMI item „package. Import“ which is not desirable • The file extension „. uml“ seems to be preferred by Eclipse tools � Use file extension „. uml“ instead of „. xmi“ • The documented mapping for XMI interchange doesn‘t work. The issue needs further exploration. A workaround is in the next slide. • Copy whole content of edited file and paste it in „DDI 4 Core. uml“ (opened in the text editor) Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 72/109

Workaround for Mapping Namespaces 1. Change XMI and UML namespaces 2. Add package import

Workaround for Mapping Namespaces 1. Change XMI and UML namespaces 2. Add package import for UML primitives in Eclipse 3. Change URI for UML primitives Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 73/109

Papyrus – Model View Tutorial: Generating DDI 4 in the Language of your Choice

Papyrus – Model View Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 74/109

QVTo – Model to Model • Operates with UML models • Uses OCL for

QVTo – Model to Model • Operates with UML models • Uses OCL for model navigation • Main goal - model modification and transformation • Includes an example from UML to relational database Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 75/109

QVTo Example Flattening Class Hierarchies Source: Course Modelling with UML, with Semantics, Till Mossakowski,

QVTo Example Flattening Class Hierarchies Source: Course Modelling with UML, with Semantics, Till Mossakowski, slide 13 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 76/109

QVTo Resources • Wiki • Project • Videos – Introduction to QVTO on the

QVTo Resources • Wiki • Project • Videos – Introduction to QVTO on the Eclipse Modeling Tools – QVTO and Query Operations • Slides – Rubby Casallas – Radomil Dvorak – Sergey Boyko et al. Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 77/109

Acceleo – Model to Text • Embedded in Eclipse – Eclipse is an integrated

Acceleo – Model to Text • Embedded in Eclipse – Eclipse is an integrated development environment (IDE) used in computer programming • Can be used standalone • Implementation of Model to Text Transformation language (MOFM 2 T, OMG specification) • First stable release in 2006 • Kind of very high-level programming language – Powerful and small scripts – Initial learning curve • More powerful than approaches with Java, Python, XSLT – Uses the model structure – Resulting code is written in templates • Easier to develop, easier to debug Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 78/109

Acceleo - Features • • Syntax highlighting Smart completion Documentation on hover Context assistant

Acceleo - Features • • Syntax highlighting Smart completion Documentation on hover Context assistant (ctrl+space) Outline view Code folding Search references of objects (ctrl+shift+g) Dynamic error detection while editing Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 79/109

Acceleo Resources • • Website Installation instructions (from the Eclipse marketplace) Getting Started User

Acceleo Resources • • Website Installation instructions (from the Eclipse marketplace) Getting Started User Guide FAQ Best Practices In Eclipse 2019 -06 documentation References – Operations – OCL Operations • Videos – Automatic Code Generation, Shaun Lindsey (18 min) – Code generation using Acceleo, Marco Di Natale (87 min) • User forums – Eclipse community forum M 2 T (model-to-text transformation) – Stack Overflow - Questions tagged [acceleo] • • Standalone usage, Ant, Maven Query and navigate in EMF models Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 80/109

Acceleo Operations Reference Tutorial: Generating DDI 4 in the Language of your Choice -

Acceleo Operations Reference Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 81/109

Acceleo/OCL Operations Reference Tutorial: Generating DDI 4 in the Language of your Choice -

Acceleo/OCL Operations Reference Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 82/109

Acceleo – Tutorial Workspace Tutorial: Generating DDI 4 in the Language of your Choice

Acceleo – Tutorial Workspace Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 83/109

Eclipse – New Workspace – Initial View Tutorial: Generating DDI 4 in the Language

Eclipse – New Workspace – Initial View Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 84/109

Acceleo – New Project – 1 File / New / Project / Acceleo Model

Acceleo – New Project – 1 File / New / Project / Acceleo Model to Text / Acceleo Project Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 85/109

Acceleo – New Project – 2 Insert project name Tutorial: Generating DDI 4 in

Acceleo – New Project – 2 Insert project name Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 86/109

Acceleo – New Project – 3 Insert module name Insert template name Check documentation

Acceleo – New Project – 3 Insert module name Insert template name Check documentation Check generate file Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 87/109

Acceleo – Open Perspective Open Acceleo perspective Tutorial: Generating DDI 4 in the Language

Acceleo – Open Perspective Open Acceleo perspective Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 88/109

Acceleo Perspective Tutorial: Generating DDI 4 in the Language of your Choice - Model

Acceleo Perspective Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 89/109

Acceleo – Basic Template Tutorial: Generating DDI 4 in the Language of your Choice

Acceleo – Basic Template Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 90/109

MANIFEST. MF - Changes Additions for project „ddi. acceleo. tutorial“ Tutorial: Generating DDI 4

MANIFEST. MF - Changes Additions for project „ddi. acceleo. tutorial“ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 91/109

Launch Acceleo Application – 1 Tutorial: Generating DDI 4 in the Language of your

Launch Acceleo Application – 1 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 92/109

Launch Acceleo Application – 2 Tutorial: Generating DDI 4 in the Language of your

Launch Acceleo Application – 2 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 93/109

Example: List All Associations - 1 association. mtl Tutorial: Generating DDI 4 in the

Example: List All Associations - 1 association. mtl Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 94/109

Example: List All Associations - 2 association. mtl Tutorial: Generating DDI 4 in the

Example: List All Associations - 2 association. mtl Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 95/109

Example: List All Associations - XSLT Tutorial: Generating DDI 4 in the Language of

Example: List All Associations - XSLT Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 96/109

MTL Generic Outline – 1 Encoding Used namespace Template start Main template Generated text

MTL Generic Outline – 1 Encoding Used namespace Template start Main template Generated text For loop Template Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 97/109

MTL Generic Outline – 2 Tutorial: Generating DDI 4 in the Language of your

MTL Generic Outline – 2 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 98/109

MTL Generic Outline – 3 Error detection Context specific display of methods Cntrl space

MTL Generic Outline – 3 Error detection Context specific display of methods Cntrl space after „. “ Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 99/109

Polymorphism • for/if is quick but dirty • Use polymorphism instead, i. e. a

Polymorphism • for/if is quick but dirty • Use polymorphism instead, i. e. a single interface to entities of different types Source: Acceleo Best Practices from Obeo Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 100/109

Standalone Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven

Standalone Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 101/109

Build Automation: Command Line Model-to-text code Output folder Input model Tutorial: Generating DDI 4

Build Automation: Command Line Model-to-text code Output folder Input model Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 102/109

Build Automation: Ant - 1 Tutorial: Generating DDI 4 in the Language of your

Build Automation: Ant - 1 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 103/109

Build Automation: Ant - 2 Tutorial: Generating DDI 4 in the Language of your

Build Automation: Ant - 2 Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 104/109

Build Automation Maven Tutorial: Generating DDI 4 in the Language of your Choice -

Build Automation Maven Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 105/109

Exercises • Part I – Overview – DDI 4 Core – Model-driven approach for

Exercises • Part I – Overview – DDI 4 Core – Model-driven approach for DDI 4 • Part II – Eclipse environment – Exercises – Credits, community, and contact Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 106/109

Tasks • Focus on Acceleo (model to text) 1. Create a mapping table for

Tasks • Focus on Acceleo (model to text) 1. Create a mapping table for a specific language 2. Make a copy of generic. Outline. mtl in Acceleo a) Missing features: recursive call for structured data types, template for primitives 3. Add specific language fragments to templates 4. Add possibly new templates Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 107/109

Exercises – Mapping Table Tutorial: Generating DDI 4 in the Language of your Choice

Exercises – Mapping Table Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 108/109

Credits, Community, and Contact • Thanks to … – Participants of DDI 4 working

Credits, Community, and Contact • Thanks to … – Participants of DDI 4 working groups and sprints, especially to MRT group • Feed back to the community – Mature approaches of code generation based on the DDI 4 model could be published on a „marketplace“ • Joachim Wackerow – joachim. wackerow@gesis. org • Web page of the tutorial – https: //ddi-alliance. atlassian. net/wiki/x/AQC 7 Kw Tutorial: Generating DDI 4 in the Language of your Choice - Model Driven Architecture for Metadata Standards in Practice 109/109