Coder Social home page Coder Social logo

merweb's Introduction

๐Ÿ•ธ Merweb

Merweb (Mermaid meets Semantic Web) is library and command line interface to generate SHACL shapes and vocabularies from Mermaid class diagrams.

Usage

  • Install via npm i -g merweb.
  • Execute tool via merweb -f path/to/diagram -s path/to/jsonld. You can try
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

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 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.

merweb -f examples/diagram.txt -r

License

This code is copyrighted by Ghent University โ€“ imec and released under the MIT license.

merweb's People

Contributors

pheyvaer avatar mweyns avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.