Library Element Graph_mergeNodesOfClassByAttribute

This article familiarizes the user with the library element “Graph_mergeNodesOfClassByAttribute”  which could be used in a sequence. This library element can be found in the Libraries pad of Soley Studio under the category Graph -> Merge Elements. 

When to use

If you have a graph with different nodes of the same class or nodes that have the same superclass and let’s say that some of these nodes have the same value of an attribute. If you  want to merge these nodes, based on this particular attribute, then you can use this library element in a sequence. The nodes will then be merged and will all have a unique value of this attribute.

Syntax

Graph_mergeNodesOfClassByAttribute(NODE_CLASS,ISEXACT,ATTRIBUTE_NAME)

Input Parameters

NODE_CLASS:nodetype – class of nodes the merge will be performed on.
ISEXACT:boolean – subclasses will be disregarded if switch is set to ‘true’.
ATTRIBUTE_NAME:string – name of attribute whose value shall trigger a merge operation.

Returns

NONE

Example

sequence Graph_mergeNodesOfClassByAttribute_demo{ 
 {Graph_mergeNodesOfClassByAttribute(Component,false,"componentID")}
}

Imagine for this example that a node class Component is declared in the metamodel possessing an identifying attribute componentID. Extended from Component were two more subclasses MechanicalComponent and ElectricalComponent not shown here but included since ISEXACT is set to ‘false’. The purpose of this modelling approach could be the import of mechanical and electrical relations from two disparate data sources into the same graph. After the creation of the respective edges execution of Graph_mergeNodesOfClassByAttribute() would bring the specialized and initially disconnected graphs together. In the end the process would yield a unified hierarchy with each component occurring only once furnished with its mechanical and electrical relations. Pay attention to always declare the merge indicating attribute at the superclass.

 

Was this article helpful?

Related Articles