https://github.com/bptlab/pnml-moddle-converter

https://github.com/bptlab/pnml-moddle-converter

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: bptlab
  • License: mit
  • Language: TypeScript
  • Default Branch: main
  • Size: 111 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

PNML-Moddle.js Converter

This module provides a parser and serializer for .pnml files and Moddle.js XML files specifying place transition nets. In addition, a converter has been implemented to transform each of the representations into another.

Installation

Use the following command to add this package as a dependency to your node project.

bash npm i --save pnml-moddle-converter

Usage

Format Conversion

The package can be used as follows (the example can be found in dev.ts):

```typescript import { parseModdleXml, parsePnmlXml, convertModdleToPnml, convertPnmlToModdle, convertModdleXmlToPnmlXml, convertPnmlXmlToModdleXml, } from "pnml-moddle-converter";

const moddleXml = '<?xml version="1.0" encoding="UTF-8"?>...'; const pnmlXml = '<?xml version="1.0" encoding="UTF-8"?>...';

// Parse a XML file including a Moddle.js place transition net specification const moddleDefinitions = parseModdleXml(moddleXml); // Serialize a ModdleDefinitions object into a string const moddleXml2 = moddleDefinitions.serialize(); // Convert a ModdleDefinitions object into a PnmlDocument object const pnmlDocumentFromModdle = convertModdleToPnml(moddleDefinitions); // Directly convert a Moddle XML to a PNML const pnmlXmlFromModdleXml = convertModdleXmlToPnmlXml(moddleXml);

// Parse a PNML file specifying a place transition net const pnmlDocument = parsePnmlXml(pnmlXml); // Serialize a PnmlDocument object into a string const pnmlXml2 = pnmlDocument.serialize(); // Convert a PnmlDocument object into a ModdleDefinitions object const moddleDefinitionsFromPnml = convertPnmlToModdle(pnmlDocument); // Directly convert a PNML to a Moddle XML const moddleXmlFromPnmlXml = convertPnmlXmlToModdleXml(pnmlXml); ```

Model Creation

The library can also be used to create models that can be serialized to the corresponding format.

Moddle

Example

```typescript const places: ModdlePlace[] = [ new ModdlePlace({ id: 'place1', name: 'p1', marking: 2 }), new ModdlePlace({ id: 'place2', name: 'p2', marking: 0 }), ]; const transitions: ModdleTransition[] = [ new ModdleTransition({ id: 'transition1', name: 't1' }), ]; const arcs: ModdleArc[] = [ new ModdleArc({ id: 'arc1', source: 'place1', target: 'transition1', weight: 2}), new ModdleArc({ id: 'arc2', source: 'transition1', target: 'place2', weight: 1}), ];

const moddle = new ModdleDefinitions({ ptNet: new ModdlePTNet({ id: 'ptnetid1', name: 'ptnetname1', places, transitions, arcs }) });

moddle.serialize(); ```

PNML

Example

```typescript const places: PnmlPlace[] = [ new PnmlPlace({id: "place1", label: "p1", initialMarking: 2}), new PnmlPlace({id: "place2", label: "p2", initialMarking: 0}), ]; const transitions: PnmlTransition[] = [ new PnmlTransition({id: "transition1", label: "t1"}), ]; const arcs: PnmlArc[] = [ new PnmlArc({id: "arc1", source: "place1", target: "transition1", weight: 2}), new PnmlArc({id: "arc2", source: "transition1", target: "place2", weight: 1}), ];

const pnml = new PnmlDocument({ nets: [ new PnmlNet({ id: "net1", name: "net1", type: "http://www.pnml.org/version-2009/grammar/ptnet", pages: [ new PnmlPage({ id: "page_1", places, transitions, arcs, }) ] }) ] });

pnml.serialize(); ```

Development

Feel free to contribute to the repository https://github.com/bptlab/pnml-moddle-converter.

You can use the file dev.ts as a sandbox to develop new features. Use the following command to execute the file:

npm run dev

Owner

  • Name: Business Process Technology
  • Login: bptlab
  • Kind: organization
  • Location: Potsdam, Germany

Business Process Technology @ Hasso Plattner Institute, University of Potsdam

GitHub Events

Total
  • Delete event: 1
  • Push event: 2
  • Create event: 1
Last Year
  • Delete event: 1
  • Push event: 2
  • Create event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 14
  • Total Committers: 1
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Tom Lichtenstein l****t@w****e 14

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 258 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 13
  • Total maintainers: 1
npmjs.org: pnml-moddle-converter

The pnml-moddle-converter is a TypeScript library that provides functionality for converting between PNML (Petri Net Markup Language) and Moddle XML formats. It includes classes for representing different elements of a Petri net, such as places, transitio

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 258 Last month
Rankings
Dependent repos count: 32.2%
Average: 39.1%
Dependent packages count: 46.1%
Maintainers (1)
Last synced: 11 months ago

Dependencies

package-lock.json npm
  • @isaacs/cliui 8.0.2 development
  • @pkgjs/parseargs 0.11.0 development
  • @types/node 20.11.30 development
  • ansi-regex 5.0.1 development
  • ansi-regex 6.0.1 development
  • ansi-styles 6.2.1 development
  • ansi-styles 4.3.0 development
  • balanced-match 1.0.2 development
  • brace-expansion 2.0.1 development
  • color-convert 2.0.1 development
  • color-name 1.1.4 development
  • cross-spawn 7.0.3 development
  • eastasianwidth 0.2.0 development
  • emoji-regex 8.0.0 development
  • emoji-regex 9.2.2 development
  • foreground-child 3.1.1 development
  • glob 10.3.10 development
  • is-fullwidth-code-point 3.0.0 development
  • isexe 2.0.0 development
  • jackspeak 2.3.6 development
  • lru-cache 10.2.0 development
  • minimatch 9.0.3 development
  • minipass 7.0.4 development
  • path-key 3.1.1 development
  • path-scurry 1.10.1 development
  • rimraf 5.0.5 development
  • shebang-command 2.0.0 development
  • shebang-regex 3.0.0 development
  • signal-exit 4.1.0 development
  • string-width 4.2.3 development
  • string-width 5.1.2 development
  • string-width-cjs 4.2.3 development
  • strip-ansi 7.1.0 development
  • strip-ansi 6.0.1 development
  • strip-ansi-cjs 6.0.1 development
  • undici-types 5.26.5 development
  • which 2.0.2 development
  • wrap-ansi 8.1.0 development
  • wrap-ansi-cjs 7.0.0 development
  • @oozcitak/dom 1.15.10
  • @oozcitak/infra 1.0.8
  • @oozcitak/url 1.0.4
  • @oozcitak/util 8.3.8
  • argparse 1.0.10
  • esprima 4.0.1
  • js-yaml 3.14.1
  • sprintf-js 1.0.3
  • xmlbuilder2 3.1.1
package.json npm
  • @types/node ^20.11.30 development
  • rimraf ^5.0.5 development
  • xmlbuilder2 ^3.1.1