This article contains elementary global functions in a table. The table below indicates the syntax of the function in the first column and a short explanation of it in the second column. For an introduction to the notation syntax please have a look at this article.

Global functions can be used in rules, sequences, functions and procedures on any ruleset in Soley Studio.

**Table of elementary global functions**

Syntax | Description |
---|---|

nodes([NodeClass]):set<NodeClass> | Looks for all nodes of class NodeClass and returns a set of nodes of this type |

edges([EdgeClass]):set<EdgeClass> | Looks for all edges of type EdgeClass and returns a set of edges of this type |

source(Edge):Node | Looks for the source node of the edge "Edge" and returns the node |

target(Edge):Node | Looks for the target node of the edge "Edge" and returns the node |

opposite(Edge,Node):Node | Looks for an edge “Edge” connected to a node “Node” and returns the node on the opposite end of the edge, whether it be source or target |

inducedSubgraph(set<Node>):graph | Creates a subgraph from a set of nodes. The subgraph contains all edges between these nodes. |

definedSubgraph(set<Edge>):graph | Sets a subgraph from a set of edges. The subgraph contains all nodes between these edges. |

equalsAny(graph, set<graph>):boolean | Returns a boolean true when a subgraph (first argument) equals any of the subgraphs in the set of subgraphs (second argument). Else it returns false. |

equalsAnyStructurally (graph,set<graph>):boolean | Returns a boolean true when a subgraph (first argument) equals any of the subgraphs in the set of subgraphs (second argument) structurally. Else it returns false. Structural equality means only the graph structure and element classes are compared but not the attribute values. |

copy(graph):graph | Returns a copy of the subgraph given as input argument. |

copy(container):container | Returns a copy of the container given as input argument, e.g. a set |

copy(match<r>):match<r> | Returns a copy of the match |

random():double | Returns a random double value between 0.0 and 1.0 |

random(int):int | Returns a random int value |

nameof(Node/Edge/graph):string | Returns the name of a node, edge or graph as a string |

uniqueof(Node/Edge/graph):int | Returns the unique id of a node, edge or graph as an integer. Make sure you add the line "node edge unique;" to your metamodel. This will add unique IDs to your graph elements. |

nodeByName(string):Node | Returns a node identified by its name as input string |

edgeByName(string):Edge | Returns an edge identified by its name as input string |

nodeByUnique(int):Node | Returns a node identified by its unique ID as input integer. |

edgeByUnique(int):Edge | Returns an edge identified by its unique ID as input integer. |

countNodes([NodeClass]):int | Returns the number of nodes of class NodeClass as an integer |

countEdges([EdgeClass]):int | Returns the number of edges of class EdgeClass as an integer |

File::import(string):graph | Imports a (graph) file defined by the filepath given as inout string and returns it as a subgraph |

File::exists(string):boolean | Returns a boolean value true when a file with the filepath given as input string exists. Else returns boolean false. |

Time::now():long | Returns the current time in DateTime format as long value. |

If you couldn’t find the right function for your needs, have a look at the other articles in this article.