Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(model-api): check if is sub-concept but only based on the IConceptReference #819

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

benedekh
Copy link
Contributor

@benedekh benedekh commented Jun 17, 2024

In MPS, we mostly have MPSConcepts, SimpleConcepts and GeneratedConcepts at runtime.

If we use MPSConcept, then the IConcept.isSubConceptOf assumes that the superConcept is an MPSConcept. If not, then the method returns false. This makes it difficult to check if this and superConcept are the same superConcept if is a SimpleConcept.

GeneratedConcept.isSubConceptOf checks the equality with the superConcept, which means if the superConcept is a different object that structurally may represent the same Concept then it returns false (e.g. a GeneratedConcept and a SimpleConcept with the same Concept UID and name would return false).

In order to simplify all these cases we could just check the UID of the Concept and assume that if UID matches then the Concepts should also be the same. This implementation is similar to how SConceptAdapterById checks the isSubConcept in MPS. This adapter is often used in MPS, that is wrapped by MPSConcept at runtime.

To be verified by reviewers

  • Relevant public API members have been documented
  • Documentation related to this PR is complete
    • Boundary conditions are documented
    • Exceptions are documented
    • Nullability is documented if used
  • Touched existing code has been extended with documentation if missing
  • Code is readable
  • New features and fixed bugs are covered by tests

@benedekh benedekh requested a review from a team June 17, 2024 08:49
@benedekh benedekh self-assigned this Jun 17, 2024
@benedekh benedekh requested a review from slisson as a code owner June 17, 2024 08:49
Copy link
Contributor

github-actions bot commented Jun 17, 2024

Test Results

131 files  +2  131 suites  +2   9m 19s ⏱️ -28s
777 tests +6  768 ✅ +6  9 💤 ±0  0 ❌ ±0 
787 runs  +6  778 ✅ +6  9 💤 ±0  0 ❌ ±0 

Results for commit f70040c. ± Comparison against base commit 5e8a62b.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jun 17, 2024

JVM coverage report

Overall Project 49.76%
Files changed 100% 🍏

File Coverage
IConcept.kt 54.55% 🍏

@benedekh benedekh changed the title feat(model-api): check if is sub-concept but only based on the IConcept feat(model-api): check if is sub-concept but only based on the IConceptReference Jun 19, 2024
…pt UID

In MPS, we mostly have MPSConcepts, SimpleConcepts and GeneratedConcepts at runtime.

If we use MPSConcept, then the IConcept.isSubConceptOf assumes that the superConcept is an MPSConcept. If not, then the method returns false. This makes it difficult to check if this and superConcept are the same superConcept if is a SimpleConcept.

GeneratedConcept.isSubConceptOf checks the equality with the superConcept, which means if the superConcept is a different object that structurally may represent the same Concept then it returns false (e.g. a GeneratedConcept and a SimpleConcept with the same Concept UID and name would return false).

In order to simplify all these cases we could just check the UID of the Concept and assume that if UID matches then the Concepts should also be the same. This implementation is similar to how SConceptAdapterById checks the isSubConcept in MPS. This adapter is often used in MPS, that is wrapped by MPSConcept at runtime.
@benedekh benedekh force-pushed the feature/is-subconcept-based-on-uid branch from e1955c3 to f70040c Compare June 19, 2024 13:03
@benedekh
Copy link
Contributor Author

I've fixed the suggestion we had in the refinement today.

@modelix/developers could you review this PR, please?

@benedekh benedekh merged commit 941ab4c into main Jun 19, 2024
16 checks passed
@benedekh benedekh deleted the feature/is-subconcept-based-on-uid branch June 19, 2024 18:16
@slisson
Copy link
Member

slisson commented Jun 20, 2024

🎉 This PR is included in version 8.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants