Giter Site home page Giter Site logo

xmi's Introduction

XMI

Build Status Coverage Status

Mapping library between XML documents and XMI serialization models based on OMG's XMI 2.5.1 specifications.

If you are looking for a library to read XMI into a UML (and vice versa), see OpenPonk/uml-xmi.

Installation

Metacello new
	baseline: 'OPXMI';
	repository: 'github://OpenPonk/xmi/repository';
	load.

Basic Usage

Reading

Reading a XML string/stream, or an url.

root := OPXMIReader readFrom: aReadStream.
root := OPXMIReader readFromUrl: 'http://www.omg.org/spec/XMI/20131001/XMI-model.xmi'.

Writing

A XMI graph can be converted back into a XML string.

inXml := (ZnEasy get: 'http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi') entity contents.
xmiGraph := OPXMIReader readFrom: inXml readStream.
outXml := OPXMIWriter writeToString: xmiGraph.

Advanced Usage

Element References

A reference element (string) in the XML is converted into a direct object reference to the target element.

HREF Resolution

XMI supports referencing other elements in the document (xmi:idref and attribute="idRef" are already handled automatically) as well as in other documents; we handle this via mapping.

AA.xmi

<container>
	<aaItem xmi:id="AAX">
		<bee href="BB.xmi#BBX" />
	</aaItem>
</container>

BB.xmi

<container>
	<bbItem xmi:id="BBX" />
</container>

NOTE: The key of the mapping has to be equal to the referenced URI.

"the order doesn't matter"
mapping := Dictionary
		with: 'AA.xmi' -> 'AA.xmi' asFileReference contents
		with: 'BB.xmi' -> 'BB.xmi' asFileReference contents
resultMapping := OPXMIReader readFromMapping: mapping.

aaItem := (resultMapping at: 'AA.xmi') containedItems first.
bbItem := (resultMapping at: 'BB.xmi') containedItems first.
self assert: aaItem containedItems second referencedElement equals: bbItem.

xmi's People

Contributors

janbliznicenko avatar peteruhnak avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hernanmd

xmi's Issues

trouble loading Power System Common Information Model exported from EnterpriseArchitect

Howdy,

I'm having trouble loading the attached XMI into OpenPlonk. It was exported from Enterprise Architect like this...
194220_orig

Any interest to help get it working? i.e. is it a good use case for you?
(if not, thats cool, just close this ticket)
[EDIT: Deleted failed upload link.]

Background info...
https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/importexport.html
https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/limitationxmi.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.