530 likes | 685 Views
Model Repositories (XMI, JMI, EMF). by Luciana de Paiva Silva lps@cin.ufpe.br 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
E N D
Model Repositories(XMI, JMI, EMF) by Luciana de Paiva Silva lps@cin.ufpe.br 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 • XML document • Exemplos (ZoooMM, AM3, ReMoDD) • Existing tools • XMI • JMI • EMF
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
Model 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
XML 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-formedconforms 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
Model 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
Examples • 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/
Zooomm project ZOOOMM is the International ZOO of MetaModels, Schemas, Grammars and Ontology for Software Engineering. • Megazoo (zoo of megamodels): • Textual megamodels. • Megamodels in UML. • Megamodels in sciences & art. • 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. Metazoo (zoo of metamodels): We have already a few hundreds of metamodels collected over years from more than 2000 papers in software engineering.
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
ReMoDD • 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.
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
UML Models CWM Models MOF MetaModels UML UML UML XMI Simplified XML Streams (Models) (Many - based on each metamodel DTD XML Syntax and Encoding X MI MOF Metadata Definitions & Management Validate XML Schema (MetaModels) (1 per metamodel used for validation) UML Metamodel Analysis & Design
XMI 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.
useCase title system name * actor name 0 ..1 Example of MOF meta-model’s serializationas XML Schema using XMI extends <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 0 ..* includes
Projeto 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
Java 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.
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
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
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
Eclipse 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
Plataforma Eclipse the major components, and APIs, of the Eclipse Platform
Eclipse 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
Eclipse 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
Plug-in identification Other plug-ins needed Location of plug-in’s code Declare contributionthis plug-in makes Declare new extension point open to contributions from other plug-ins Plug-in Manifest plugin.xml <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>
Eclipse Modeling Framework (EMF) • 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
Here is the complete class hierarchy of the Ecore model (shaded boxes are abstract classes):
Summary • 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
References – 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-FreddyAllilaireRev1.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
References – 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/borenstein&fox.ppt • http://homepages.inf.ed.ac.uk/perdita/XMI/