The relationsWithRole method returns all relations that connect the subject object to objects via the given role:

<T> = <object>.relationsWithRole( <role>[, <filter>] )

<object>

A value of type Object or an expression evaluating to a value of type Object not being a Relation.

<role>

A value of type string or an expression evaluating to a value of type string: the role name.

<filter>

A value of type string or an expression evaluating to a value of type string, or a list or set of those: the type (or types) the connected objects must have (or derive from). This argument is optional: relations connected to objects of all types will be returned when omitted.

<result>

A list containing elements of type Relation: the relations connected to <object> with the given <role>.