XML Metadata Interchange (XMI) for Pharo


if you work with UML, modeling tools or model data exchange often you might know XMI –
the XML Metadata Interchange format.

I wrote a little package that makes it easier to work and browse data based on this
format within Pharo.

For instance you can open an XMI object either from a given stream
or URL:

(XMIFile fromURL: ‘http://www.omg.org/spec/UML/20131001/UML.xmi’) inspect

You can also open a file

XMIFile importFile

Code is available on https://github.com/astares/Pharo-XMI

The package includes a small GT extension allowing you to walk and dive through the XMI
structure (see attached screenshot) and as the XMI nodes are unified it is easy to
code some code generators or transformers in Pharo afterwards.

For instance I used this package for a simple Pharo code generator based on Eclipse EMF models/diagrams.

Within the code you will find some examples to browse through prominent XMI models like:

– UML Spec
=> (XMIFile fromURL: ‘http://www.omg.org/spec/UML/20131001/UML.xmi’) inspect

=> (XMIFile fromURL: ‘https://raw.githubusercontent.com/staruml/XMI/master/unittest-files/VP_XMI21.xmi’) inspect

=> (XMIFile fromURL: ‘https://raw.githubusercontent.com/staruml/XMI/master/unittest-files/EA_XMI21.xmi’) inspect

=> (XMIFile fromURL: ‘https://www.reflektis.com/repos/archimate-3.0.xmi) inspect

Once the inspector opens you have to select the “rootNode” and then the “Hierarchy” tab.

In Pharo 6 you can load “XMI” right from catalog. Hope the package is useful for others too.



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: