Bundt Scripting Reference
·
Bundt Scripting Language version 1.0.1.0
Overview
Scripting means programming-in-the-small. In other words, a script is a small program that you can write and then run.
If you don't have it already, you can download the Bundt Toolset and installation instructions from the downloads web page .
What is scripting?
When you run a script, the code that you write does things in Bundt, such as creating or altering models or model elements.
Scripting is a very fast and powerful approach to manipulating models and their contents.
Of course, you can use the ModelDesigner to attain the same goals, but scripting allows you to do things faster and more systematically.
For example, you can write a script that adds some classes to a type model, and then run it against multiple models, guaranteeing that you do exactly the same thing to all of them.
If you have no previous experience in programming or scripting, you will need to get acquainted with some basic concepts.
Once you are familiar with them, you will be able to write scripts and run then against the bundt scripting engine either interactively, through the ModelDesigner, or even programmatically .
Sample scripts
This is a small sample script:
create type model Test version '1.0.0.0';
create class Building;
In this example there are two statements, one per line: a create type model statement and a create class statement.
It creates a new type model named Test with version number 1.0.0.0, and then adds a new class named Building to it.
This is a slightly larger sample script:
with model Test;
create class GroupOfPeople (A);
create class Organization;
create generalization root GroupOfPeople
on GroupingPhenomenon
into Organization;
alter class GroupOfPeople as
definition "Identity agent corresponding to multiple individuals.";
alter class Organization as
definition "Group of people who share a common corporate identity."
comments "Organizations are usually formed through explicit and intentional mechanisms.";
In this example there are many statements.
Some of the longer ones have been split across multiple lines so that they are more readable.
Note that a semicolon ";" character marks the end of each statement.
In this second example, we select the Test model to work with, and then add two classes, GroupOfPeople and Organization, and link them together via a generalization.
Finally, we add some definition and comments text to the classes.
Approaches to scripting
You can script in Bundt in two different ways:
- Interactively through the ModelDesigner , by opening a scripting session window and typing code in it.
- Programmatically through the Scripting library, by writing a program that invokes the appropriate classes and methods to run scripts.
If you are a Bundt user, you will probably use an interactive approach.
If you are a programmer interested in developing your own software on top of Bundt, then you may be interested in the programmatic approach.
Generating scripts
Bundt is capable of automatically generating scripts to re-create a model or parts of a model.
You can use generated scripts to check out what scripts look like, and then try to modify them to adapt them to your needs.
You can try the automatic script generation on the ModelDesigner through the Scripting menu.
Contents distributed under a Creative Commons Attribution 4.0 International License
·
About
·
Terms of Use
·
Contact Us
·
last updated on 08 October 2020