cross-subsetting-crossed-feature

Available in: KerML, SysML

This checks that CrossSubsettings always chain two features, and if declared on one of two end features, starts from the opposite end feature.

Specification

The crossed_feature of a CrossSubsetting must have exactly two chaining_features. If the crossing_feature of the CrossSubsetting is one of two end Features, then the first chaining_feature must be the other end Feature.

Examples

With one feature:

attribute def A;
attribute a {
    end attribute b;
    end attribute c : A => a; // error
}

With more than two features:

attribute def A;
attribute a { 
    end attribute b { attribute c { attribute d; } }
    end attribute c : A => b.c.d; // error
}

Chaining through non-opposite feature:

attribute def A;
attribute a { 
    end attribute b;
    end attribute c : A => a.b; // error
}

Instead, explicit crossings must start from the opposite end:

attribute def A;
attribute a { 
    end attribute b { attribute c : A; }
    end attribute c : A => b.c; // ok
}