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
2
OUTLINEOUTLINE
Model repositories Requirements and services
Model manipulation formats• Programming objects• XML document
Exemplos (ZoooMM, AM3, ReMoDD)
Existing tools• 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
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
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
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
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/
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.
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
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.
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
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
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.
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
16
XMI SpecificationXMI Specification
17
Projeto UFPEProjeto UFPE
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
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.
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
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
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
23
Java™ Metadata Interface(JMI) Specification
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
25
Plataforma EclipsePlataforma Eclipse
the major components, and APIs, of the Eclipse Platform
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
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
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
29
EclipseEclipse
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)
31
32
33
34
35
36
37
38
39
Here is the complete class hierarchy of the Ecore model (shaded boxes are abstract classes):
40
41
42
43
44
45
47
EMF Capítulo 2EMF Capítulo 2
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
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
50
References – XML and XMIReferences – XML and XMI
www.omg.org/technology/documents/formal/xmi.htm www.jeckle.de/xmi.htm www.omg.org/technology/xml/ http://www.idealliance.org/proceedings/xml05/slides/b
orenstein&fox.ppt
http://homepages.inf.ed.ac.uk/perdita/XMI/
51
References - JMIReferences - JMI
http://java.sun.com/products/jmi/ http://www.cs.kent.ac.uk/events/conf/2001/eebw/slide
s/sjcSlides.pdf http://www.openmdx.org/documents/v1.1/tutorials/jmi/
htmlsingle/JMI-Binding.html#S-JMI-MAPPING-OVERVIEW
http://java.sun.com/products/jmi/pres/preso1/text0.htm
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
53
ThanksThanks