· 15 min read
Queries Walk a Path, a Reasoner Draws Conclusions: Metachains, SysML v2 Calcs and Views, and SSR
A Cameo metachain, a SysML v2 feature chain or view filter, and a SPARQL query all answer a question by evaluating a path you wrote. A reasoner works out what follows from the model first, then answers with a proof and a status that tells 'no' from 'not known'. Here is how each one works, a multi-hop question run both ways on a real model, and when you need which.
Here is a question I get asked in one form or another on every program: if this part changes, what do I have to look at again? Take the Fish On! bite alarm. Its rod sensors and its base station each carry an RFM95W LoRa radio module. Suppose the module changes: a new revision, a different FCC grant, a different supplier. Which requirements are now in play?
A model can answer that, and there are two very different ways to make it do so. You can write a path through the model and have a tool walk it. Or you can have a tool work out everything that follows from the model, and then ask. The first is a query. The second is inference. People tend to talk about them as if they were the same thing done by different tools. They aren’t, and the difference matters most in exactly the places engineers care about: impact analysis, compliance, and anything you hand to an AI assistant.
This article walks through how each one works, with the spec text, and runs one multi-hop question both ways on the Fish On! model. The reasoner here is SSR, the SysML v2 Semantic Reasoner I’ve been building. It isn’t publicly released, so read its part as a description of an approach, with real output.
How a Cameo metachain answers it
If you’ve used Cameo Systems Modeler with SysML v1, you’ve probably built this kind of question with a metachain. Cameo’s documentation calls it specifying criteria for querying the model, and the same criteria drive several features. Criteria are what the tool uses to “Associate row and column elements in a dependency matrix,” “Display relations between elements in a relation map,” “Gather the contents of a smart package,” and “Calculate/gather the value of a derived property.” Criteria are built from operations: Simple Navigation, Metachain Navigation, Find, Filter, Type Test, Implied Relations, scripts, and others.
The Metachain Navigation page says what it is for: “Use the Metachain Navigation operation type when specifying indirect (multi-level) relations.” Each step names a metaclass or stereotype and one of its properties. Cameo’s own worked example finds where a block is used, in two steps: “under Metaclass or Stereotype, select Block, and under Property, select _typedElementOfType,” then “select Part Property, and under Property, select Owner.” Hop one goes from the block to the part properties typed by it; hop two goes from those to the blocks that own them. Add steps to the specializations, to the parts typed by those, and to the «satisfy» relationships, and you have the impact question.
The mechanics are simple, and that’s a strength. The tool starts from the context element, follows each named property over what’s stored in the model, and, as the page puts it, “the Metachain Navigation operation returns a set.” The result shows up in a table column, a relation map or a derived property. Two things bound it. You write the path, so the answer is only as complete as the path. And the same page notes that metachains “do not support loops and recursive relations”; for that, Cameo offers a script operation “in OCL 2.0, as Java binary, or in any of the modeling tool-supported script languages.”
One clarification, because it’s easy to get wrong: metachains are a Cameo feature, not part of SysML v1. The standard way to write a query over a UML or SysML v1 model is OCL, the OMG’s Object Constraint Language, which UML uses for its own constraints. Either way, it’s a query: a path evaluated over stated relationships.
How SysML v2 answers it: chains, calcs and views
SysML v2 builds expressions into the language itself, through KerML. Three pieces matter here.
Feature chains collect. revB.sensors.txPowerDbm is a two-hop path, and
KerML clause 7.4.9.3 says how it evaluates:
The referenced feature is evaluated in the context of each of the result values of the primary expression, in order. The resulting feature values are then collected into a sequence in order of evaluation.
The same clause gives a select, written .?, where “those for which the
expression body evaluates to true are selected for inclusion in the result
of the select expression,” and the -> form for chaining function calls.
Calcs package a computation. SysML clause 7.19.1: “A calculation definition specifies a reusable computation that returns a result in the result parameter.” So the two-hop path and the select can be named and reused. I added these to a copy of the Fish On! model, with a part that uses them:
// Two hops, collected: the transmit power of every sensor in a system.
calc def TransmitPowers {
in sys : FishOnSystem;
return : Real[0..*] = sys.sensors.txPowerDbm;
}
// The sensors that keep transmitting when the cell is critical.
calc def KeepsTransmitting {
in sys : FishOnSystem;
return : RodSensor[0..*] =
sys.sensors.?{in s : RodSensor; s.stopsTransmittingWhenCritical == false};
}
part answers {
attribute revBPowers : Real[0..*] = TransmitPowers(revB);
ref part revBStillTransmitting : RodSensor[0..*] = KeepsTransmitting(revB);
ref part revCStillTransmitting : RodSensor[0..*] = KeepsTransmitting(revC);
attribute revBSensorCount : Natural = size(revB.sensors);
}
SSR evaluates them. revB goes in as the part argument, the chain collects
one transmit power per sensor, and the answer is a list of real values:
$ ssr ask FishOn-queries.sysml --library sysml.library -- "values of answers.revBPowers"
PROVED — 4 known value(s): revBPowers is bound to an expression, and nothing says these are all of its values, so there may be others. Under the open-world assumption that is not a statement that there are (spec §67, §414).
revBPowers = 10.0 [INFERRED] derived: revBPowers is given by an expression, and this is one of the values it evaluates to for answers
revBPowers = 10.0 [INFERRED] derived: revBPowers is given by an expression, and this is one of the values it evaluates to for answers
revBPowers = 10.0 [INFERRED] derived: revBPowers is given by an expression, and this is one of the values it evaluates to for answers
revBPowers = 10.0 [INFERRED] derived: revBPowers is given by an expression, and this is one of the values it evaluates to for answers
The select works the same way:
$ ssr ask FishOn-queries.sysml --library sysml.library -- "values of answers.revBStillTransmitting"
PROVED — 4 known value(s): revBStillTransmitting is bound to an expression, and nothing says these are all of its values, so there may be others. Under the open-world assumption that is not a statement that there are (spec §67, §414).
revBStillTransmitting = rod1 [INFERRED] derived: revBStillTransmitting is given by an expression, and this is one of the values it evaluates to for answers
revBStillTransmitting = rod2 [INFERRED] derived: revBStillTransmitting is given by an expression, and this is one of the values it evaluates to for answers
revBStillTransmitting = rod3 [INFERRED] derived: revBStillTransmitting is given by an expression, and this is one of the values it evaluates to for answers
revBStillTransmitting = rod4 [INFERRED] derived: revBStillTransmitting is given by an expression, and this is one of the values it evaluates to for answers
Every Rev B sensor keeps transmitting on a critical cell. That fact comes
back later as a broken requirement. Rev C’s sensor stops, so
KeepsTransmitting(revC) returns no known values.
Why “and possibly more.” Each of those answers says four values are
known, not that four is all there is. That isn’t hedging. The model says
sensors : RodSensor[1..*] and names four, rod1 through rod4, each
:> sensors. Nothing says those four are the whole list, and a fifth sensor
declared somewhere else wouldn’t contradict anything. So a count over that
list isn’t known, and SSR says so instead of guessing:
$ ssr ask FishOn-queries.sysml --library sysml.library -- "values of answers.revBSensorCount"
UNKNOWN — revBSensorCount is bound to `size(revB.sensors)`, and its value is not known: no value is stated for how many values `revB.sensors` has — its multiplicity [1..*] leaves the count open.
The Fish On! model doesn’t close that list. If Rev B really has four
sensors, one line inside revB says so:
part :>> sensors = (rod1, rod2, rod3, rod4);
An exact multiplicity, [4], with the four known to be different, also
works. With that line in a copy, the same questions come back exact:
PROVED — 4 value(s), and that is all of them: revBPowers is bound to an expression whose values are complete.
PROVED — 4 value(s), and that is all of them: revBStillTransmitting is bound to an expression whose values are complete.
PROVED — 1 value, and that is all of them: revBSensorCount is bound to an expression.
revBSensorCount = 4 (= size(revB.sensors)) [INFERRED] derived: given by an expression, and this is what it evaluates to
Rev C still reads “0 known value(s)” with “there may be others,” because I only closed Rev B. An empty result isn’t “none” until the model says the list is complete.
Views select and render. SysML clause 7.26.2 describes the whole pipeline in one sentence:
A view artifact is generated from a view usage by first importing the exposed elements based on the expose relationships of the view usage, filtering those based on the view conditions that are owned and inherited by the view usage, and then generating a rendered view artifact using the view rendering specified for the view usage.
The Fish On! model has a radio compliance view built exactly that way:
view radioComplianceView : GridView {
satisfy radioComplianceVP;
expose FishOn::Structure::**[@RadioRegulatedMetadata];
render partWhereUsedTable;
}
Asked what that view shows, SSR evaluates the expose and the filter:
$ ssr ask FishOn.sysml --library sysml.library -- "contents of radioComplianceView"
PROVED — radioComplianceView shows 2 element(s). It renders as partWhereUsedTable, …
RFM95W [INFERRED] a member of Structure; through `expose FishOn::Structure::**[@RadioRegulatedMetadata]`
ESP32S3 [INFERRED] a member of Structure; through `expose FishOn::Structure::**[@RadioRegulatedMetadata]`
A view can show calc results, too. Here’s a table view over the answers
part:
view answersTable {
expose answers::*;
render asElementTable;
}
SSR’s view renderer fills each Value cell with the calc’s result, worked out over the feature chains:
This is the case I had in mind for anyone coming from Cameo, where computed table columns are everyday work. If your SysML v2 model has calcs written over feature chains, they now produce real values in an SSR table, whether you typed the model or another tool wrote it out as SysML v2 text. What I’ve verified is the calcs themselves: they parse, they evaluate, and the table shows the result. What a particular exporter writes is worth checking on your own model.
Notice what kind of thing a filter is. KerML clause 7.4.9.1 restricts it to a model-level evaluable expression, which is “an expression that refers to metadata, which is data about model elements, rather than the things being modeled.” And SysML clause 7.5.4 says the conditions “are evaluated on the member elements of all memberships that are potentially to be imported.” A filter is a test on one element at a time: its metaclass, its metadata. A feature chain, on the other hand, navigates the things being modeled, not the model’s relationships. Neither one, by itself, walks “who is typed by this, who owns that, who claims to satisfy what” across elements.
That kind of question is a model query, and SysML v2 has a standard place for it too. The Systems Modeling API and Services specification defines a Query record (clause 7.1.4) whose conditions are a “property-operator-value tuple, e.g. mass <= 4 kg., or type instanceOf Generalization,” and notes that a Query “can be mapped to commonly used query languages, such as SQL, Gremlin, GraphQL, and SPARQL.”
So here’s the impact question as SPARQL, run over SSR’s RDF export of the Fish On! model, which uses the SysML v2 metamodel’s own vocabulary. Four hops, the same four as the left side of the figure below:
SELECT DISTINCT ?requirement ?claimedBy WHERE {
?radio sysml:type <urn:ssr:element:FishOn::Structure::RFM95W> . # hop 1: usages typed by RFM95W
?unit sysml:ownedMember ?radio . # hop 2: the definition that owns one
?part sysml:type/sysml:superclassifier* ?unit . # hop 3: things of that kind or a subkind
?claim a sysml:SatisfyRequirementUsage ; # hop 4: satisfy claims on those things
sysml:satisfyingFeature/sysml:featureTarget? ?part ;
sysml:satisfiedRequirement ?r .
?r rdfs:label ?requirement .
?part sysml:qualifiedName ?claimedBy .
}
It returns 21 rows, in under 50 ms on my laptop. The Rev B ones:
channelLoadLimit FishOn::Designs::revB::base
neighborKitsIgnored FishOn::Designs::revB::base
pairedSensorsOnly FishOn::Designs::revB::base
alertAllocationCoversAirtime FishOn::Designs::revB::rod1
boardFitsHousing FishOn::Designs::revB::rod1
coinCellTransmitPower FishOn::Designs::revB::rod1
linkMarginAtRange300ft FishOn::Designs::revB::rod1
noSilentFailure FishOn::Designs::revB::rod1
sampleRateAsSpecified FishOn::Designs::revB::rod1
seasonBatteryLife FishOn::Designs::revB::rod1
sleepCurrentLimit FishOn::Designs::revB::rod1
wakeThresholdAboveDisturbance FishOn::Designs::revB::rod1
waterproofSensor FishOn::Designs::revB::rod1
… 8 more rows for Rev C
That’s a good answer: standard, fast, and anybody with a triple store can run it. We’ll come back to what it doesn’t say.
How the reasoner answers it
A reasoner doesn’t start from your question. It starts from the model.
SSR reads the model and the OMG standard library into one internal form, then applies the rules of KerML and SysML v2 to every statement, over and over, until nothing new follows. Every conclusion it adds keeps the rule that produced it and the premises it came from. A second pass, a refutation pass, finds what forward rules alone can’t, and then analyses that need the finished type hierarchy run on top: arithmetic, interfaces, behavior and verification. Only then does a question get asked, and it reads that closed result. The rules are strict KerML and SysML v2, plus a small SSR library for the few OWL 2-style axioms SysML v2 has no way to state. No heuristics. It’s the same arrangement an OWL 2 reasoner such as HermiT uses on an ontology, with the SysML v2 model as the one source of truth.
So the questions are short. Here’s one about the radio’s regulatory footprint:
$ ssr ask FishOn.sysml --library sysml.library -- "instances of RegulatedTransmitter"
PROVED — 9 known instance(s) of RegulatedTransmitter. Under the open-world assumption there may be others (spec §67).
revB.base.mcu [INFERRED] revB.base.mcu : RegulatedTransmitter
revB.base.radio [INFERRED] revB.base.radio : RegulatedTransmitter
revB.rod1.radio [INFERRED] revB.rod1.radio : RegulatedTransmitter
revB.rod2.radio [INFERRED] revB.rod2.radio : RegulatedTransmitter
revB.rod3.radio [INFERRED] revB.rod3.radio : RegulatedTransmitter
revB.rod4.radio [INFERRED] revB.rod4.radio : RegulatedTransmitter
revC.base.mcu [INFERRED] revC.base.mcu : RegulatedTransmitter
revC.base.radio [INFERRED] revC.base.radio : RegulatedTransmitter
revC.rodA.radio [INFERRED] revC.rodA.radio : RegulatedTransmitter
Nothing in the model is typed RegulatedTransmitter. Every row is
inferred. And none of those nine things is declared anywhere either:
revB.rod1.radio exists because rod1 is a RevBRodSensor, which
specializes RodSensor, which declares part radio : RFM95W. The
classification comes from the #radioRegulated keyword on RFM95W. That’s
semantic metadata, and KerML clause 7.4.13 says what it does: “Each type
annotated by such semantic metadata has an implicit specialization added to a
type determined from the baseType value,” and in this case “the annotated
classifier implicitly subclassifies each type of the baseType.” The ESP32-S3
on the base station picks it up the same way.
Ask why, and you get the chain:
$ ssr ask FishOn.sysml --library sysml.library -- "why revB.rod1.radio : RegulatedTransmitter"
PROVED — revB.rod1.radio : RegulatedTransmitter
revB.rod1.radio : RegulatedTransmitter [INFERRED] an instance of a type is an instance of its supertypes (spec §7)
1. rod1.radio = revB.rod1.radio [FishOn.sysml:257:13]
2. RFM95W :> RegulatedTransmitter [FishOn.sysml:221:39]
⇒ revB.rod1.radio : RegulatedTransmitter (an instance of a type is an instance of its supertypes (spec §7))
Every premise has a file, a line and a column. That one-line question crossed typing, specialization, an inherited part and a metadata rule. The hops are still there. The reasoner took them before you asked.
The same answer, written as a query
Can a structured query produce those nine rows? Yes. Here it is, over the same RDF export:
SELECT ?thing ?feature WHERE {
?part a sysml:PartUsage ; sysml:qualifiedName ?thing ;
sysml:type/sysml:superclassifier* ?def . # rod1 is a RevBRodSensor, so a RodSensor
?def sysml:ownedMember ?u . # RodSensor declares part radio
?u a sysml:PartUsage ; rdfs:label ?feature ;
sysml:type/sysml:superclassifier* # radio : RFM95W, and RFM95W :> RegulatedTransmitter
<urn:ssr:element:FishOn::Semantics::RegulatedTransmitter> .
FILTER (STRSTARTS(?thing, "FishOn::Designs::"))
}
Nine rows, the same nine. So what’s the difference between an inference and a query that returns the same result?
The query is the rules, written by hand, for this one question. Its comments say which ones: the specialization closure, features inherited from a definition, the implicit specialization semantic metadata adds. (That last one is in the export only because the reasoner resolved it; a store that holds just what was typed wouldn’t have it.) Ask a different question and you write the rules again, and the next model that uses redefinition, subsetting or a disjointness axiom needs more of them. A reasoner applies all of its rules to every question, including the ones nobody thought to encode, and it can show its work. A query can’t tell you why a row is there; it can only show the path you gave it.
What inference tells you that a query can’t
Go back to the impact query’s 21 rows. They’re the right rows. But they answer “which claims sit at the end of this path,” and an engineer wants to know where those claims stand. Ask the reasoner for the requirements and each one comes back with a verdict, computed from the model’s own values:
$ ssr ask FishOn.sysml --library sysml.library -- "requirements"
PROVED — 28 requirement(s).
…
sampleRateAsSpecified [UNVERIFIED] NOT MET by revB.rod1 — and nothing verifies it
linkMarginAtRange300ft [COVERED] met by revB.rod1 — rangeWalkTest is meant to verify it, but no verdict is recorded, so it is not verified
noSilentFailure [UNVERIFIED] NOT MET by revB.rod1 — and nothing verifies it
pairedSensorsOnly [UNVERIFIED] NOT MET by revB.base — and nothing verifies it
wakeThresholdAboveDisturbance [UNVERIFIED] claimed but not checkable — no value is stated for disturbancePeak — and nothing verifies it
…
Of the ten claims on revB.rod1, six are met, two are breached and two can’t
be checked yet. That’s the triage the impact question was really asking for.
The breached ones are contradictions with proofs; the uncheckable ones say
exactly what’s missing.
The second thing is the difference between “no” and “not known.” A query over stored data has two outcomes: a row or no row. Ask whether rod 1 is a base station:
$ ssr ask FishOn.sysml --library sysml.library -- "is revB.rod1 : BaseStation"
NOT_ENTAILED — rod1 : BaseStation is not entailed. Under the open-world assumption that does not make it false — nothing in the model rules it out (spec §8, §67).
That’s correct, and a little uncomfortable: the model never says a rod sensor
can’t also be a base station. Add one line to RodSensor,
assert not constraint { that istype BaseStation }, and the answer changes:
CONTRADICTED — rod1 : BaseStation contradicts the model.
• rod1 : RevBRodSensor
• RevBRodSensor disjoint from BaseStation
The calcs earlier showed the same honesty about lists: four known sensors are four known, not four total. An empty query result looks exactly like a “no.” A reasoner keeps the three apart: entailed, contradicted, not settled.
And what a query does better
This isn’t one-sided. Queries are simpler to reason about, because you can read the path and know what it will do. They’re standard and portable: SysML v2 expressions are in the language, the API’s Query is in the API specification, and SPARQL is a W3C standard. They’re cheap: the impact query ran in under 50 ms after a tenth of a second to load the file. And they’re the natural tool for reports: counts, joins, columns, sorting, everything a table needs.
A reasoner costs more. SSR’s own measurements put opening a session on a real
model with the standard library at about 1.4 s cold and an ordinary question
after that at 0.2 to 5 ms. On a generated 50,000-line model, a full
ssr reason takes about 40 seconds, with questions then at 5 to 40 ms, and
memory starts from a 1.73 GB floor for the library. The answers take some learning to read, too: “not entailed”
is not “no,” and covered is not verified.
Complement, not replacement
So do they compete? I don’t think so. They answer different questions.
Notice that both sides compute in SSR now. Calcs evaluate, selects filter, tables fill in. So the line isn’t that one computes and the other doesn’t. A calc evaluates the path you wrote. The reasoner draws the conclusions nobody wrote: what each thing is, which claims the model’s own values contradict, which requirements are met, breached or not yet checkable, whether an answer is “no” or “not known,” and the proof behind each one.
And the calc stands on the reasoner’s work. Write
revB.sensors.radio as FishOn::Semantics::RegulatedTransmitter and you get
all four Rev B radios, though no radio is typed RegulatedTransmitter. That
type comes from the #radioRegulated metadata, which the reasoner resolved
before the cast ran. Cast the same radios to ESP32S3 and you get no known
values. A select with istype behaves the same way. Evaluated over only the
types somebody typed, that first cast would come back empty.
A query asks “show me what’s connected this way.” A reasoner asks “what’s true, given everything the model says?” Views and calcs are how a model presents and computes; a reasoner is how it concludes. The combination I’d recommend is to reason first and query the result. SSR’s RDF export keeps the inferred triples apart from the stated ones, each with its rule and proof, so a SPARQL query over it can choose: stated facts only, or stated plus inferred, or “show me only what nobody wrote down.” Same on the view side: a view selects what to show, and the reasoner’s findings decorate it.
Grounding an AI
SSR runs as an MCP server, so an AI client can open a model and call it:
ssr_open_model, ssr_ask, ssr_findings, ssr_render, and tools for
proposing changes. The ssr_ask tool describes itself this way: it “Returns
the answer, where each row came from, and — for a why question — the
statements the conclusion rests on with their source locations.”
Is that better for grounding an AI? Yes, but not because of MCP. A query
engine or a SysML v2 API server can sit behind MCP just as easily, and an
assistant that can run a query is already better off than one reading model
text. The advantage is the kind of answer. A language model handed an empty
result set will tell you “no.” Handed NOT_ENTAILED with “that does not make
it false,” it has the words to say “the model doesn’t settle this.” Handed a
proof with line numbers, it can cite them instead of paraphrasing. The
manual SSR hands to agents says it outright: “If an answer is UNKNOWN that is a real
answer: it means the model does not settle the question, which under an
open-world reading is different from no.”
Is a multi-hop query even necessary?
Less often than you’d think. Most of the hops in a typical metachain are there
to reconstruct facts the language already implies: this usage is typed by
that definition, that definition specializes another, this part is inherited.
Once a reasoner has closed the model, those facts are there, and the question
becomes one hop: instances of RegulatedTransmitter,
satisfiers of linkMarginAtRange300ft,
find RodSensor with RodSensor::radio some RegulatedTransmitter. If you find
yourself writing a long path to work out what something is, that’s a sign
you want inference, not a longer path.
The hops that remain are the engineering ones that aren’t consequences of anything: this part is allocated to that function, which traces to that requirement, which this test verifies. Impact analysis along relationships like those is a real multi-hop question, and a query is the right tool. I’d just run it over the reasoned model, so the path starts from what’s true, not only from what somebody typed.
If you want more on this way of working, it’s the subject of Chapter 17 of Models That Answer, “Asking the Model”: what kinds of question a reasoner can answer, what each kind of answer means, and the open-world trap. It’s one of the three books in this season’s SysML v2 holiday set, with SysML v2 at a Glance and How to Model Anything in SysML v2, on the books page.
Get the next article by email
One email when a new article goes live, usually Thursday morning. SysML v2 and MBSE practice, no filler. Unsubscribe with one click.
More of this, on video
Walkthroughs in SysML v2 and MBSE tooling, with the model on screen.


