In all connection expressions, you can refer directly to the object (if appropriate), to a port name on the object (
the portname), or to a direction (an input to, an input of, an output of) of the connection. Expressions do not exist for referencing a connection as an item upon a workspace such as:
if there exists a connection upon workspace-name
the count of each connection upon workspace-name
false, since connections cannot exist as autonomous items upon a workspace.
the, any, or every junction-block (or a subclass of JUNCTION-BLOCK) connected to an object or connection within the expression.
the class-name [local-name] connected to item
->item
the quantifier, this generic reference expression produces the one and only item of the specified class that is connected in any way to the specified item. With the any quantifier, this expression produces the set of items of the specified class that are connected in any way to the specified item.
To refer to items connected to other items:
![]() |
Referring to Input or Output Stubs
Whenever stubs are defined with a direction (input, output), you can refer to them using the flow direction (input to, input of, or output of):
the class-name [local-name] connected at an {input to | input of | output
of } item
-> item
the quantifier, this generic reference expression produces the one and only item of the specified class that is connected at any input stub or output stub of the specified item. With the any quantifier, this expression produces the set of items of the specified class that are connected at any input or output stub of the specified item. (The input to and input of phrases are equivalent; use one or the other to improve the readability of your code.)
To refer to objects connected at a particular direction:
![]() |
Input and output stubs of objects are described in Specifying Connection Stubs.
Referring to Port Names
The place at which a connection attaches to an icon is called a port. You can give these locations names by defining stubs with port names in the object definition.
the class-name [local-name] connected at the {portname of | input to |
input of | output of } object
-> item
the quantifier, this generic reference expression produces the one and only item of the specified class that is connected at a named port or at any input stub or output stub of the specified object. With the any quantifier, this expression produces the set of items of the specified class that are connected at a named port or at any input or output stub of the specified object. (The input to and input of phrases are equivalent; use one or the other to improve the readability of your code.)
To refer to connected objects using a port name:
![]() |
if the status of any valve V connected at the water-input-for any tank is
blocked then inform the operator that
"[the public-name of V] is blocked; check it immediately!"
if rule checks whether the Status attribute contains the symbol blocked for any valve that is connected to any tank at its water-input-for port. Input and output stubs of objects are described in Specifying Connection Stubs.
Tip: This example illustrates a naming convention for portnames in an object definition: include a preposition as a name suffix. (water-input-for is the portname.) This makes the expression easier to read by G2 developers, knowledge engineers, and application users.
Referring to the End of a Connection
G2 can iterate over any specified object connected to the (or an) input end of, output end of, or either end of a connection.
the class-name at {an input end | an output end | either end} of connection
-> item
the quantifier, this generic reference expression produces the one and only item of the specified class that is at an input end, output end, or either end of the specified connection. With the any quantifier, this expression produces the set of items of the specified class that is at an input end, output end, or either end of the specified connection.
To refer to objects using the connected direction only, without a connected at statement:
![]() |
Referring to the Connection Class
G2 can iterate over any item that uses a specific connection class.
the connection-class-name [local-name] connected to item
->item
the quantifier, this generic reference expression produces the one and only connection class that is connected in any way to the specified item. With the any quantifier, this expression produces the set of connections of the specified class that are connected in any way to the specified items.
To refer to a specific connection class:
![]() |