Re: [rules-users] Maps in Drools

2009-08-21 Thread Edson Tirelli
Andre, The misunderstanding here is that the LHS, except for code blocks like eval, return value expressions and accumulate code blocks, are all Drools Language. When you use the dialect attribute in a rule or package you are telling the compiler what dialect (MVEL or Java) you will use

Re: [rules-users] Maps in Drools

2009-08-21 Thread Edson Tirelli
2009/8/20 André Thieme address.good.until.2009.dec...@justmail.de Would there not be an addition to the syntax needed, for the default rule language? For mvel it would not require a change I guess. No, as I mentioned to you, the idea is for the DRL to remain the same, so that the rules author

Re: [rules-users] Maps in Drools

2009-08-21 Thread André Thieme
Edson Tirelli schrieb: Andre, The misunderstanding here is that the LHS, except for code blocks like eval, return value expressions and accumulate code blocks, are all Drools Language. When you use the dialect attribute in a rule or package you are telling the compiler what

Re: [rules-users] Maps in Drools

2009-08-21 Thread André Thieme
Edson Tirelli schrieb: 2009/8/20 André Thieme address.good.until.2009.dec...@justmail.de mailto:address.good.until.2009.dec...@justmail.de Would there not be an addition to the syntax needed, for the default rule language? For mvel it would not require a change I guess. No,

Re: [rules-users] Maps in Drools

2009-08-20 Thread André Thieme
Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end Okay, so in the mvel syntax this is possible. Can this also be achieved in the default rule syntax, without mvel? The mvel syntax

Re: [rules-users] Maps in Drools

2009-08-20 Thread André Thieme
Edson Tirelli schrieb: So, in principle having Maps support in the LHS is not a big challenge? No. Just requires developing a set of classes to work with maps. Being brief: * Implement: MapObjectType extends ObjectType * Implement: MapReadAccessor and MapWriteAccessor * Add support

Re: [rules-users] Maps in Drools

2009-08-20 Thread Mark Proctor
André Thieme wrote: Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end We default to MVEL, because it's simple and already contains everything we need for expression

Re: [rules-users] Maps in Drools

2009-08-20 Thread André Thieme
Mark Proctor schrieb: André Thieme wrote: Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end We default to MVEL, because it's simple and already contains everything

Re: [rules-users] Maps in Drools

2009-08-19 Thread KDR
Thanks again Edson. I'd just used a String object to try a simple test but of course your example makes a lot more sense. And thanks also for clarifying that there's full syntax support in the latest mvel jar version. I know this is a Drools rather Java list but as I'm new to both, may I ask

Re: [rules-users] Maps in Drools

2009-08-19 Thread André Thieme
Edson Tirelli schrieb: On the general issue, is it received wisdom that it's better not to insert map objects direct, at least for now until map support is fully there - or is it 6 of one / half a dozen? Maps are data structures, not Domain entities. When we speak about equivalence in

Re: [rules-users] Maps in Drools

2009-08-19 Thread André Thieme
Edson Tirelli schrieb: when Customer( $custId : id ) DailyOrders( count[$custId] == 1 ) then Btw, this brings me to a new syntax question for the default Drools rule syntax. Is this possible: when m:Map() eval( m.get(type) == Point, $x :

Re: [rules-users] Maps in Drools

2009-08-19 Thread Edson Tirelli
I will skip the first half of your e-mail as I am not sure what were the reasons for your nit-picking. If my explanation was not helpful for the public it was intended to, you are welcome to explain yourself. Regarding the part that matters, i.e., adding the support to other fact types,

Re: [rules-users] Maps in Drools

2009-08-19 Thread André Thieme
Edson Tirelli schrieb: I will skip the first half of your e-mail as I am not sure what were the reasons for your nit-picking. If my explanation was not helpful for the public it was intended to, you are welcome to explain yourself. Oh, I did not intend it to sound like nit-picking. I

Re: [rules-users] Maps in Drools

2009-08-19 Thread Edson Tirelli
ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end 2009/8/19 Edson Tirelli tire...@post.com when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, x == $x ) then end 2009/8/19

Re: [rules-users] Maps in Drools

2009-08-18 Thread Edson Tirelli
Yes, that was a bug that was fixed in newer versions of MVEL. Just update your MVEL jar to 2.0.12. []s Edson 2009/8/18 André Thieme address.good.until.2009.dec...@justmail.de KDR schrieb: Hi, I'm relatively new to both Java and Drools. I'm trying to figure out how to use maps in

Re: [rules-users] Maps in Drools

2009-08-18 Thread KDR
Apologies, I should have given the error message I get with $m: Map( this[$str] == 1 ) and also with $m: Map( this.$str == 1 ) - org.drools.RuntimeDroolsException: Exception executing predicate this[$str] == 1 and lots more lines followed by - Caused by: [Error: unable to resolve method:

Re: [rules-users] Maps in Drools

2009-08-18 Thread KDR
Many thanks for your replies André and Edson. For some reason they hadn't shown up on my computer before I posted my follow up info. I'll download the updated jar and cross my fingers! On the general issue, is it received wisdom that it's better not to insert map objects direct, at least for