Here are my rules:
#created on: 29/10/2007
package br.ufpr.ti.identkit.rules
#list any import classes here.
import br.ufpr.ti.identkit.entity.*
#the package " br.ufpr.ti.identkit.entity.* " has the class
TipoCaracteristica and the class TipoMolde
import br.ufpr.ti.identkit.ia.Especialista
import java.util.List
import java.util.LinkedList
import java.util.ArrayList
rule "POSSUI_CARACTERISTICA_MARCANTE Resposta nao"
salience 95
when
e : Especialista(perguntado == false)
Especialista( $retrato : retratoUser)
Retrato($lstCaracRetrato : lstCarac) from $retrato
Retrato($lstMolde : lstMolde) from $retrato
Molde(tipoMolde.codTipMolde == TipoMolde.CABELO && $lstCaracMolde:
lstCarac) from $lstMolde
//CABELO_ENCOBERTO = 34
eval(naoPerguntou($lstCaracMolde, 34))
//TipoCaracteristica.POSSUI_CARACTERISTICA_MARCANTE == 33
//146 não possui caracteristica marcante
Caracteristica(tipCarac.codTipCarac == 33 && valor.codValor == 146)
from $lstCaracRetrato
then
buscarMontarPergunta(e,Pergunta.CABELO_ENCOBERTO,Especialista.CABELO
);
e.perguntado = true;
update(e);
end
How can I be sure that I'm with latest MVEL jar?
2007/10/31, Rahul Phadnis <rahul.phadnis(a)yahoo.com>:
Do you have an import statement for importing
TipoCaracteristica?
I see you are already using TipoMolde.CABELO which I
assume is another public static variable in the
TipoMolde class.
If none of these work can you post your drl file?
Rahul
--- Anderson Pazza Mello <payakahn(a)gmail.com> wrote:
> Yes I'm Brazilian....
> I need to improve my english I now hehehe
>
> About the problem... I solved it.
>
> But now I'm getting this error when I use a static
> property in the rules:
>
> Exception in thread "AWT-EventQueue-0"
> org.drools.RuntimeDroolsException:
> Exception executing predicate
> org.drools.base.mvel.MVELPredicateExpression@916f80
> at
> org.drools.rule.PredicateConstraint.isAllowed(
> PredicateConstraint.java:197)
> at
>
org.drools.reteoo.FromNode.assertTuple(FromNode.java:70)
> at
>
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(
> SingleTupleSinkAdapter.java:29)
> at
> org.drools.reteoo.EvalConditionNode.assertTuple(
> EvalConditionNode.java:150)
> at
>
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(
> SingleTupleSinkAdapter.java:20)
> at
>
org.drools.reteoo.FromNode.assertTuple(FromNode.java:87)
> at
>
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(
> SingleTupleSinkAdapter.java:20)
> at
>
org.drools.reteoo.FromNode.assertTuple(FromNode.java:87)
> at
>
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(
> SingleTupleSinkAdapter.java:20)
> at
>
org.drools.reteoo.FromNode.assertTuple(FromNode.java:87)
> .
> .
> .
>
> Caused by: org.mvel.PropertyAccessException: unable
> to resolve property:
> unable to resolve token:
> TipoCaracteristica.CABELO_TOTALMENTE_CALVO
> at
> org.mvel.ast.PropertyASTNode.initializePropertyNode(
> PropertyASTNode.java:86)
> at
>
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(
> PropertyASTNode.java:23)
> at
>
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(
> BinaryOperation.java:20)
> at
> org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
> at
>
org.mvel.CompiledExpression.getValue(CompiledExpression.java:99)
> at
> org.mvel.MVEL.executeExpression(MVEL.java:219)
> at
>
org.drools.base.mvel.MVELPredicateExpression.evaluate(
> MVELPredicateExpression.java:36)
> at
> org.drools.rule.PredicateConstraint.isAllowed(
> PredicateConstraint.java:191)
> ... 44 more
>
> Example:
>
> Property :
> public class TipoCaracteristica implements
> java.io.Serializable{
> .
> .
>
> public static int CABELO_TOTALMENTE_CALVO = 37;
> .
> .
> .
> }
>
> rule:
>
> rule "CABELO_TOTALMENTE_CALVO resposta nao / Chama
> Tipo de Cabelo"
> salience 90
> when
> e : Especialista(perguntado == false)
> Especialista( $retrato : retratoUser)
> Retrato($lstCaracRetrato : lstCarac) from
> $retrato
> Retrato($lstMolde : lstMolde) from $retrato
> Molde(tipoMolde.codTipMolde ==
> TipoMolde.CABELO && $lstCaracMolde:
> lstCarac) from $lstMolde
> //CABELO_TIPO = 10
> eval(naoPerguntou($lstCaracMolde, 10))
> //CABELO_TOTALMENTE_CALVO = 37 e
> RESPOSTA_SIM = 154
> Caracteristica(tipCarac.codTipCarac ==
> TipoCaracteristica.CABELO_TOTALMENTE_CALVO &&
> valor.codValor == 154) from
> $lstCaracMolde
> then
>
>
buscarMontarPergunta(e,Pergunta.CABELO_TIPO,Especialista.CABELO);
> e.perguntado = true;
> update(e);
> end
>
> I get some statics properties like
> "TipoMolde.CABELO" without errors, but I
> can't use the properties from this class
> (TipoCaracteristica). Did you know
> why?
> If I use de value like this "valor.codValor == 154",
> I have no problem.
>
> 2007/10/29, Edson Tirelli <tirelli(a)post.com>:
> >
> >
> > Anderson,
> >
> > What is the error? Can you provide a self
> contained example?
> > Using the "from CE" as showed before works.
> >
> > BTW, are you Brazilian? Your name sounds like
> a Brazilian name.
> >
> > []s
> > Edson
> >
> > 2007/10/27, Anderson Pazza Mello
> <payakahn(a)gmail.com>:
> > >
> > > How can I test all elements of the list?
> > > Can I need to use something like "for (int
> i.....)"?
> > >
> > > I'm trying to do that but it is not working...
> > >
> > > "Caracteristica( codCarac != 0 ) from
> $caracList"
> > >
> > >
> > >
> > > My test:
> > >
> > > e : Especialista (perguntado == false)
> > > Especialista( $moldeList :
> retratoUser.lstMolde )
> > > Molde( tipoMolde == TipoMolde.CABELO)
> from $moldeList
> > >
> > >
> > > When the property "tipoMolde ==
> TipoMolde.CABELO" the rule must to be
> > > fired. The List $moldeList has 5 elements.
> > >
> > > any idea?
> > >
> > >
> > > 2007/10/3, Edson Tirelli < tirelli(a)post.com>:
> > > >
> > > > Use the "from" CE:
> > > >
> > > > rule "This rule will fire once for each
> Caracteristica whose codCarac
> > > > is != 0"
> > > > when
> > > > Especialista( $caracList :
> retratoUser.lstCarac )
> > > > Caracteristica( codCarac != 0 ) from
> $caracList
> > > > then
> > > > ...
> > > > end
> > > >
> > > > []s
> > > > Edson
> > > >
> > > > 2007/10/3, Bhattacharya, Sougata <
> sougata.bhattacharya(a)capgemini.com
> > > > >:
> > > > >
> > > > > If I want to test for all ith element,
> > > > >
> > > > > Like this
> > > > >
> > > > >
> > > > >
> > > > > rule "Test"
> > > > >
> > > > > when
> > > > > e :
> Especialista(retratoUser.lstCarac.get(i).codCarac !=
> 0)
> > > > > then
>
=== message truncated ===>
_______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Anderson Pazza Mello
Tecnologia em Informática - UFPR