Model Repositories (XMI, JMI, EMF)

53
Model Repositories Model Repositories (XMI, JMI, EMF) (XMI, JMI, EMF) by Luciana de Paiva Silva Luciana de Paiva Silva [email protected] www.cin.ufpe.br/~lps Disciplina : IN0980-MDA, Components and Software Reuse Professor Professor : : Jacques Robin

description

Model Repositories (XMI, JMI, EMF). by Luciana de Paiva Silva [email protected] www.cin.ufpe.br/~lps Disciplina : IN0980- MDA, Components and Software Reuse Professor : Jacques Robin. OUTLINE. Model repositories Requirements and services Model manipulation formats Programming objects - PowerPoint PPT Presentation

Transcript of Model Repositories (XMI, JMI, EMF)

Page 1: Model Repositories (XMI, JMI, EMF)

Model RepositoriesModel Repositories(XMI, JMI, EMF) (XMI, JMI, EMF)

by

Luciana de Paiva SilvaLuciana de Paiva [email protected]

www.cin.ufpe.br/~lps

Disciplina: IN0980-MDA, Components and Software Reuse ProfessorProfessor: : Jacques Robin

Page 2: Model Repositories (XMI, JMI, EMF)

2

OUTLINEOUTLINE

Model repositories Requirements and services

Model manipulation formats• Programming objects• XML document

Exemplos (ZoooMM, AM3, ReMoDD)

Existing tools• XMI • JMI• EMF

Page 3: Model Repositories (XMI, JMI, EMF)

3

What is a model repository?What is a model repository?

Ideally: combine services from project artifact management system and model base management system

Services: Persistence and fault tolerance Concurrent and authenticated access control Version control Model query Model conformity to meta-model Model creation through meta-model instantiation API to connect a variety of model manipulation tools

Graphical editors Indented embedded vertically listed items editors Transformation engines Formal verification Code generation Test generation

DiVinE

Page 4: Model Repositories (XMI, JMI, EMF)

4

Model Manipulation Formats: Programmable ObjectsModel Manipulation Formats: Programmable Objects

One programming language class for each meta-model meta-class

One programming object for each model element (i.e., meta-class instance)

Advantages: Model manipulation services can be directly programmed in

same language

To the point => succinct, concise

Paradigm alignment (object-orientation)

Disadvantages: Intermediate software needed for both persistence and human

reading

Conventional OO platform do not support meta-circularity

Page 5: Model Repositories (XMI, JMI, EMF)

5

XML Language familyXML Language family

XML: Flexible language to encode documents or data using sequences of

elements containing attribute-value pairs and delimited by opening and closing tags defining an open-ended set of categories

An XML document is well-formed conforms to XML syntax

XML Schema: XML encoded metadata language to encode XML document schemas

44 built-in data types

Specifies type, cardinality and ordering constraints on the elements and attributes of an XML document

An XML document is valid with respect to a schema if it satisfies the constraints specified in the schema

XSLT: XML encoded language to specify and apply transformation on XML

documents

Page 6: Model Repositories (XMI, JMI, EMF)

6

Model Manipulation Formats: XML DocumentModel Manipulation Formats: XML Document

One XML tag for each meta-model meta-class One XML Schema for each graph to tree ordering projection of one

MOF meta-model One XML element or attribute for each model element Thus, one XML document for each model Advantages:

Persistent and human understandable Shared meta-circularity representation principle

XML Schema is meta-level description reusing base level language (XML)

MOF2 is meta-level description reusing base level language (UML2 Infra-structure)

Disadvantages: Verbose Paradigm mismatch makes robust parsing challenging

Page 7: Model Repositories (XMI, JMI, EMF)

7

ExamplesExamples

There are several projects that have been started some time ago on model repositories: ZoooMM, AM3, ReMoDD, etc.

http://www.cs.york.ac.uk/puml/puml-list-archive/

Page 8: Model Repositories (XMI, JMI, EMF)

8

Zooomm projectZooomm project

Megazoo (zoo of megamodels):• Textual megamodels. • Megamodels in UML. • Megamodels in sciences & art.

Metazoo (zoo of metamodels):We have already a few hundreds of metamodels collected over years from more than 2000 papers in software engineering.

ZOOOMM is the International ZOO of MetaModels, Schemas, Grammars and Ontology for Software Engineering.

Metametazoo (zoo of metametamodels):

• UML, MOF, XMI, EMF, KM3, Emphatic, GXL, USE, ODMG, Xschema, GXL, RSF, TA, Telos, EXPRESS, OWL, RDFS, DAML, OIL, GXL, RSF, TA, Telos, EXPRESS, OWL, RDFS, DAML, OIL.

Page 9: Model Repositories (XMI, JMI, EMF)

9

Planet MDEPlanet MDE

Page 10: Model Repositories (XMI, JMI, EMF)

10

AM3 - ATLAS MegaModel Management AM3 - ATLAS MegaModel Management

The goal of AM3 (ATLAS MegaModel Management) is to provide a practical support for modeling in the large. The objective is to deal with global resource management in a model-engineering environment. We base this activity on the concept of a "megamodel".

Features: Management of various artifacts

Management of various relations between artifacts

Sharing and exchange of megamodel elements

User interfaces for viewing (browsing, creating, changing, etc.) megamodel elements

Page 11: Model Repositories (XMI, JMI, EMF)

11

ReMoDDReMoDD

On May 24 at ICSE, - ReMoDD (ReMoDD: A Repository for Model Driven Development)

Create a community resource of model-driven development artifacts to provide infrastructure to improve the use of model-based development.

Page 12: Model Repositories (XMI, JMI, EMF)

12

XML Metadata Interchange (XMI)XML Metadata Interchange (XMI)

XML Metadata Interchange (XMI) provê o mecanismo para implementar a distribuição de modelos entre ferramentas de diferentes empresas e entre repositórios, ou seja, intercâmbio de metadados entre ferramentas de modelagem.

Integra três padrões: XML, UML, MOF Padrão OMG para codificar modelos de documentos XML em

conformidade com o padrão MOF meta-model Permits automated generation of:

An XML schema document from a MOF meta-model and vice-versa

An XML document from a model and vice-versa

XML document generated from model is valid with respect to the XML schema document generated from the model’s meta-model

Model generated from XML document conforms to the meta-model generated from the XML schema of the XML document

Page 13: Model Repositories (XMI, JMI, EMF)

13

XMI SimplifiedXMI Simplified

XML Streams (Models) (Many - based on each metamodel DTD

XML Schema (MetaModels)

(1 per metamodel used for validation)

XMLSyntax and Encoding

MOFMetadata Definitions

& Management

XMI

UMLMetamodel

Analysis & Design

UML

UML Models UML

CWM Models UML

MOF MetaModels

Validate

Page 14: Model Repositories (XMI, JMI, EMF)

14

XMI DocumentXMI Document

Every XMI document consists: An XML version processing instruction. Example: <? XML

version=”1.0” ?> An optional encoding declaration that specifies the

character set, which follows the ISO-10646 (also called extended Unicode) standard. Example: <? XML version=”1.0” ENCODING=”UCS-2” ?>

Any other valid XML processing instructions. A schema XML element. An import XML element for the XMI namespace.

Page 15: Model Repositories (XMI, JMI, EMF)

15

Example of MOF meta-model’s serializationExample of MOF meta-model’s serializationas XML Schema using XMIas XML Schema using XMI

systemname

*0 ..*

extends

includes

useCase

title0 ..1

actorname

<xsd:schema xmlns:xsd=’http://www.w3.org/2005/XMLSchema’><xsd:complexType name = umlModel> <xsd:complexType name = actor> <xsd:sequence> <xsd:element name = “name” type = “xsd:string”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name = “useCase”> <xsd:sequence> <xsd:element name = “title” type = “xsd:string”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name = “system”> <xsd:sequence> <xsd:element name = “name” type = “xsd:string”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name = “actor2useCase” isDirected = “true” isAggregation = “false” isGeneralization = “false”> <xsd:sequence> <xsd:element from = “actor” minOccurs = “1” maxOccurs = “1”/> <xsd:element to = “useCase” minOccurs = “1” maxOccurs = “1”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name = “system2useCase” isDirected = “true” isAggregation = “true” isGeneralization = “false”> <xsd:sequence> <xsd:element name = “from” ref = “system” minOccurs = “1” maxOccurs = “1”/> <xsd:element name = “to” ref = “useCase” minOccurs = “1” maxOccurs = “unbounded”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name = “actorExtendsActor” isDirected = “true” isAggregation = “false” isGeneralization = “true”> <xsd:sequence> <xsd:element name = “from” ref = “actor” minOccurs = “1” maxOccurs = “1”/> <xsd:element name = “to” ref = “actor” minOccurs = “0” maxOccurs = “1”/> </xsd:sequence> </xsd:complexType>...</xsd:complexType>

extends

Page 16: Model Repositories (XMI, JMI, EMF)

16

XMI SpecificationXMI Specification

Page 17: Model Repositories (XMI, JMI, EMF)

17

Projeto UFPEProjeto UFPE

Page 18: Model Repositories (XMI, JMI, EMF)

18

Projeto UNIOESTEProjeto UNIOESTE

Objetivos principais Estudo de diagramas i* gerados pela ferramenta OME na

linguagem TELOS

Estudo da tecnologia XML e o padrão XMI

Estudar o padrão XMI para implementar uma ferramenta computacional que possa mapear diagramas SD e SR (i*) para Diagramas de Caso de Uso UML.

Coordenador: Victor Francisco Araya Santander

Page 19: Model Repositories (XMI, JMI, EMF)

19

Java Metadata Interface - JMIJava Metadata Interface - JMI

Enables the implementation of a dynamic, platform-independent infrastructure to manage the creation, storage, access, discovery, and substitute of metadata.

JMI is based on the Meta Object Facility (MOF) For any MOF model, JMI defines the templates for

generating the Java APIs.

Page 20: Model Repositories (XMI, JMI, EMF)

20

Application Areas Application Areas

Data warehousing and BI Integration of DW/BI tools & frameworks

Component-based development and deployment (UML) Integration of tool suites/component frameworks

Enterprise information portals Integration of disparate data sources

Systems Management Hardware/software inventory, storage management

Page 21: Model Repositories (XMI, JMI, EMF)

21

JMI Use-Cases

Data warehousing applications Different data sources, data warehouse formats, and analytical

tools Community – requires common interchange infrastructure to

provide a common programming model and a common interchange format

Page 22: Model Repositories (XMI, JMI, EMF)

22

JMI Use-Cases

The Software Development Scenario Different tool for each task Different tools for the same task JMI as a platform for integrating heterogeneous software development tools to provide a complete software development

solution Large Enterprise JavaBeans™ (EJB) application (UML tools, Integrated Development Environments (IDEs), EJB deployment

tools) EJB development solution - built around JMI using three metamodels that represent the domains of the different tasks

Each tool participate – integrated solution through an adapter that maps the tool specific APIs to the JMI APIs for the respective model.

Reduce integration complexity

Page 23: Model Repositories (XMI, JMI, EMF)

23

Java™ Metadata Interface(JMI) Specification

Page 24: Model Repositories (XMI, JMI, EMF)

24

Eclipse ProjectEclipse Project

Provide open platform for application development tools Run on a wide range of operating systems

GUI and non-GUI

Language-neutral HTML, Java, C, JSP, EJB, XML, GIF, …

Facilitate perfect tool integration At UI and deeper

Add new tools to existing installed products

Attract community of tool developers Including independent software vendors (ISVs)

Capitalize on popularity of Java for writing tools

Page 25: Model Repositories (XMI, JMI, EMF)

25

Plataforma EclipsePlataforma Eclipse

the major components, and APIs, of the Eclipse Platform

Page 26: Model Repositories (XMI, JMI, EMF)

26

Eclipse Plug-in ArchitectureEclipse Plug-in Architecture

Plug-in - smallest unit Big example: HTML editor

Small example: Action to create zip files

Extension point - named entity for collecting “contributions” Example: extension point for workbench preference UI

Extension - a contribution Example: specific HTML editor preferences

Page 27: Model Repositories (XMI, JMI, EMF)

27

Eclipse Plug-in ArchitectureEclipse Plug-in Architecture

Each plug-in Contributes to 1 or more extension points

Optionally declares new extension points

Depends on a set of other plug-ins

Contains Java code libraries and other files

Lives in its own plug-in subdirectory

Details spelled out in the plug-in manifest Manifest declares contributions

Code implements contributions and provides API

plugin.xml file in root of plug-in subdirectory

Page 28: Model Repositories (XMI, JMI, EMF)

28

Plug-in ManifestPlug-in Manifest

<plugin id = “com.example.tool" name = “Example Plug-in Tool" class = "com.example.tool.ToolPlugin"> <requires> <import plugin = "org.eclipse.core.resources"/> <import plugin = "org.eclipse.ui"/> </requires> <runtime> <library name = “tool.jar"/> </runtime> <extension point = "org.eclipse.ui.preferencepages"> <page id = "com.example.tool.preferences" icon = "icons/knob.gif" title = “Tool Knobs" class = "com.example.tool.ToolPreferenceWizard“/> </extension> <extension-point name = “Frob Providers“ id = "com.example.tool.frobProvider"/></plugin>

Declare contributionthis plug-in makes

Location of plug-in’s code

Other plug-ins needed

Plug-in identification

plugin.xml

Declare new extension point open to contributions from other plug-ins

Page 29: Model Repositories (XMI, JMI, EMF)

29

EclipseEclipse

Page 30: Model Repositories (XMI, JMI, EMF)

30

EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model.

From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.

In a nutshell: it is to exchange models into Java code

Eclipse Modeling Framework (EMF) Eclipse Modeling Framework (EMF)

Page 31: Model Repositories (XMI, JMI, EMF)

31

Page 32: Model Repositories (XMI, JMI, EMF)

32

Page 33: Model Repositories (XMI, JMI, EMF)

33

Page 34: Model Repositories (XMI, JMI, EMF)

34

Page 35: Model Repositories (XMI, JMI, EMF)

35

Page 36: Model Repositories (XMI, JMI, EMF)

36

Page 37: Model Repositories (XMI, JMI, EMF)

37

Page 38: Model Repositories (XMI, JMI, EMF)

38

Page 39: Model Repositories (XMI, JMI, EMF)

39

Here is the complete class hierarchy of the Ecore model (shaded boxes are abstract classes):

Page 40: Model Repositories (XMI, JMI, EMF)

40

Page 41: Model Repositories (XMI, JMI, EMF)

41

Page 42: Model Repositories (XMI, JMI, EMF)

42

Page 43: Model Repositories (XMI, JMI, EMF)

43

Page 44: Model Repositories (XMI, JMI, EMF)

44

Page 45: Model Repositories (XMI, JMI, EMF)

45

Page 46: Model Repositories (XMI, JMI, EMF)

46

EMF homepageEMF homepage

Page 47: Model Repositories (XMI, JMI, EMF)

47

EMF Capítulo 2EMF Capítulo 2

Page 48: Model Repositories (XMI, JMI, EMF)

48

SummarySummary

Há 20 anos atrás… estruturada, procedimentos, dados, função….

Atualmente: Avanço tecnológico – novas perspectivas

Business intelligence, onlogogies ….

Futuro: federal global model repository

web semantica

Page 49: Model Repositories (XMI, JMI, EMF)

49

References – Model RepositoriesReferences – Model Repositories

http://www.tdan.com/i013fe04.htm - The Data Administration Newsletter (TDAN.com) Robert S. Seiner - Publisher

http://www.cin.ufpe.br/~if710/slides/ModelRepositoriesTransformations.ppt http://www.cs.york.ac.uk/puml/puml-list-archive/ http://www.sciences.univ-nantes.fr/lina/atl/www/papers/eTX2006/03a-FreddyAl

lilaireRev1.pdf http://www.cs.york.ac.uk/puml/puml-list-archive/ http://zooomm.org/ http://planetmde.org/ http://www.eclipse.org/gmt/am3/ http://planetmde.org/gamma2006/ Bézivin, J, Jouault, F, and Valduriez, P : On the Need for Megamodels. In:

Proceedings of the OOPSLA/GPCE: Best Practices for Model-Driven Software Development workshop, 19th Annual ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications. 2004. Disponível em www.sciences.univ-nantes.fr/lina/atl/www/papers/OOPSLA04/bezivin-megamodel.pdf

Page 52: Model Repositories (XMI, JMI, EMF)

52

http://www.eclipse.org/emf/docs.php#presentations Eclipse EMF Help - overviews,

tutorials, API reference - EMF Project Web Site http://www.eclipse.org/emf/ -

documentation, newsgroup, mailing list, Bugzilla

Eclipse Modeling Framework by Frank Budinsky et al. Addison-Wesley; 1st edition (August

13, 2003) - ISBN: 0131425420. IBM Redbook

publication number: SG24-6302-00

References - EMFReferences - EMF

Page 53: Model Repositories (XMI, JMI, EMF)

53

ThanksThanks