How Solver queries name features
A Solver query, the expression you pass to evaluate --expr or check --predicate,
is written in SysML expression syntax, but a qualified name inside it means something
SysML itself has no notation for. This page explains that meaning and why the Solver
needs it.
A qualified name designates a declared feature
In a query, a qualified name such as Catalog::Wheel::mass designates the feature as
it is declared, and the Solver reports the values that feature can take in every
situation the model allows. The feature may belong to a definition that has no usages
at all. Create catalog.sysml:
package Catalog {
part def Wheel {
attribute rimMass = 9;
attribute tyreMass = 3;
attribute mass = rimMass + tyreMass;
}
}
Nothing in this model is typed by Wheel, yet the question “what can a wheel’s mass
be?” has an answer:
syside solver evaluate -i catalog.sysml --expr "Catalog::Wheel::mass"
{
"result": {
"subject": "Catalog",
"expression": "Catalog::Wheel::mass",
"determination": "determined",
"outcome": {
"shape": "attainable_set",
"values": [
{
"value": "12",
"witness": {
"values": [
["Catalog::Wheel::rimMass", "9"],
["Catalog::Wheel::tyreMass", "3"],
["Catalog::Wheel::mass", "12"]
],
"value": "12"
}
}
],
"exhaustive": "true"
},
"causes": []
},
"warnings": [],
"exit_code": 0
}
A path through usages reads the same way: Rover::rover::totalMass in
Evaluate possible values designates the totalMass feature of the rover part.
Why the Solver defines its own notation
The question is well defined in SysML v2. A feature declared in a definition is
interpreted over every instance of that definition, whether or not the model contains
a usage of it (KerML 1.0, clause 8.4.3.4). “The values Wheel::mass can take” is
therefore a sound concept.
The SysML v2 specification and its standard library give no notation for it (see
Differences to the Pilot Implementation for how Syside relates to both). A SysML feature reference is
evaluated on an instance: the referenced feature must be accessible from where the
expression is written (KerML 1.0, clauses 8.3.4.8.5 and 8.3.3.3.10). Written at
package level, Catalog::Wheel::mass has no Wheel in context, so as a SysML
expression it is not valid. Chain notation (someWheel.mass) needs an instance to
start from, and adding one would change the model being asked about. No construct in
the specification denotes “this feature, across all instances of its definition”
without introducing an instance.
The Solver therefore defines its own notation. In a query, a qualified name is resolved by the specification’s ordinary name resolution to a declared feature, and stands for that feature’s values across all situations the model allows.
Where the notation applies
The notation applies to query text only. Inside a model file, the same text is an
ordinary SysML expression, and Syside validates it as one: Syside 1.0 and later report
feature-reference-expression-access (“Feature reference must be accessible from the
outer scope”) for such a reference. The Solver does not apply that check to the query
you pass on the command line.