The Object Constraint Language (OCL) is a language for describing rules that apply to MOF conform modelling languages like UML. The OCL is a text based language that provides constraint and object query expressions that cannot be expressed by a meta modelling language.
this is an attempt to fix #709. While working on #710 I wrote some test cases that were failing and I could track the cause down to what I described in #709. I still haven't fully figured out if I do the right thing here - debugging the Expressions is somewhat "hairy" - and I hope I could gather some feedback from you if I am on a good track.
The original problem was that forAll did not attempted an evaluation of its collection items when there were no iterators/collectors given. To fix that, I took over the code from the positive branch with the difference that I put in the item itself as localVariables instead of mapping it to the iterator first.
This brought me to the problem that nested expressions and my originally written test cases were still failing on nested collection operations. After some debugging I ended up changing the handling of the variable declaration in the respective expressions, if the given item is already an object.
I wanted to separate the branch for #710 from this fix and ended up removing the test cases for nested expressions for now. I'll re-add them in case one of the Pull Requests will be merged. When interested, you can check them out here if interested (but they'll fail on this branch due to the nested collection expression problem).
This seems to work, but I have no confidence in my solution due to missing understanding what exactly is going on. Thus, I do not feel comfortable setting this PR to ready. Still, I wanted to share my work state with you in hopes you could give me an assessment at how feasible this approach is and what I might have broken with it.
Also, I needed to change the expected result in library.spec.ts since, after the fix, the test was failing and if I understand data and OCL rule correctly, it should indeed evaluate to true.
I look forward to your feedback, if your time permits.
Hello,
this is an attempt to fix #709. While working on #710 I wrote some test cases that were failing and I could track the cause down to what I described in #709. I still haven't fully figured out if I do the right thing here - debugging the Expressions is somewhat "hairy" - and I hope I could gather some feedback from you if I am on a good track.
The original problem was that
forAll
did not attempted an evaluation of its collection items when there were no iterators/collectors given. To fix that, I took over the code from the positive branch with the difference that I put in the item itself aslocalVariables
instead of mapping it to the iterator first.This brought me to the problem that nested expressions and my originally written test cases were still failing on nested collection operations. After some debugging I ended up changing the handling of the variable declaration in the respective expressions, if the given item is already an object. I wanted to separate the branch for #710 from this fix and ended up removing the test cases for nested expressions for now. I'll re-add them in case one of the Pull Requests will be merged. When interested, you can check them out here if interested (but they'll fail on this branch due to the nested collection expression problem).
This seems to work, but I have no confidence in my solution due to missing understanding what exactly is going on. Thus, I do not feel comfortable setting this PR to ready. Still, I wanted to share my work state with you in hopes you could give me an assessment at how feasible this approach is and what I might have broken with it.
Also, I needed to change the expected result in
library.spec.ts
since, after the fix, the test was failing and if I understand data and OCL rule correctly, it should indeed evaluate to true.I look forward to your feedback, if your time permits.
Regards