Repository navigation
fix(semantics): a body expression owns the body Expression it refers to, and the body its parameters, members and result — read natively as the conversion writes them; the conversion states a body's ResultExpressionMembership as the FeatureMembership it is - #1823
Merged
Merged
Conversation
…eReferenceExpression wrapper whose referent is the condition — the wrapper, its FeatureMembership and result read natively as the conversion writes them Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…trigger id registration (digest only) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…to, and the body its parameters, members and result — read natively as the conversion writes them; the conversion owns a body parameter through a ParameterMembership
A `{ in q; attribute k = 2; q * k }` value is a FeatureReferenceExpression whose referent is the body Expression it owns through a FeatureMembership (KerMLExpressions BodyExpression). The body owns its parameters through ParameterMemberships (BodyParameterMember), its members and its result through a ResultExpressionMembership, in source order; each parameter and member answers the body as its owner. ast.BodyDeclarations is the one ordering the writer, the id reader and the semantics share. The conversion wrote a body parameter's membership as a FeatureMembership; it is a ParameterMembership, stated with ownedMemberParameter, parameter and input as the other parameters are, and every FeatureMembership subclass a body owns now states ownedFeatureMembership/ownedFeature.
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…ons override KerMLExpressions' BodyParameterMember with a type body, as the pilot writes; a body's ResultExpressionMembership is stated as the FeatureMembership it is Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…pression writer change — a body's ResultExpressionMembership stated as a FeatureMembership moves three rows to equal (1144254 / 27934) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…y-chain-parts Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov> # Conflicts: # docs/project/api-json-differential-baseline.json
… merge (digest only) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…on-parts Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov> # Conflicts: # docs/project/api-json-differential-baseline.json
… merge — the same three rows move to equal (1144254 / 27934) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…apper's ownedElement/ownedFeature list the condition it owns The trigger is result-bearing (expressionStructure writes its out), so the change-event branch of expressionPartsOf keeps parts.result and the id reader registers the trigger's out. expressionOwnedParts lists the wrapper's condition ahead of its result, as its FeatureMembership leads; parameter and directedFeature read expressionParameterParts, the parameters alone. Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
… out registration (digest only) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…on-parts Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov> # Conflicts: # docs/project/api-json-differential-baseline.json
…y's its parameters, members and result; a body's result expression is no parameter Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…tree — the same three rows move to equal (1144254 / 27934) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…sion, so a nested body finds its owner on a first read; the id reader descends a local member's own members featureValueOf finds a body parameter's declaration by its span (the symbol shares the body node), so ValueExpression answers it and reflectBodiesUnder reaches a body nested in it. registerBodyDeclarations recurses into a local member's own members as encodeMember's local case mints them. Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…member id registration (digest only) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…pression is a ResultExpressionMember, not the result parameter the conversion omits for a body Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The second of the three expression-parts parity follow-ups (after #1817, whose branch this one is built on — its diff reads as its own three commits once #1817 lands): a body expression.
For
the RDF/API-JSON writer (
bodyExpressionininternal/translate/export/rdf_expr.go) states the{ … }as aFeatureReferenceExpressionwhosereferentis the bodyExpressionit owns through aFeatureMembership; the body owns its parameters and members throughFeatureMemberships and its result through aResultExpressionMembership, in source order; the reference owns its ownout. The native read had the body's parameters and members as symbols in a body-local scope with no owner at all, no body Expression, no result membership, and no ids for any of them.Now:
ExpressionBody, metaclassExpression) as the reference's referent, owned through aFeatureMembershipahead of theReturnParameterMembership; the body owns the symbols its scope declares (parameters and members, in the writer's order) and its result (roleExpressionBodyResult,ResultExpressionMembership);ownerOfa body parameter or member is the body, found through the declaration whose value holds it when nothing reflected the body yet (bodyDeclaredBy);ownedElement/ownedFeatureof the reference list the body ahead of its result, and of the body its parameters, members and result;parameter/directedFeaturelist parameters only (a body's result expression is aResultExpressionMember, not a parameter);ast.BodyDeclarationsis the one source-order numbering the writer (bodyDeclarations), the id reader and the semantics share, soin%d/m%dslots agree by construction;internal/translate/export/element_ids.go) registersbody, every parameter (by its own span — a body's parameters all share the body node) and member (with their value expressions, recursively),resultandoutas the writer mints them;queryexec.ElementIDOfreads a body parameter and its membership through that span;bodyMembershipstatesownedFeatureMembership/ownedFeature/ownedMemberFeaturefor everyFeatureMembershipsubclass it owns, so a body'sResultExpressionMembership(aFeatureMembership, KerML 8.3.4.1) is listed as the pilot lists it.A referee call made on the way, kept as the writer has it: KerMLExpressions'
BodyParameterMemberreturnsParameterMembership, but both notations overrideExpressionBodywith a type body (KerML.xtextFunctionBodyPart, SysML.xtextCalculationBody) whoseinfeature is aFeatureMember, i.e. aFeatureMembership— and the pilot writes that (switching toParameterMembershipflipped 32 matched body-parameter memberships to unmatched in every corpus root). The native read statesFeatureMembershipfor a body parameter explicitly, with the citation.docs/reference/rdf-mapping.mdrecords it.Not in this PR: the chain Feature a dotted name owns (last follow-up). A body member written as a bare expression ahead of the result has no symbol and is not listed natively (the writer writes it at
m%d).Specification basis
KerML 1.0 §8.2.5.8.4 / KerMLExpressions
BodyExpression,ExpressionBodyMember(aFeatureReferenceExpressionowning the bodyExpressionthrough aFeatureMembership),ResultExpressionMember(ResultExpressionMembership); KerML.xtextExpressionBody : '{' FunctionBodyPart '}'and SysML.xtextExpressionBody : CalculationBodyfor the parameters'FeatureMembership; KerML 8.3.4.1ResultExpressionMembershipspecializesFeatureMembership. Nospec-compliance.mdrow moves: the reflective read agreeing with the conversion, not a new rule.How it was verified
internal/semantic/semantics—TestBodyExpressionOwnsItsBodyParametersAndResult: the reference's two memberships,referent, the body's three memberships and their metaclasses/members in order, owners of parameter, member and result, the result'soperatorand parameters, repeated-read identity; and on a fresh model, a reduce body's parameter finds its owner before anything reflected the body.internal/translate/export—TestElementIDReaderSpellsABodyExpressionAsTheConversionWritesIt:body/result/outparts, the parameter by span (…_pin0,FeatureMembership), the member (…_pm1), its value, the result (…_presult) and the result's operand — all as the conversion writes them.tests/export): the only movement is theResultExpressionMembershipnow listed underownedFeatureMembership/ownedFeaturewithownedMemberFeature; the.golden.sysmlround trips are unchanged.go build ./...,go vet ./...,gofmt -l .(empty),go test -count=1 ./...(full suite, run after the last change), the corpus round trip with the corpora required.pilot-apijson-diff -updatethen-check; elements unchanged, properties 1144182 / 27977 → 1144254 present-equal / 27934 present-different; exactly three rows moved, all to equal (Expression.ownedFeatureMembership,Expression.ownedFeature,ResultExpressionMembership.ownedMemberFeature), accounted for indocs/project/api-json-differential.md;go -C tools test ./referee/apijson/... ./oracle/baseline/...andmake docs-countsgreen.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/18ad47adf36f44e9b6824a4472f9678d
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/18ad47adf36f44e9b6824a4472f9678d?variant=devin
Requested by: @NicolasRouquette