Home » Modeling » Epsilon » ECL comparision on collections(Comparing OrderedSet or Bag give the same result)
ECL comparision on collections [message #1795560] |
Tue, 25 September 2018 09:45 |
Gianluigi Proserpio Messages: 30 Registered: November 2015 |
Member |
|
|
Hi Dimitris,
I'm working with ECL on the comparisions of two xml files based on the same xsd that differs only in the order of a TDOI type element contained in a LN0Type element.
In one xml file I have:
<LN0 desc="General">
<DOI name="Beh">
</DOI>
<DOI name="Mod">
</DOI>
<DOI name="Health">
</DOI>
</LN0>
and in the second one I have;
<LN0 desc="General">
<DOI name="Mod">
</DOI>
<DOI name="Beh">
</DOI>
<DOI name="Health">
</DOI>
</LN0>
I expected that transforming in Bag the collections in input to matches() the result was a true matching, instead I get False as reported in the attached image
I also try to put true in the TDOI rule compare in order to watch how many times this rules was called with Bag, and I get only 3 times as reported in this picture
A second starnge behviour is related to getting differents results after calling very similar instructions against two identical xml files :
l.dOI.asBag().matches(r.dOI.asBag());
r.dOI.asBag().matches(l.dOI.asBag());
One instruction give 1 false the other 3 True matching, shouldn't give the same matching results ?
Could you give some help on this ?
Thanks,
Gianluigi
-
Attachment: ecl-1.png
(Size: 60.22KB, Downloaded 501 times) -
Attachment: ecl-2.png
(Size: 86.43KB, Downloaded 520 times) -
Attachment: ecl-3.png
(Size: 81.11KB, Downloaded 532 times)
[Updated on: Tue, 25 September 2018 14:09] Report message to a moderator
|
|
| | | |
Re: ECL comparision on collections [message #1795701 is a reply to message #1795655] |
Thu, 27 September 2018 05:51 |
Gianluigi Proserpio Messages: 30 Registered: November 2015 |
Member |
|
|
Hi Sina,
I'm loading a minimal example that I hope could help to better identify my problem.
-Epsilon version is Epsilon Core 1.6.0.201809191410
- In the attached project I create a "mymodel.model" based on "mymetamodel.ecore" (generate from .emf) by "createInstance.eol".
- The resulting "mymodel.model" was then copied in both "Righ.model" and "Left.model," so we have two identical models both containing 1 instance of TLN class that contains 3 instance of DOI class
- Comparing these two models by "CompareInstance.ecl", give me different result enabling one of the two instructions:
-l.dOI.matches(r.dOI);
-r.dOI.matches(l.dOI);
With l.dOI.matches(r.dOI); I get
# TDOI-l:tdoi-1 <-> TDOI-r:tdoi-1 # TDOI-l:tdoi-2 <-> TDOI-r:tdoi-2 # TDOI-l:tdoi-3 <-> TDOI-r:tdoi-3
Match:true - TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1] <-> TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1]
With r.dOI.matches(l.dOI); I get
Match:false - TDOI [any=[], anyAttribute=[], desc=, group=[], accessControl=tdoi-1, ix=0] <-> TDOI [any=[], anyAttribute=[], desc=, group=[], accessControl=tdoi-1, ix=0]
Match:true - TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1] <-> TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1]
I never get a true matching on TDOI instances as I'm excpeting because the two models are identical.
Let me know if you need more details.
Thanks,
Gianluigi
-
Attachment: test-ecl.zip
(Size: 5.80KB, Downloaded 112 times)
|
|
| | | | | | | | | | | |
Re: ECL comparision on collections [message #1797142 is a reply to message #1797056] |
Fri, 26 October 2018 08:37 |
Gianluigi Proserpio Messages: 30 Registered: November 2015 |
Member |
|
|
Hi Sina,
I'll try to better explain my question.
The "post" section in the example print only 1 match that is related to "the rule TLN"
Match:true - TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1] <-> TLN [any=[], anyAttribute=[], desc=, text=text, text1=text1]
and I haven't any information about the matches of TDOI objects taht are implicitly evaluated for the validation of TLN object (by the "TAnyLN rule").
So it seems that if I didn't remove the @lazy from the "rule TDOI_lr" I haven't any match related to the TDOI class to analyze.
But if I remove the lazy option, I need to analyze all the TDOI instances and not only the ones that TLN refers to.
Thanks,
Gianluigi
|
|
| | | | |
Goto Forum:
Current Time: Fri Apr 26 11:52:08 GMT 2024
Powered by FUDForum. Page generated in 0.04876 seconds
|