Skip to content

Allow usage of 'nonuqniue' without explicit Kardinality and create a corresponding test#124

Merged
mathias-pfeiffer merged 5 commits into
release/7.8.xfrom
ln/apollo-11-parser-test
May 28, 2026
Merged

Allow usage of 'nonuqniue' without explicit Kardinality and create a corresponding test#124
mathias-pfeiffer merged 5 commits into
release/7.8.xfrom
ln/apollo-11-parser-test

Conversation

@linggd
Copy link
Copy Markdown
Collaborator

@linggd linggd commented May 2, 2026

Added

  • Added parser test for 'nonuqniue' without explicit Kardinality.

Changed

  • Allow usage of 'nonuqniue' without explicit Kardinality

@linggd linggd requested a review from mathias-pfeiffer May 13, 2026 15:03
@linggd linggd marked this pull request as ready for review May 13, 2026 15:03
@@ -53,6 +53,9 @@ component grammar SysMLBasis
SysMLCardinality =
Cardinality (["ordered"] | ["nonunique"])* ;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kann das hier dann entfernt werden?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich denke aktuell nicht, dass SysMLCardinality komplett entfernen werden sollte.
Der Grund ist, dass SysMLCardinality aktuell an vielen Stellen verwendet wird, z.B.:

  SysMLSpecialization implements Specialization =
      (":>" | "specializes") superTypes:(MCType || ",")+ SysMLCardinality?;

  // Subsetting ist spezifisch für Usages
  SysMLSubsetting implements Specialization =
      (":>" | "subsets") superTypes:(MCType || ",")+ SysMLCardinality?;

Außerdem basiert auch die bestehende Methodenstruktur darauf. Aktuell wird angenommen, dass bei vorhandener SysMLCardinality immer auch eine lokale Cardinality existiert:

  astrule SysMLTyping =
      method public de.monticore.cardinality._ast.ASTCardinality getCardinality() {
        if(isPresentSysMLCardinality()) {
          return getSysMLCardinality().getCardinality();
        }
        Log.error("0x10005 get for Cardinality can't return a value. Attribute is empty.");
        // Normally this statement is not reachable
        throw new IllegalStateException();
      }
      method public boolean isPresentCardinality() {
        return isPresentSysMLCardinality();
      } ;

Wenn SysMLCardinality entfernt wird, müssten diese Stellen ebenfalls angepasst werden.

Eine alternative Möglichekeit wäre, z.B.:

SysMLCardinality = Cardinality (["ordered"] | ["nonunique"])* | (["ordered"] | ["nonunique"])+;
Dann wären nur kleinere Anpassungen in Methoden wie getCardinality() bzw. isPresentCardinality() notwendig, weil SysMLCardinality dann auch ohne lokale Cardinality existieren könnte.

z.B:

astrule SysMLTyping =
    method public de.monticore.cardinality._ast.ASTCardinality getCardinality() {
      if(isPresentCardinality()) {
        return getSysMLCardinality().getCardinality();
      }
      Log.error("0x10005 get for Cardinality can't return a value. Attribute is empty.");
      // Normally this statement is not reachable
      throw new IllegalStateException();
    }
    method public boolean isPresentCardinality() {
      return isPresentSysMLCardinality() && getSysMLCardinality().isPresentCardinality();
    } ;

Dadurch wird die IllegalStateException vermieden und getCardinality() liefert nur dann eine Kardinalität zurück, wenn lokal tatsächlich eine existiert.

Copy link
Copy Markdown
Contributor

@mathias-pfeiffer mathias-pfeiffer May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eine alternative Möglichekeit wäre, z.B.: [...]

Ja, die nehmen wir

@mathias-pfeiffer mathias-pfeiffer marked this pull request as draft May 15, 2026 12:56
@mathias-pfeiffer
Copy link
Copy Markdown
Contributor

@linggd Bitte als "assignee" eintragen, nicht reviewer
image

@linggd linggd requested review from mathias-pfeiffer and removed request for mathias-pfeiffer May 19, 2026 09:54
@linggd linggd marked this pull request as ready for review May 19, 2026 09:56
@linggd linggd self-assigned this May 19, 2026
@mathias-pfeiffer mathias-pfeiffer marked this pull request as draft May 19, 2026 10:00
@linggd linggd marked this pull request as ready for review May 19, 2026 10:38
@linggd linggd assigned mathias-pfeiffer and unassigned linggd May 21, 2026
@mathias-pfeiffer
Copy link
Copy Markdown
Contributor

Pass bitte noch den Titel an

@mathias-pfeiffer mathias-pfeiffer marked this pull request as draft May 22, 2026 16:05
@linggd linggd changed the title create parser test for apollo 11 models Allow usage of 'nonuqniue' without explicit Kardinality and create a corresponding test May 26, 2026
@linggd linggd marked this pull request as ready for review May 26, 2026 11:13
@mathias-pfeiffer
Copy link
Copy Markdown
Contributor

Version noch inkrementieren auf 7.8.(x+1) @linggd

@mathias-pfeiffer mathias-pfeiffer marked this pull request as draft May 28, 2026 12:07
@linggd linggd force-pushed the ln/apollo-11-parser-test branch from 96eb78b to 4b00bf0 Compare May 28, 2026 12:33
@linggd linggd marked this pull request as ready for review May 28, 2026 12:43
@mathias-pfeiffer mathias-pfeiffer merged commit 897eeca into release/7.8.x May 28, 2026
4 checks passed
@mathias-pfeiffer mathias-pfeiffer deleted the ln/apollo-11-parser-test branch May 28, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants