Hi,

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

 - VISUAL PARADIGM
   => (XMIFile fromURL: 
'https://raw.githubusercontent.com/staruml/XMI/master/unittest-files/VP_XMI21.xmi')
 inspect
 
 - ENTERPRISE ARCHITECT
   => (XMIFile fromURL: 
'https://raw.githubusercontent.com/staruml/XMI/master/unittest-files/EA_XMI21.xmi')
 inspect
 
 - ARCHIMATE
   => (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.

Bye
T.

Reply via email to