OntoUML JS
Javascript library utility for manipulating OntoUML models.
Getting Start
npm install ontouml-js --save
// yarn users
yarn add ontouml-js
Usage
This package is designed to support manipulating OntoUML models and their serialization into ontouml-schema
compliant JSON files.
import { Project, serializationUtils } from 'ontouml-js';
const project = new Project({ name: 'My Project' });
const model = project.createModel({ name: 'Model a.k.a. Root Package' });
const person = model.createKind('Person');
const school = model.createKind('School');
const date = model.createDatatype('Date');
const enrollment = model.createRelator('Enrollment');
const studiesAt = model.createMaterialRelation(person, school, 'studies at');
model.createMediationRelation(enrollment, person);
model.createMediationRelation(enrollment, school);
studiesAt.getTargetEnd().name = 'school';
studiesAt.getTargetEnd().setCardinalityToMany();
studiesAt.getSourceEnd().name = 'student';
studiesAt.getSourceEnd().cardinality = '1..*';
enrollment.createAttribute(date, 'enrollment date');
model.getAllAttributes();
model.getAllClasses();
model.getAllGeneralizations();
const projectSerialization = JSON.stringify(project);
const projectCopy = serializationUtils.parse(projectSerialization);
About
If you are interested to know more, feel free to open an issue to provide feedback on the project or reach our team members for more specific cases: