views:

243

answers:

2

I am fairly new to drools and I'm running into some issues I can't really understand. I'm trying to solve an allocation problem and one of my LHS goes like this

$leftAlloc: SlotAllocation($leftRes: resource )
$rightAlloc: SlotAllocation(this != $leftAlloc, resource == $leftRes)

for some reason the second statement does not match anything even thou I'm sure there is a match in the working memory. If I change the code above with the following it works fine

$leftAlloc: SlotAllocation($leftRes: resource )
$rightAlloc: SlotAllocation(this != $leftAlloc, eval(resource == $leftRes))

Can anybody explain this to me?

Thanks!

A: 

Does anyone have a clue about this? I thought it might be a problem related to interfaces ( resource is an interface type ) and the actual object that is an implementation of that interface but changing everything to object didn't help.

Any help will be appreciated!

Thanks

mericano1
A: 

You're probably better off asking this question on the drools user mailing list (use a newsgroup reader to connect to news.gmane.org if you don't want to litter your mailbox).

As for your question: that's really strange. I see only one improbable explanation. First you should know that ", resource == $leftRes)" in the DRL will actually call getResource().equals($leftRes), so it's not a same/pointer check but an equals check. On the other hand, "eval(resource == $leftRes)" will use a same/pointer check. So that improbably theory is that your Resource class overwrites the Object.equals method and doesn't even return true when it's the same instance...

PS: Continue this discussion on the user mailing list if you have further questions and you want those answered too.

Geoffrey De Smet
Thanks for your answer Geoffrey, I tried to get access to the drools user mailing list on nabble but I think they are moving from nabble 1.0 to 2.0 and I've never been accepted?Anyway about the problem i was in contact with jboss and they are looking into that. I know the different between eval and == and I was stepping thru the code and the equals method does not get called at all!BTW - I'm using your solver and I really like. We might have to extend it a bit (branch and bound?) If that happens I'll definitely try to get in touch with you if you want to include it in the main trunk
mericano1