connector-related-features
Available in: KerML, SysML
This checks that concrete connectors have at least two related features, i.e.
ends.
Specification
If a
Connectoris concrete (notabstract), then it must have at least tworelated_features.
Example
connection c; // error: A concrete connector must have at least two related features
Fix this by marking the connector as abstract:
abstract connection c; // ok
Otherwise, connections must have at least 2 ends with reference subsettings:
connection c { // error: A concrete connector must have at least two related features
end a;
end b;
}
Fix this by using shorthand-notation, or explicitly referencing related features:
attribute a;
attribute b;
connection c { // ok
end ::> a;
end ::> b;
}
connection d connect a to b; // ok
Note that because related feature derivation is different between associations and connectors, just specializing a valid association does not suppress the diagnostic, ends must still have reference subsettings:
attribute def A;
attribute def B;
connection def C {
end : A;
end : B;
}
connection c : C; // error: A concrete connector must have at least two related features
Association related elements only describe expected types for connector related features:
attribute def A;
attribute def B;
connection def C {
end : A;
end : B;
}
attribute a : A;
attribute b : B;
connection c : C connect a to b; // ok
Flow shorthand notation must use chained references as the last segment is the input or output feature, and not a related feature:
part a { part c; }
part b { part d; }
flow from a to b; // error: A concrete connector must have at least two related features
flow from a.c to b.d; // ok