npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

shumlex

v0.6.5

Published

ShEx - Uml integration

Downloads

14

Readme

Shumlex

Version Status NPM Status

Introduction

Welcome to Shumlex.

Its purpose is to develop a tool which allows an integration between both Shape Expressions and UML, enabling the user to create an UML equivalent to the desired set of Shape Expressions, as well as the opposite. Moreover, it seeks to ease such tasks by contributing some complementary features which allow a integrated display of the data.

Shumlex is available as a NPM Package as well as a GitHub Package.

A creation by Mr. Jorge Álvarez Fidalgo for WESO Group.

Installation

NPM

Install the latest version.

npm install shumlex

GPK

You must log in to Github Packages or create a .npmrc file with the authentication info to install it. (See link)

Install the latest version.

npm install @weso/[email protected]

Test

You may run the available tests in the installed module:

npm test

Both ShEx-XMI and XMI-ShEX conversions are tested, including all of the proposed examples in the application, as well as a few addons. Graph generation is tested as well.

How to use

Once installed, import the package. For instance:

const shumlex = require('shumlex')

Shumlex provides four different methods, which are shown below.

ShEx To XMI: shExToXMI(shexValue)

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.

XMI To ShEx: XMIToShEx(xmiValue)

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.

XMI to SVG Class Diagram: crearDiagramaUML(containerId, xmiValue, options)

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
}

Downloading SVG: base64SVG(svgId)

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`);

Importing and exporting our XMI in Visual Paradigm

Import

There are no further complications beyond clicking "Import XMI" and choosing our file with the Shumlex generated XMI, with the default options.

Import

The UML elements corresponding to our imported XMI will be available at the Model Explorer. They will be automatically located by dropping them on a class diagram.

Load VP

Export

When clicking "Export XMI", select the following options so that it exports in a Shumlex compatible format.

Export