Demo for the Executable (computational) graphs & diagrams medium article.
This demo shows two approaches to creating executable software starting from arbitrary Drawio diagrams which may not follow any notation. The software traces back to the diagram(s) and modifications in the diagrams change how software executes.
The demo uses For this demo a parse-tree.drawio
diagram is located in the compute module/folder.
The demonstrated approaches may be applied when there is a body of pre-existing diagrams, or when diagram authors (subject matter experts) are not proficient with diagramming notations. In general, a diagram created by a child might be used to create executable programs.
With this approach processors are created for Drawio diagram elements, which are graph elements.
- ComputeGraphTests
testDrawioSyncComputeGraph
shows how to create graph processors and perform computations using ReflectiveProcessorFactoryProvider testDrawioCapabilitySyncComputeGraph
does the same, but using CapabilityProcessorFactory- Processors and factories can be found in org.nasdanika.demos.graph.compute.computers.diagram.sync package
This approach uses mapping of a diagram to a semantic model and then providing executability for the semantic model.
You may use an existing model, e.g. one of Nasdanika models, or create a new model. A new model may extend existing models.
In this demo the metamodel is located in the model module.
Create metamodel documentation processors. Metamodel documentation processors can be found in the processors/src/main/java/org/nasdanika/demos/graph/compute/processors/ecore package. They are registered as services in the processor's module module-info.java.
Generate metamodel documentation1. In this demo documentation is generated with a JUnit test - TestComputeModelDocGen.java.
Use diagram element properties to map them to metamodel classes to create a model. The mapping process is explained in the Beyond Diagrams book.
You may create documentation processors and generate documentation from the loaded model. In this demo documentation processors are located in processors/src/main/java/org/nasdanika/demos/graph/compute/processors/doc package. The are incomplete.
You may find complete functional processors in https://github.com/Nasdanika-Models/family/tree/main/processors/src/main/java/org/nasdanika/models/family/processors/doc.
With documentation generation you may associate detailed information with diagram elements.
Follow examples and reference documentation to create compute processors.
To perform computations follow testModelSyncComputeGraph
method in ComputeGraphTests.
Currently in this demo there is one set of model processors to perform computations synchronously. You may have multiple flavors of processors. For example:
- Synchronous computations
- Asynchronous computations (CompletionStage)
- Reactive computations
- Code generation - text or, say, Java model
Please note that you don't need to create documentation processors and generate documentation in order to create compute processors.
Footnotes
-
Currently the metamodel documentation is incomplete - it was copied from the familiy metamodel. ↩