Module Simantics/Structural

This module is undocumented. This is a list of its definitions.

isPartOfUC :: Variable -> <ReadGraph> Boolean

Tells whether the component that the variable represents belongs to a composite that defines a user component, that is whether it is part of the configuration of a component type rather than of a plain composite.

structuralConnectionConnectionPoints :: StructuralConnection -> Resource -> <ReadGraph> [Variable]

structuralConnectionConnectionPoints connection relationType lists the connection points of a connection as variables, keeping only those attached through the given relation type.

structuralTypeResource :: Variable -> Resource -> <ReadGraph> Resource

The effective type of a structural component variable whose own type can be replaced: the replacement made by the innermost enclosing composite that replaces that type, or the component's own type if none of them does. Composites are searched outwards. The second argument is not used.

This is the implementation of the L0.typeResource property asserted on STR.Component, and it answers only for a component whose own type is an instance of STR.ReplaceableDefinedComponentType. For every other component, and for one that has neither a structural component type nor an entity type, the result is a Java null. Reading a variable that has neither a represented resource nor a typeURI property fails instead of returning anything.

The return type ought to be Maybe Resource. It cannot become that, because it is fixed by the value type declared for L0.typeResource in Structural.pgraph and changing it would break every existing caller. For that caller the null is the protocol rather than a failure: getType and getPossibleType of a variable read it as "no replacement" and carry on with the ordinary type of the represented resource.

SCL has no representation for the null and cannot test for it either, so nothing fails at the call site: it escapes into the program as if it were a Resource and typically surfaces much later as a NullPointerException in unrelated code. Do not call this to find out the type of a variable. Use getType, getPossibleType or getPossibleTypeWithBaseType of Simantics/Variables, which apply this function and fold the null away.