Re: [rules-users] setting different value in consequence ( RHS part) based on a conditional check

2012-01-27 Thread FrankVhh
Hi Wolfgang,

Can I push you for a clarification on this statement?

Imho, any of the following reasons is good enough to put a decision in
rules
A- The decision logic is likely to be subject to change
B- The decision logic is too complex to implement in a procedural way
C- The decision logic is making sense to business users. (i.e.
non-technical logic)

In this case, option B is opviously way off. But one can only guess
regarding A and C.

Regards,
Frank


laune wrote
 
 Oh my, aren't we a wee bit too dogmatic? I've certainly been known as
 being
 a stickler to style and best practice and what not, but in this particular
 case I'd use a single rule and offload the earth-shaking decision between
 'Y' and 'N' into a function:
 
 rule x
 when
samplefact1( $status: status, state == CA )
 then
fact0.setField1(  yn( $status)  );
 end
 
 Cheers
 -W
 ___
 rules-users mailing list
 rules-users@.jboss
 https://lists.jboss.org/mailman/listinfo/rules-users
 


--
View this message in context: 
http://drools.46999.n3.nabble.com/setting-different-value-in-consequence-RHS-part-based-on-a-conditional-check-tp3690826p3692750.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] setting different value in consequence ( RHS part) based on a conditional check

2012-01-27 Thread Esteban Aliverti
Did I just heard Wolfgang complaining about being too dogmatic??? After all
maybe the Mayans were right :)
By the way, Vadlam,  did you try using a template rule in Guvnor?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Fri, Jan 27, 2012 at 10:10 AM, FrankVhh frank.vanhoensho...@agserv.euwrote:

 Hi Wolfgang,

 Can I push you for a clarification on this statement?

 Imho, any of the following reasons is good enough to put a decision in
 rules
A- The decision logic is likely to be subject to change
B- The decision logic is too complex to implement in a procedural way
C- The decision logic is making sense to business users. (i.e.
 non-technical logic)

 In this case, option B is opviously way off. But one can only guess
 regarding A and C.

 Regards,
 Frank


 laune wrote
 
  Oh my, aren't we a wee bit too dogmatic? I've certainly been known as
  being
  a stickler to style and best practice and what not, but in this
 particular
  case I'd use a single rule and offload the earth-shaking decision between
  'Y' and 'N' into a function:
 
  rule x
  when
 samplefact1( $status: status, state == CA )
  then
 fact0.setField1(  yn( $status)  );
  end
 
  Cheers
  -W
  ___
  rules-users mailing list
  rules-users@.jboss
  https://lists.jboss.org/mailman/listinfo/rules-users
 


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/setting-different-value-in-consequence-RHS-part-based-on-a-conditional-check-tp3690826p3692750.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 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


Re: [rules-users] java.lang.ArrayIndexOutOfBoundsException at Frame

2012-01-27 Thread shoonya
@Mujoko

Are you able to solve this ?
I am also facing similar exception
(Using decision table to generate drl, also this is working on my local
machine, but failing on production)

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-java-lang-ArrayIndexOutOfBoundsException-at-Frame-tp3668715p3693158.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Declarative agenda final API

2012-01-27 Thread paw...@gmail.com
I thought of using declarative agenda because for each fact I would like to
know all potential rules which it could activate but I want finally to fire
(execute RHS) only for the rule with highest priority.
 
Thanks to adding rule with @activationListener(‘direct’) I am able to block
all rules, add them to some list and later unblock and execute rule only the
highest priority.

Do you think I can use some other Drools API, features to achieve this kind
of behaviour?

Is it possible to unblock rule based on salience? (something like: when $a :
Activation(*salience * $value) then unblock)

Thanks,

Marcin

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Declarative-agenda-final-API-tp3684502p3693182.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

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


Re: [rules-users] Declarative agenda final API

2012-01-27 Thread paw...@gmail.com
I was able to achieve earlier described logic by adding AgendaEventListener
with activationCreated and afterActivationFired to knowledge session. 

About Activation: it looks like in org.drools.runtime.rule.Activation there
is no salience however it is in org.drools.spi.Activation. For delarative
agenda API org.drools.runtime.rule.Activation needs to be used so my
question how to filter Activations based on salience is still valid.

Thanks,

Marcin

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Declarative-agenda-final-API-tp3684502p3693555.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] AUTO MIGRATION Error when creating a new rule package

2012-01-27 Thread the_ricker
Should I post a bug for this issue?

--
View this message in context: 
http://drools.46999.n3.nabble.com/AUTO-MIGRATION-Error-when-creating-a-new-rule-package-tp3685532p3693934.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] AUTO MIGRATION Error when creating a new rule package

2012-01-27 Thread Michael Anstis
Can you wait until next week?

Jervis Liu is normally our JCR expert but he's on vacation at the moment.

I'm not sure if it's a bug rather a problem with the Configurator (I don't
know TBH) that might need to do more work.

Jervis would have a better idea (I hope) and therefore whether this is a
bug in Guvnor.

Cheers,

Mike

On 27 January 2012 17:28, the_ricker jeffrey.ric...@ifs.statestreet.comwrote:

 Should I post a bug for this issue?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/AUTO-MIGRATION-Error-when-creating-a-new-rule-package-tp3685532p3693934.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 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


Re: [rules-users] setting different value in consequence ( RHS part) based on a conditional check

2012-01-27 Thread Wolfgang Laun
Hello Frank,

there is nothing wrong with your reason A and B. But the decision
what to include in the decision logic is an engineering decision,
and in engineering you always have a certain leeway within the
margin set by mathematical or natural laws. Is maintenance
easier if you have 2 rules where there is absolutely no
decision in RHS code or is it better to have one rule plus a simple
mapping function? What if this distinction must be made in a
number of rules so that you have 2*n compared to n plus one
function?

As for C, I just don't know how you envisage a business user and
his or her capabilities. Understanding rules that go beyond the
noncommittal there is a thing with property X equal to x and
property Y equal to y is not something a layman can be expected
to have at his fingertips. But, assuming this business user can
read logic: there is not good reason why he or she shouldn't be
able to understand a simple functional mapping.

Cheers
Wolfgang


On 27/01/2012, FrankVhh frank.vanhoensho...@agserv.eu wrote:
 Hi Wolfgang,

 Can I push you for a clarification on this statement?

 Imho, any of the following reasons is good enough to put a decision in
 rules
 A- The decision logic is likely to be subject to change
 B- The decision logic is too complex to implement in a procedural way
 C- The decision logic is making sense to business users. (i.e.
 non-technical logic)

 In this case, option B is opviously way off. But one can only guess
 regarding A and C.

 Regards,
 Frank


 laune wrote

 Oh my, aren't we a wee bit too dogmatic? I've certainly been known as
 being
 a stickler to style and best practice and what not, but in this particular
 case I'd use a single rule and offload the earth-shaking decision between
 'Y' and 'N' into a function:

 rule x
 when
samplefact1( $status: status, state == CA )
 then
fact0.setField1(  yn( $status)  );
 end

 Cheers
 -W
 ___
 rules-users mailing list
 rules-users@.jboss
 https://lists.jboss.org/mailman/listinfo/rules-users



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/setting-different-value-in-consequence-RHS-part-based-on-a-conditional-check-tp3690826p3692750.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 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


[rules-users] using Globals in LHS (not using eval)

2012-01-27 Thread domingo
Hi, 
Thanks for your time,
Can I use Globals in LHS without using in eval block? I search the forum no
info available.most of them direct me to use eval but i dont want to use
eval. Is it possible in 5.4? please let me know if there is a way to
accomplish this..
thanks,

-
with kind regards,

--
View this message in context: 
http://drools.46999.n3.nabble.com/using-Globals-in-LHS-not-using-eval-tp3694366p3694366.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] setting different value in consequence ( RHS part) based on a conditional check

2012-01-27 Thread vadlam
Esteban,

we already have several scores of rules in place. the requirment is to
change the rule(s)  in such a way as to keep it minimal and still achieve
the result expected.

having to write additional rules would be the last option.

hence, I was more interested  in using a function if I could.

eventually, we decided to add a new rule( just one)  that comes later in the
ruleflow so as to update all matching facts with the status.

This leaves all the scores of rules in place untouched and updates the
matching facts in one rule .

as per the business needs and ruleflow, this seemed the best solution.


--
View this message in context: 
http://drools.46999.n3.nabble.com/setting-different-value-in-consequence-RHS-part-based-on-a-conditional-check-tp3690826p3694682.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor Global Area Usage Restirictions

2012-01-27 Thread domingo
I imported some pakages into Guvnor and I want to put it into Global Area.
The following are my observation...
1. Import action create new package into *'Packages' *section do not have
option like want to put *Global Area* or *Packages*.
2. After import into Packages I want to move the packages to Global Area but
package level is not possible.
3. To move my  rules files into Global area..I have to open the individual
rules then only Edit menu shows the Promote to Global option.

If I have 20 or 30 rules in the package I have to the same thing 30 times.
It is very timetaking and think not good idea. what happen If have 30
packages and each package having 30 rules.

I am not sure I am using *Guvnor5.3* effectively or not. *In the
documentation(Guvnor5.3) I noticed two lines only about the Global
area.*Please some one can guide me.

-
with kind regards,

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Global-Area-Usage-Restirictions-tp3694809p3694809.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Global Area Usage Restirictions

2012-01-27 Thread Michael Anstis
Are you importing DRL packages? If the ability to import DRL to global is
missing it sounds a reasonable enhancement. Therefore, if my comments are
correct please raise a Guvnor JIRA otherwise please explain a little more.

sent on the move

On 27 Jan 2012 23:00, domingo sprabak...@gmail.com wrote:

 I imported some pakages into Guvnor and I want to put it into Global Area.
 The following are my observation...
 1. Import action create new package into *'Packages' *section do not have
 option like want to put *Global Area* or *Packages*.
 2. After import into Packages I want to move the packages to Global Area
 but
 package level is not possible.
 3. To move my  rules files into Global area..I have to open the individual
 rules then only Edit menu shows the Promote to Global option.

 If I have 20 or 30 rules in the package I have to the same thing 30 times.
 It is very timetaking and think not good idea. what happen If have 30
 packages and each package having 30 rules.

 I am not sure I am using *Guvnor5.3* effectively or not. *In the
 documentation(Guvnor5.3) I noticed two lines only about the Global
 area.*Please some one can guide me.

 -
 with kind regards,

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-Global-Area-Usage-Restirictions-tp3694809p3694809.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 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


Re: [rules-users] bytecode representation of rules

2012-01-27 Thread Edson Tirelli
   Tough question to answer as not everything in a DRL file becomes
bytecode, and not all in the same place. For instance, rule consequences
and other semantic code blocks, when using the java dialect, will become a
class that is code generated and compiled in memory. You can see that code
by setting the dump dir option in the KnowledgeBuilderConfiguration object
(or -Ddrools.dump.dir=path on the command line).

   Constraints on the other hand will become a mix of JIT bytecode and/or
MVEL expressions and/or object accessors, depending on several factors.
Since they are shared among multiple rules, they don't belong to a single
rule in particular, but become part of the Rete network, that is basically
an in-memory data structure.

   Not exactly sure if this helps you...

   Edson

2012/1/26 Mainul Raju mainul.r...@yahoo.com



 Hello All:

 I have been trying to get the byte code representation of rules (.drl
 files). I would appreciate it if anyone could kindly provide me any way to
 do that.

 I have created a rule based application with 100 rules in 5 different .drl
 files. My intention is to analyze the application with some byte code
 analyzer (i.e. soot). For the purpose of hat static analysis, I need the
 byte-code representation of rules which I can't get from drools.

 Thanks in advance.
 //
 Mainul

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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] query created in guvnor 5.3.0.final does not return expected results

2012-01-27 Thread vadlam
I have created a query in guvnor 5.3  in a separate drl file as follows. 

query get total Documents created

document : Document( )

end 

I have several rules that create Documents as part of the ruleflow. 


 on the java side

 ksession.fireAllRules(new RuleFilter());  // the rulefilter does not really
do anything except log the 
   //rules   
executing

  org.drools.runtime.rule.QueryResults results =
ksession.getQueryResults(get total Documents created);
System.out.println( we have  + results.size() +
Documents );

I see that the returned results size is 0

but the following code returns the documents as expected.

 Collection responseObjects = ksession.getObjects();

is there anything I am missing with respect to the query ? I use a ruleflow
. does the query need to be part of any of the ruleflowgroups within the
ruleflow ?

is there a way to know whether the query ran or not ?



--
View this message in context: 
http://drools.46999.n3.nabble.com/query-created-in-guvnor-5-3-0-final-does-not-return-expected-results-tp3695002p3695002.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Planner has trouble creating a configurer: how to debug

2012-01-27 Thread aitchnyu
I tried to create a solver from XML configuration. But the entire process
returns a *cryptic error message *that makes no sense.

How do I fix this? And how can I make sense of this to actually solve
similar problems like this? 

Please excuse me if I made any bad karma. This is my first post on this (and
any) mailing list.

jesvin@Jesvin-Technovia:~/dev/drools/sudoku$ java App 
Exception in thread main java.lang.NullPointerException
at
org.drools.planner.core.domain.solution.SolutionDescriptor.processPropertyAnnotations(SolutionDescriptor.java:69)
at
org.drools.planner.core.domain.solution.SolutionDescriptor.init(SolutionDescriptor.java:61)
at
org.drools.planner.config.solver.SolverConfig.buildSolutionDescriptor(SolverConfig.java:197)
at
org.drools.planner.config.solver.SolverConfig.buildSolver(SolverConfig.java:167)
at
org.drools.planner.config.XmlSolverConfigurer.buildSolver(XmlSolverConfigurer.java:103)
at App.createSolver(App.java:62)
at App.main(App.java:40)

The function that throws it is listed here. The line is of course `return
configurer.buildSolver();`.

private static Solver createSolver(){
XmlSolverConfigurer configurer = new XmlSolverConfigurer();
File file = new File(solver.xml);
FileInputStream fin = null;
try{
fin = new FileInputStream(file);
}
catch(IOException e){
 System.out.println(Unable to read drl);
}
configurer.configure(fin);
//configurer.configure(/home/jesvin/dev/drools/sudoku/solver.xml);
return configurer.buildSolver();
}

The content of the XML:

?xml version=1.0 encoding=UTF-8?
solver
  environmentModeDEBUG/environmentMode

  solutionClassdomain.Sudoku/solutionClass
  planningEntityClassdomain.Digit/planningEntityClass
  scoreDrlscore.drl/scoreDrl
  scoreDefinition
scoreDefinitionTypeSIMPLE/scoreDefinitionType
  /scoreDefinition

  termination
scoreAttained0/scoreAttained
  /termination
  
  constructionHeuristic
constructionHeuristicTypeFIRST_FIT/constructionHeuristicType

  moveFactoryClasssolution.RowChangeMoveFactory/moveFactoryClass
/selector
acceptor
  completeSolutionTabuSize1000/completeSolutionTabuSize
/acceptor
forager
  
/forager
  /localSearch
/solver

--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-has-trouble-creating-a-configurer-how-to-debug-tp3695307p3695307.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] bytecode representation of rules

2012-01-27 Thread Mainul Raju


Thanks a lot. At least we are on the same track :). 

I already dumped it into a directory and It gives me all generated .java files. 
At this point, trying to figure out some ways around for static analysis on 
rules by using SOOT. No luck yet :( . 

Thanks again for your informative response.
 
--
Mainul



 From: Edson Tirelli ed.tire...@gmail.com
To: Rules Users List rules-users@lists.jboss.org 
Sent: Friday, 27 January 2012, 17:35
Subject: Re: [rules-users] bytecode representation of rules
 


   Tough question to answer as not everything in a DRL file becomes bytecode, 
and not all in the same place. For instance, rule consequences and other 
semantic code blocks, when using the java dialect, will become a class that is 
code generated and compiled in memory. You can see that code by setting the 
dump dir option in the KnowledgeBuilderConfiguration object (or 
-Ddrools.dump.dir=path on the command line). 

   Constraints on the other hand will become a mix of JIT bytecode and/or MVEL 
expressions and/or object accessors, depending on several factors. Since they 
are shared among multiple rules, they don't belong to a single rule in 
particular, but become part of the Rete network, that is basically an in-memory 
data structure.

   Not exactly sure if this helps you...

   Edson


2012/1/26 Mainul Raju mainul.r...@yahoo.com

 



Hello All:


I have been trying to get the byte code representation of rules (.drl files). 
I would appreciate it if anyone could kindly provide me any way to do that.
 
I have created a rule based application with 100 rules in 5 different .drl 
files. My intention is to analyze the application with some byte code analyzer 
(i.e. soot). For the purpose of hat static analysis, I need the byte-code 
representation of rules which I can't get from drools.


Thanks in advance.
//Mainul

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




-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com

___
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


Re: [rules-users] query created in guvnor 5.3.0.final does not return expected results

2012-01-27 Thread Wolfgang Laun
You'd get this result even when there's no query with the name string
you use in the API call.
(1) Make sure that the name is correct.
(2) Make sure that there is a query with that name, e.g., by inspecting the
 session's knowledge base at runtime.

-W


On 28/01/2012, vadlam sreeram.vadlam...@wellsfargo.com wrote:
 I have created a query in guvnor 5.3  in a separate drl file as follows.

 query get total Documents created

 document : Document( )

 end

 I have several rules that create Documents as part of the ruleflow.


  on the java side

  ksession.fireAllRules(new RuleFilter());  // the rulefilter does not really
 do anything except log the
//rules
 executing

   org.drools.runtime.rule.QueryResults results =
 ksession.getQueryResults(get total Documents created);
 System.out.println( we have  + results.size() +
 Documents );

 I see that the returned results size is 0

 but the following code returns the documents as expected.

  Collection responseObjects = ksession.getObjects();

 is there anything I am missing with respect to the query ? I use a ruleflow
 . does the query need to be part of any of the ruleflowgroups within the
 ruleflow ?

 is there a way to know whether the query ran or not ?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/query-created-in-guvnor-5-3-0-final-does-not-return-expected-results-tp3695002p3695002.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 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