A graph in SystemWeaver is made up of nodes (points) and edges (lines). In the Graphs view, the nodes and edges are drawn into the view according to the configuration and automatic layout and routing methods. The view offers broad support in that it can be used with any type of model that has relations between SystemWeaver objects (i.e., items, parts, nodes). It also supports the creation of sequence diagrams. In this article, we describe the basics of graph configuration in SystemWeaver to get you started.

Prerequisites


Types of Graphs

The view can be used to graphically visualize any type of data model. 


Examples




Sequence Diagrams

With release R38, our configurable graph view offers a first version of a sequence diagram. Learn more about sequence diagram configuration in the application Help.



Configuring the View

A configurable graph is a Config item and is created using the config item Sandbox mode as described in Creating Config Item Views. By default, the Sandbox will include a few basic elements of a configuration to get you started, as shown below.  



Tip: A quick way to create a new graph is to copy a similar one that is already defined as described in Creating a New Config Item by Copying an Existing .


The basic building blocks of graphs are nodes A and edges B.


Example Configuration

Below is the configuration for the graph shown above.

<Graph> 
    <ForEachPart type="3EFL"> 
        <Node>
            <DefObj> 
                <ForEachPart type="3PEN"> 
                    <DefObj>
                        <Node/>
                    </DefObj>
                </ForEachPart>
            </DefObj>
        </Node>
    </ForEachPart>
    <ForEachPart type="XESX">
        <Node>
            <DefObj>
                <ForEachPart type="EXAC">
                    <DefObj>
                        <Node>
                            <Variable name="component" as="Item" select="."/>
                            <ForEachPart type="3E2F">
                                <DefObj>
                                    <Edge from="$component" to="."/>
                                </DefObj>
                            </ForEachPart>
                        </Node>
                    </DefObj>
                </ForEachPart>
            </DefObj>
        </Node>
    </ForEachPart>
</Graph>
Tip: See Finding SystemWeaver Type Identifiers (SIDs) for how to find the SIDs you will need.


Explanation of the Configuration Elements

<Graph> along with its sub-elements, defines one specific graph.


<Node/> defines a node to be included (drawn) as a box in the view A. By default, the label of the node will be the Name of the object you have selected in the structure tree.



The Node tag has three optional attributes: 

  • style can be used to apply a node style. See Defining Node and Edge Styles in Graphs.
  • caption can be used to change the label of the node.
  • group can be used to organize and layout the node within a declared node group. Refer to NodeGroup in the application Help for further details.

Nodes can be placed inside other nodes to form a hierarchy.

<Graph>
  <Node>
    <ForEachPart type="EXAC">
      <DefObj> 
        <Node/>
      </DefObj>
    </ForEachPart>
  </Node>
</Graph>


<Edge> defines one or many edges to be included (drawn) as a line between nodes in the view. Edges have a direction and are established between two items or parts. The tag has four attributes: 

  • from defines the node the edge is pointing from. 
  • to defines the node the edge is pointing to.  


  • style can be used to apply an edge style. See Defining Node and Edge Styles in Graphs.
  • caption defines the method for assigning a caption value to the edge. Two predefined variables can be used in the assignment, named "from" and "to", and the attribute values will be used for each edge created according to the <Edge> definition. The variables can be used arbitrarily in the caption attribute to define the caption rule, e.g.,:

    <Edge from="." to="/P001.OrderBy(Name)" caption="$from.Name + '' - '' + $to.Name"/>


The Edge tag can be used in three different ways:

  • Implicit "to": <Edge from="" style=""/>
    According to this method, the current node will be used as the "to" node.

  • Implicit "from": <Edge to="" style=""/>
    According to this method, the current node will be used as the "from" node.

  • Explicit "to" and "from": <Edge from="" to="" style=""/>
    According to this method, both the "to" and "from" node(s) are explicitly specified.

Optional Graph Sub-Elements

Depending on your use case, you may want to apply some of the available optional elements to your graph configuration. Below are some of them. A complete list can be found in the application Help.


Editable

The <Editable> tag, when included in the <Options> tag, specifies if a graph is editable or not as defined by its value attribute and/or definition. If editable, users can graphically design the data directly in the graph. Valid values are "true" or "false". The default value is "true". If there is at least one of the following tags added to the graph definition, the graph will provide the Edit option on the graph toolbar automatically:

  • AddPart
  • RemovePart
  • Connect node

Note: If none of the above tags are included to the graph definition, the Edit option will not show up in the view, even if Editable is set to "true". Editability can also be turned off, by setting the option to "false". 


To learn more about configuring the AddPart, RemovePart, and Connect node elements, refer to the application Help.

 

Legend

The Legend option is combined with adding legendLabel attributes to NodeStyle and EdgeStyle tags to provide a Legend pane for users. The legend can be activated to help explain the content of the graph. Refer to Legends in Configurable Graphs for more information.


ObjIcons

The <ObjIcons/> tag, when included in the <Options> tag, enables you to display the icons used in the SystemWeaver metadata in the graph nodes as described in Defining Node and Edge Styles in Graphs. 


NodeStyles

The NodeStyles tag along with its sub-elements can be used to define the styles of the nodes as described in Defining Node and Edge Styles in Graphs


EdgeStyles

The EdgeStyles tag along with its sub-elements can be used to define the styles of the nodes as described in Defining Node and Edge Styles in Graphs.


InPort and OutPort

InPorts and OutPorts are used to easily model the implicit connection concept used in SystemWeaver. In this case there is no need to define edges. The graph itself will identify the edges based on the InPort and OutPort elements. An InPort(A) is added to indicate incoming communication. An OutPort (B) is added to indicate outgoing communication.



Below is a configuration showing how to use OutPort and InPort. The connection attribute indicates what item or part is used to identify the connection. In this example, an OutPort will generate an edge to an InPort that has the same item or part as the connection object.

<Graph> 
  <ForEachPart type="XESX">
    <Node>
      <DefObj>
        <ForEachPart type="EXAC">
          <DefObj>
            <Node>            
              <ForEachPart type="ITOS">                           
                <DefObj>  
                  <OutPort connection="."/>              
                </DefObj>
              </ForEachPart>
              <ForEachPart type="ITIS">                          
                <DefObj>  
                  <InPort connection="."/>              
                </DefObj>
              </ForEachPart>         
            </Node>    
          </DefObj>
        </ForEachPart>
      </DefObj>
    </Node> 
  </ForEachPart>
</Graph>



What's Next?

You can also learn more about graph scripting options in XML Tag Reference - Graph specific in the SystemWeaver Script Language Reference Manual in the Help.