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 inside
these code blocks mentioned previously + the language for the RHS.
In other words:
Map( this["type"] == "Point", $x : this["x"], size == 5 )
Everything you see in the previous expression is "Drools language", does
not matter if you set the dialect to java or mvel in the rule. It happens
that Drools uses the same map syntax as MVEL (and a lot of other scripting
languages). Also, we know, that drools implementation will resolve the first
2 above expressions in MVEL behind the scenes, and the 3rd will be resolved
nativelly, but that is not something users should have to worry about, since
they are writing it in "Drools Language".
If they write an eval, THEN they need to differentiate between MVEL and
Java according to the chosen dialect.
rule xyz
dialect "mvel"
when
eval( ...here you write MVEL code... )
then
// here you write MVEL code
end
rule xyz2
dialect "java"
when
eval( ...here you write JAVA code... )
then
// here you write JAVA code
end
[]s
Edson
2009/8/20 André Thieme <address.good.until.2009.dec.14(a)justmail.de>
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 needs to be interpreted at runtime, so my Clojure lib
will have to output rules in Drools' native rule language.
What interests me most is that first part:
Map( this["type"] == "Point", $x : this["x"] )
André
--
Lisp is not dead. It’s just the URL that has changed:
http://clojure.org/
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com