Hi again Wolfgang:

Thank you for your quick answer. getFactHandle is the method I needed.

Concerning the second question, I'm using Drools 5.1.1 and yes, I imported AlarmFact. Below you can find the relevant lines of the drl file, in which the 'real name' of AlarmFact is MDSVHechoAlarma:

#created on: 14-mar-2011
package es.simcasva.alarmas.rules

#list any import classes here.

//......
import es.simcasva.alarmas.src.MDSVHechoAlarma;
//......



#declare any global variables here

//......

query "existe Alarma"  (MDSVHechoAlarma referencia)
    $alarma : MDSVHechoAlarma(   iIdAlarma == referencia.iIdAlarma, 
                   strAgrup1 == referencia.strAgrup1,
                   strAgrup2 == referencia.strAgrup2,
                   strAgrup3 == referencia.strAgrup3,
                   strAgrup4 == referencia.strAgrup4,
                   strAgrup5 == referencia.strAgrup5,
                   strAgrup6 == referencia.strAgrup6,
                   strAgrup7 == referencia.strAgrup7,
                   strAgrup8 == referencia.strAgrup8,
                   strAgrup9 == referencia.strAgrup9,
                   strAgrup10 == referencia.strAgrup10
                   )

end

The reported errors are:

Description Resource Path Location Type
BuildError: Not possible to directly access the property 'iIdAlarma' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup1' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup10' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup2' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup3' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup4' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup5' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup6' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup7' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup8' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Not possible to directly access the property 'strAgrup9' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.iIdAlarma ]' for field 'iIdAlarma' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 185 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup1 ]' for field 'strAgrup1' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 186 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup10 ]' for field 'strAgrup10' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 195 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup2 ]' for field 'strAgrup2' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 187 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup3 ]' for field 'strAgrup3' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 188 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup4 ]' for field 'strAgrup4' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 189 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup5 ]' for field 'strAgrup5' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 190 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup6 ]' for field 'strAgrup6' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 191 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup7 ]' for field 'strAgrup7' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 192 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup8 ]' for field 'strAgrup8' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 193 Drools Error
BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup9 ]' for field 'strAgrup9' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 194 Drools Error

Thank you very much for your time, Wolfgang.

Best regards,

Manuel Ortiz.


2011/4/29 Wolfgang Laun <wolfgang.laun@gmail.com>
You can call
  FactHandle fh = kSession.getFactHandle( factObj );


   query "alarmExists"  (AlarmFact key)
should work in 5.1.1 and 5.2. Did you import AlarmFact in the DRL? Otherwise, what message are you getting in which version?

-W

2011/4/29 Manuel Ortiz <manuel.ortizramos@gmail.com>
Hello everybody:

I have two question related to queries:

First one, the one in the subject, I have a query which retrieves facts which have to be modified and updated in working memory. I've seen that the StatefulKnowledgeSession.update() method has the fact handle as input. Is it possible to set the fact handle to null? If it isn't, how can I get the fact handle using the fact retrieved with the query?

Second one, related to writing, I though of parameterizing the query using the fact pattern, something like this, 

query "alarmExists"  (AlarmFact key)
    $alarm : AlarmFact(key1 == key.key1,
                   key2 == key.key2,
                   key3 == key.key3
                   )

end



but the rule compiler doesn't accept this sintax. Is it a requirement that query parameters are basic java types or is there a way to write this query using more complex Object parameters?

Thank you for your time.

Best Regards,

Manuel Ortiz.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users