Part 2 – Build the Manufacturing Process notation

In this second part of the tutorial we will build a new visual notation for manufacturing processes. These will take the form of worksheets with work items. With this second example of visual notation, we will explore new visual constructs and build more complex rules.

Step 1: In the environment/workbenches directory, create the Process.view file and open it with your text editor.

Step 2: Type in or copy the following:

view "Manufacturing Process" {
  rules => Process {
  }
  toolboxes {
    toolbox "Elements" {
    }
  }
}

Step 3: Type in or copy the following rule that will be used as the grammar’s axiom:

Process -> {
  {
    <"Manufacturing Process" 600*50>
    [[] 600*50 |#D7D7D7|#000000:1]
  }:stack
  {
    Worksheet* :fill left
    [[] 600*100< |#D7D7D7|#000000:1]
  }:fill stack
}:fill left ;

With this rule we define a notational element called Process. The rule is built using 3 terminals and a variable we will define later. The first terminal is a label containing the text “Manufacturing Process”. This text will simply be displayed. The size of the label is given the same way as rectangles. The second terminal is rectangle of the same size as the label. It is defined with a grey background color (#D7D7D7), a black border (#000000) and border thickness of 1. The last terminal is also a rectangle. The default size of this one is defined as 600*100. However, using the “<” symbol, we define that it can grow to fill its container. In this rule we also refer to the Worksheet notational element. Using the “*” operator, we specify it can appear at this place zero or more times. When multiple Worksheet elements are present, we define their geographical composition with the “left” keyword. It means the elements will be vertically aligned on their left border. The “fill” keyword means that the repetition operator itself will take as much place as possible.

In order to further compose these elements, the two first terminals are concatenated with the “stack” alignment specifier. It means the element will appear on top of each other. The first element in the concatenation is at the top so that in our case the label will appear on top of the grey rectangle.

In the same way, the repetition operator and the other grey rectangle are stacked. In this concatenation, the “fill” keyword is used to specify the concatenation can grow and will take place as much place as possible.

Finally, two concatenations are themselves placed into another concatenation that serves as the root of the rule. This rule demonstrates that operators can contain simple elements like terminals but also other operators.

Step 4: Type in or copy the following rule defining the Worksheet element:

Worksheet -> {
  {
    {
      [[] 30*30]
      <"Worksheet" 75*20>
      <s "ID" 50*20>
      <s "Name" 85*20>
      [[] 310*30]
    }:horizontal
    {
      [<0,30,30,0,240,0,270,30> |#FFFFFF|#000000:1]
      [[] 280*30]
    }:top
  }:stack
  {     Step*^ :fill left
    [[] 550*70< |#FFFFFF|#000000:1]
  }:fill stack
}:fill left ;

This rule is a bit more complex that the previous one. This rule can be split into two main parts. The first one define a head of some sort for the worksheet, while the second part is a place where other notational elements called Step will be added by the user.

A new kind of terminal defining a polygon is introduced in this rule:

[<0,30,30,0,240,0,270,30> |#FFFFFF|#000000:1]

Polygons are specified by the list of their vertices given between the “<” and “>” symbols. The coloring mechanism is identical to the one for other shapes.

In this rule we also use a special symbol along the repetition operator:

Step*^ :fill left

Using the “^” means that the order of the inner Step elements is important. When the user is adding new Step elements, he/she will be able to visually select where to insert it. This is useful in this situation because from a visual perspective, the order of the Step element is significant. The top one is the first and the bottom one the last.

Step 5: Type in or copy the following rule defining the Step element:

Step -> {
  {
    {
      <"Step" 48*20>
      [[] 50*30]
    }:stack
    {
      <s "ID" 48*20>
      [[] 50*30 ||#000000:1]
    }:stack
    {
      <s "Description" 398*20>
      [[] 400*30]
    }:stack
  }:horizontal
  [[] 500*30 |#FFFFFF|#000000:1]
}:stack ;

Step 6: Now we need to complete the notation by defining the toolboxes:

toolboxes {
  toolbox "Elements" {
    element Worksheet "Worksheet"
    element Step "Step"
  }
}

Step 7: We will now compile our two visual notations so that they for a coherent workbench. Execute the following command line:

> XOWLGMICompiler tutorial Layout.view Process.view

Step 8: Modify the environment/config.ini file to add the following lines adding our new visual notation to the workbench:

tutorial.view = process
process.name = Manufacturing Process
process.view = workbenches/Process.view.owl
process.cm = workbenches/Process.transform.cm.owl
process.mv = workbenches/Process.transform.mv.owl
process.vv = workbenches/Process.transform.vv.owl

Step 9: Test in the environment.

Last edited May 11, 2012 at 9:06 AM by lwouters, version 1

Comments

No comments yet.