Consider I have a Class (or Sysml Block) with a property of type String with a multiplicity of [1..*].
How do I specify in UML or SysML a default value for this property of multiple StringLiterals?
I am using Cameo Systems Modeler.
1
ValueSpecifications are defined like this:
A ValueSpecification is the specification of a (possibly empty) set of values.
There are countless ways to specify a set of Values, but for a literal specification UML only includes elements that define one value. For all other ways you can use OpaqueExpressions. This allows for the needed flexibility.
The drawback is, that UML doesn’t include an expression language. You have to rely on the languages your tool supports. Cameo does support Groovy, so you can write ["string1","string2"]
. The simulation engine will interpret this correctly.
Actually, there is a standard language, albeit in a separate specification: ALF (omg.org/spec/ALF). If you buy the plugin, Cameo can use it. Then it looks like String[]{"string1","string2"}
. If available, definitely use this standard.
PS: There was Issue UMLR-790 that asked for changing the multiplicity of the default value. It was dismissed, since ValueSpecifications already allow to define multiple values. Adding a second way would be confusing.
2