feature-value-is-initial

Available in: KerML, SysML

This checks that initial feature values are only owned by variable features.

Specification

If a FeatureValue has is_initial = true, then its feature_with_value must have is_variable = true.

Example

class A {
    feature a := 0; // error
}

Or

attribute def A {
    attribute a := 5; // error
}

Instead, use default value:

class A {
    feature a default 0; // ok
}

Or make the feature variable (KerML only):

class A {
    var feature a := 0; // ok
}

In SysML, features are implicitly variable if they are

  • not portion (neither snapshot nor timeslice)

  • neither binding connector nor succession

  • not composite action usage, implicitly or explicitly

  • owned by an occurrence

  • does not specialize either Links::SelfLinks or Occurrences::HappensLink