# merweb

> Generate SHACL shapes and vocabularies from Mermaid class diagrams.

Latest version **1.1.0** (published 2023-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install merweb
pnpm add merweb
yarn add merweb
bun add merweb
```

Provides the command `merweb`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-04-12 |
| First published | 2021-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 21.3 KB |
| Known vulnerabilities | 0 (+9 in 1 direct dependencies) |
| Install scripts | no |
| Author | Pieter Heyvaert |
| Maintainers | rubenverborgh, pheyvaer, bjdmeest |
| Keywords | mermaid, shape, shacl, vocabulary, ontology |

## Links

- npm: https://www.npmjs.com/package/merweb
- npm.io page: https://npm.io/package/merweb

## Dependencies (3)

- [mermaid](https://npm.io/package/mermaid.md) 8.13.3
- [commander](https://npm.io/package/commander.md) ^8.3.0
- [line-reader](https://npm.io/package/line-reader.md) ^0.4.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-04-12
- 1.0.3 — 2023-03-08
- 1.0.2 — 2021-11-03
- 1.0.1 — 2021-11-03
- 1.0.0 — 2021-10-28

## README

# 🕸 Merweb

Merweb (Mermaid meets Semantic Web) is library and command line interface to 
generate SHACL shapes and vocabularies from [Mermaid class diagrams](https://mermaid-js.github.io/mermaid/#/classDiagram).

## Usage

- Install via `npm i -g merweb`.
- Execute tool via `merweb -f path/to/diagram -s path/to/jsonld`.
You can try
```bash
merweb -f examples/diagram.txt \
  -s shapes.jsonld \
  -b "sc=https://w3id.org/idlab/ns/supply-chain/#" \
  -v "sc=https://w3id.org/idlab/ns/supply-chain/#" \
  -p "swrl=http://www.w3.org/2003/11/swrl#;owl=http://www.w3.org/2002/07/owl#" \
  -c vocab.jsonld
```
or
```bash
merweb -f examples/diagram_with_supertypes.txt \
  -s shapes.jsonld \
  -b "ex=https://example.org/examples#" \
  -v "ex=https://example.org/examples#" \
  -p "swrl=http://www.w3.org/2003/11/swrl#;owl=http://www.w3.org/2002/07/owl#" \
  -c vocab.jsonld
```

## Examples

You can find example diagrams in the folder `examples`.

## Annotations

Memweb reuses one existing Mermaid annotation and 
uses five new annotations to generate the correct shapes and vocabularies 
from the class diagrams.
Below you can find a table of these annotations.

| Annotation | Description | Shape | Vocabulary | Existing or new annotation |
| ---------- | ----------- | ----- | ---------- | --------------- |
| `@type` | The type of a class | Object of `sh:targetNode` | A `rdfs:Class` | New |
| `@superTypes` | The super-types of a class | N/A | Object(s) of `rdfs:subClassOf` | New |
| `@extraTypes` | The extra types of a class | Object of `sh:property` with `rdf:type` as `sh:path` | A `rdfs:Class` | New |
| `@label` | The label of a class or property | N/A | Object of `rdfs:label` | New  |
| `@comment` | The comment of a class or property | N/A | Object of `rdfs:comment` | New |
| Cardinality on a class attribute| The cardinality of datatype property | Objects of `sh:minCount` and `sh:maxCount` | N/A | New |
| [Cardinality on a relationship between two classes](https://mermaid-js.github.io/mermaid/#/classDiagram?id=cardinality-multiplicity-on-relations) | The cardinality of object property | Objects of `sh:minCount` and `sh:maxCount` | N/A | Existing |

Please note that the annotations `@type`, `@superTypes`, and `@extraTypes` assume a strict ordering: 
`@type` should always be declared before `@superTypes` and `@extraTypes` are declared. The internal ordering of the latter two can be arbitrary.


## Remove annotations from diagrams

You can remove the annotations starting with `@` from diagrams via the `-r, --remove-annotations` option.
The changed diagram is outputted to the terminal.

```bash
merweb -f examples/diagram.txt -r
```

## License

This code is copyrighted by [Ghent University – imec](http://idlab.ugent.be/) and 
released under the [MIT license](http://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/merweb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
