UML Generation
Sometimes it can be helpful to see the domain model of you graph as an UML diagram. ActiveQL provides generators for
Implement diagram generation
You can call the generators and create files in your ActiveQL installation like so:
import { DomainGraphBuilder } from 'activeql-foundation';
import { DomainGraph, YUMLGenerator } from "activeql-foundation";
import fs from 'fs'
const yuml_diagram = require("yuml-diagram");
export const generateUml = (graph:DomainGraph) => {
const yumlText = new YUMLGenerator( graph ).generate();
var yuml = new yuml_diagram();
var svgLightBg = yuml.processYumlDocument(yumlText, false);
fs.writeFileSync( 'domain-graph.svg', svgLightBg );
}
(() => {
const domainConfigurationFolders = ['./runtime/domain-configuration']
const domainGraphBuilder = new DomainGraphBuilder(domainConfigurationFolders);
const domainGraph = domainGraphBuilder.getDomainGraph();
generateUml( domainGraph );
})()This example uses the yUML generator. Therefore you'd need the yuml-diagram (opens in a new tab) installed in your project.
npm i yuml-diagramFor options of image generation please check the documentation.
As you see the generateUML method expects a DomainGraph object. So you could - as here - use a DomainGraphBuilder or call the method from your activeql.ts script to generate the diagram at every server start.
The yuml-diagram package renders a SVG image that would look something like this:
