lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

Command line shell for navigating UML-XMI files #98

Open ronaldtse opened 2 years ago

ronaldtse commented 2 years ago

Not everyone has Enterprise Architect, or uses Windows.

While LutaML allows for fetching objects out of a UML-XMI file, it is a trial-and-error process in order to get the address right (like how XPaths are composed).

For example, I typically:

  1. Open Enterprise Architect
  2. Navigate to a diagram or class, write down where that is
  3. Then use a Metanorma file to use a LutaML line to get that address
  4. Find out whether the output exists
  5. Rinse and repeat

Which is a horrendous process.

The alternative solution is to provide a command-line shell, open an XMI file, and accept commands in navigating.

Once I find a diagram, I can write path and the path to the object is given.

$> open "my-file.xmi"
file> prop
file-type: XMI (http://www.omg.org/spec/XMI/20131001)
content-format: UML 2.0 (http://www.omg.org/spec/UML/20131001)
documentation-exporter: exporter="Enterprise Architect" exporterVersion="6.5"
file> path
/
file> list
packages (10)
diagrams (20)
file> ls packages
"CityGML"
"Construction"
...

file> open CityGML
file package:CityGML> ls objects
"AbstractConstruction"
"AbstractConstructionSurface"
"AbstractConstructiveElement"
..
file CityGML[package]> open "AbstractConstruction"
file CityGML[package]:AbstractConstruction[class]> property description
"AbstractConstructiveElement is the abstract superclass for the representation of volumetric elements of a construction. Examples are walls, beams, slabs."
file CityGML[package]:AbstractConstruction[class]> property stereotype
"FeatureType"
...

Corresponding XML:

<xmi:XMI xmlns:uml="http://www.omg.org/spec/UML/20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:umldi="http://www.omg.org/spec/UML/20131001/UMLDI" xmlns:dc="http://www.omg.org/spec/UML/20131001/UMLDC" xmlns:GML="http://www.sparxsystems.com/profiles/GML/1.0" xmlns:thecustomprofile="http://www.sparxsystems.com/profiles/thecustomprofile/1.0" xmlns:CityGML="http://www.sparxsystems.com/profiles/CityGML/1.0">
    <xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"/>
    <uml:Model xmi:type="uml:Model" name="EA_Model">
...