Skip to content

ST6RI-921 Invalid feature references are allowed in filter expressions#743

Open
seidewitz wants to merge 4 commits intomasterfrom
ST6RI-921
Open

ST6RI-921 Invalid feature references are allowed in filter expressions#743
seidewitz wants to merge 4 commits intomasterfrom
ST6RI-921

Conversation

@seidewitz
Copy link
Member

This PR removes an exception made in the Pilot Implementation that allowed invalid feature references in filter expressions.

Background

Both the KerML Specification (in 7.4.14 Packages) and the SysML Specification (in 7.5.4 Import Filtering) show examples of referencing features using a qualified name notation. For example:

filter @Annotations::ApprovalAnnotation and
    Annotations::ApprovalAnnotation::approved and
    Annotations::ApprovalAnnotation::level > 1;

This example has subexpressions that are feature reference expressions for non-package-level features, such as Annotations::Approval::approved. However, filter expressions are at package level (have no featuring type), and therefore do not have access to non-package-level features.

This should have caused a checkConnectorTypeFeaturing error on the implied binding connector between the referent feature and the expression result. But the Pilot Implementation had an explicit check coded in FeatureReferenceExpressionAdapter::addReferenceConnector to not add the binding connector if the expression was in a filter, so no error was reported. There is no such exception in the normative metamodel, despite the examples given in Clause 7 of the specifications (see also https://issues.omg.org/issues/KERML11-183 on the specification inconsistency).

Changes

Updated FeatureReferenceExpressionAdapter::addReferenceConnector to remove the exception for filter expressions.

Feature expressions such as in the example above now cause errors. The corrected version of the example is:

filter @Annotations::ApprovalAnnotation and
    (as Annotations::ApprovalAnnotation).approved and
    (as Annotations::ApprovalAnnotation).level > 1;

@seidewitz seidewitz added this to the 2026-02 milestone Mar 17, 2026
@seidewitz seidewitz self-assigned this Mar 17, 2026
@seidewitz seidewitz added the bug Something isn't working label Mar 17, 2026
@seidewitz seidewitz requested a review from hpdekoning March 17, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant