ShEx - Uml integration
npm install shumlex
const shumlex = require('shumlex')
`
Shumlex provides four different methods, which are shown below.
$3
This method provides a XMI value (as a String) equivalent to any given ShEx value (as a String parameter).
`
let xmi = shumlex.shExToXMI(shex)
`
In this example, we are passing as a parameter a String variable (_shex_) which contains a ShEx-compliant value and we save the XMI in a String variable named _xmi_.
$3
This method provides a ShEx value (as a String) equivalent to any given XMI value (as a String parameter).
`
let shex = shumlex.XMIToShEx(xmi)
`
In this example, we are passing as a parameter a String variable (_xmi_) which contains a XMI schema and we save the ShEx in a String variable named _shex_.
$3
This method creates in the given container, using SVG, a UML Class Diagram corresponding to the XMI value passed as a String parameter.
`
shumlex.crearDiagramaUML("displaydiv", xmi)
`
In this example, we are passing as parameters two variables:
* The ID of the container element in our page where we want to display the SVG, as a String value.
* A String variable (_xmi_) which contains the XMI input value.
If an element with such ID exists, and the XMI is correct, the corresponding SVG will be displayed at the given container.
_options_ is an optional parameter, with JSON format, which may be used to configurate the SVG.
`
{
max_height: "500px", // Max Height of the SVG
max_width: "100vw" // Max Width of the SVG
}
`
$3
Returns the encoded base64 value for the given SVG located in the document ID passed as parameter. This allows for an easy implementation of a download link, just like the following:
`
let svg64 = shumlex.base64SVG("svg");
$("#download_button").attr("href", svg64);
$("#download_button").attr("download", shumlex-class-diagram.svg);
``