includesAll fails [message #1771187] |
Tue, 22 August 2017 17:45 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
I'm trying to fix models to fit to OCL constraints coming after creation but a constraint keep complaining when models look valid.
Here is the constraint :
context TransactionReport
inv cycle__5 :
self.card.transactions->includesAll(self.lines.transaction)
Here are the objects involved:
<RandL:TransactionReport id="TransactionReport_109" lines="TransactionReportLine_103" card="CustomerCard_100"/>
<RandL:CustomerCard id="CustomerCard_100" valid="false" transactions="Transaction_112" Membership="Membership_99"/>
<RandL:Earning id="Transaction_112" amount="0.9586428515996764" points="29" account="LoyaltyAccount_121" generatedBy="Service_124" card="CustomerCard_100"/>
Thus self.card.transactions = { Transaction_112 }
And
<RandL:TransactionReportLine id="TransactionReportLine_103" transaction="Transaction_112" report="TransactionReport_109"/>
Thus self.lines.transaction = { Transaction_112 }
When calling :
helper.setContext(ecClass); //ecClass is TransactionReport
query = helper.createQuery("self.card.transactions->asSet()->includesAll(self.lines.transaction)");
boolean valid = ocl.check(eo, query);
"eo" is an EObject with the following values :
(
- id : TransactionReport_109
- lines : {TransactionReportLine_103} 1 objets [TransactionReportLine]
- card : CustomerCard_100 (ID:id) [CustomerCard]
)
Why do I get a false return from the check ?
Is it possible that some conflicts in references definition makes it fail ?
(Like, if an other object TransactionReport has a transaction field filled with the same "Transaction_112")
Thanks for your help.
Edouard
[Edit: the complete XMI is attached]
[Updated on: Tue, 22 August 2017 17:57] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: includesAll fails [message #1771710 is a reply to message #1771700] |
Tue, 29 August 2017 18:57 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
More generally, it sounds like all
self.references->includesAll(self.indirections.reference2) (ex: self.levels->includesAll(self.memberships.currentLevel ) )
don't work.
Same with
self.indirects.reference->includes(self.reference)
( ex : self.programs.levels->includes(self.currentLevel) ) in the RandL example.
And also:
self.participants.cards.Membership->includes(self) (two indirections)
I am confused. Does anyone encounter the same kind of issue ? Is there a test suite on that matter ?
Could it be because the self is a root object and references point out to other root objects ?
Maybe an inconsistency in the EOpposite could generate this behavior ? (The XMI in the Notepad show filled up field but the Recursive Ecore model view don't...)
[Updated on: Tue, 29 August 2017 19:15] Report message to a moderator
|
|
|
|
Re: includesAll fails [message #1771716 is a reply to message #1771714] |
Tue, 29 August 2017 19:52 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
Quote:For the one repro you provided earlier, I investigated and the results was correct since your model content was perhaps not what you expected.
Quote:Once loaded successfully I see one validation error, which the Validity View allows me to debug, clearly showing different Earning instances.
I still don't know what the "different Earning instances" means..
If the model is not what I expect, I gave here all the material I have : metamodel in Ecore, OCL rules, and specific model with the precise error showing up.
What I did next is to mention that this is not an isolated case and that I am concern about how EMF/OCL deals with references when there is more than one root object. Which might be caused by my mistake. The "earning instances" comment gave me some hope though.
Quote:Use the hover text over operators to see whether you expressions are what you expect. The hover I could get points out sometimes a "null" when the text behind (the actual file) shows a value (a id-reference).
If you have the screenshot of the debugger you mentionned, I'd appreciate seeing it.
Sorry if it is nebulous, I am stuck right now, any hint might help.
Thanks for your consideration,
Edouard
|
|
|
|
|
|
|
Re: includesAll fails [message #1771815 is a reply to message #1771785] |
Wed, 30 August 2017 20:18 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
Thank you very much.
It doesn't solve my problem, but it shone some precious light on the engineering happening behind the "Eclipse" tooling.
Detecting bad XMI is too broad to be the descrpton here. But focusing on detecting inconsistency in the EOpposites could be usefull because it is then hdden when manipulating the models. [edit: My bad, this is exactly what is on the bug report ! Good job :) ]
Thanks again !!
[Updated on: Wed, 30 August 2017 20:19] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07274 seconds