[Epsilon] Problem with ECL [message #617618] |
Tue, 13 May 2008 14:17 |
Eclipse User |
|
|
|
Originally posted by: ste_barr.cs.concordia.ca
Hello,
I'm trying to use ECL to help with some model merging. Unfortunately I'm
stuck.
My left model consits of a single class A, and the right a single class B.
I'm using the follow code (class.ecl) to compare them and print out the
match trace:
rule ClassA
match l : Left!Class with r : Right!Class {
compare : l.name = 'A' }
rule ClassB
match l : Left!Class with r : Right!Class {
compare : l.name = 'B' }
post {
-- Print name of matching elements and of the rule that matched them.
for (m in matchTrace.matches.select(m|m.isMatching)) {
(m.left.name + ' <' + m.getRule().name + '> ' +
m.right.name).println();
}
}
I think that the four element pairings should cause each rule to fire
once, so the output is a surprise to me:
A <ClassA> A
A <ClassA> B
Where are the B to A, B to B pairings? Why did rule ClassA match A with B?
And why does the second rule never fire?
I can't help put think that I'm missing something really basic here, but I
have spent a bit of time trying to unravel this. Thanks for taking a look.
--Steve
P.S. I couldn't get "m.rules.first().name" as given in the Complete OO to
DB comparison to work, which is why I'm using "m.getRule().name" Could
this be a source of trouble?
|
|
|
Powered by
FUDForum. Page generated in 0.02545 seconds