[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt] [Epsilon] Problem with ECL

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?