Operations of a Shipping Company
Summary This example shows some simple excerpts of the specification of the business processes of a shipping company. It demonstrates how to use simple Java dialogs to interact with the user of the grammar, and how to access the underlying system resources, e.g. to obtain the current date. Furthermore, the rule Fusion is a good example for the use of conjective rules. See also the Shortest Path example for how the tour scheduling problem of a shipping company may be solved using graph transformation.
Note: Unlike the other examples, this one is not designed to be used in interpretation mode, i.e. by choosing Start from the Transform menu. Instead, you just select the rule you want to apply and use Transform->Step.
Screenshots The start graph of this example shows two shipping companies, each of them owning a truck and a storehouse:
![]()
The first rule Fusion can be used to merge the two companies into a single one, now owning all the properties of the merged companies. The rule uses a simple custom Java class MyDialog to pop up tiny dialogs, asking the user for the name of the new company.
![]()
After application of the Fusion rule, the state graph will look like this:
![]()
With the second rule LoadTruck, we can load a container from the store onto a truck when the truck is located in front of the storehouse. This rule has two additional negative application conditions (NACs) defining situations that must not occur for the rule to be applicable: First of all, the truck must not be carrying a container already, and secondly, there must not be another truck in front of the store, blocking the loading bay. The following figure shows the rule LoadTruck with the first of the two NACs, and a match into the state graph satisfying both NACs:
![]()
The last rule, named NewTruck, is used to acquire a new truck for a specified company. Using a somewhat lengthy Java method invocation, the rule obtains the current system date and puts it into the since attribute of the owns arc. Additionally, it pops up a dialog to ask for the ID of the new truck:
![]()
Revision: November 23, 1999