Metamodel Packages to Group Classes

Metamodel packages

With Soley Studio, it is possible to create metamodel packages.  This allows you to group node and/or edge classes. It is also possible to define nested packages where child packages inherit from their parent package(s).

Create a package of metamodel classes

The definition of the named package takes place in the Metamodel-Data (.gm Data). The following example shows how to define a package named FOOMeta that contains a Node class N1 and an Edge class E1. The package is then extended with the classes (Node class N2 and Edge class E2) and finally how to create a sub-package named Nested with a new Node class NN1.

package FOOMeta{
  node class N1 extends IdentifiableNode;
  edge class E1 extends IdentifiableDirectedEdge;
}

package FOOMeta{
  node class N2;
  edge class E2;
}

package FOOMeta::Nested{
  node class NN1;
}

In order to use the classes defined in packages, e.g. in rules, you can simply call them by the full class name in the form PackageName::ClassName, as shown in the following:

rule deleteN1Nodes{
  n:FOOMeta::N1;
  modify{
    delete(n);
  }
}

Create a package of methods

In addition to packing metamodel classes, methods like rules, procedures, functions, and sequences can also be packed, as shown in the following example:

package FOO{
 rule r1 {
   x:FOOMeta::N -e:FOOMeta::E-> x;
   modify {
     delete(e);
   }
 }
}

package FOO{
 rule r2 {
   x:FOOMeta::Nested::NN1 -e:FOOMeta::E2-> x;
   modify {
     delete(e);
   }
 }
}

Was this article helpful?

Related Articles