app-dev 'toe in water' help please
by dhartford
Hey all,
I'm trying to dip some toes into the water with Drools, and have an
application that would be a good start but having some understanding/lacking
an appropriate example issue.
The application context, let's say, is Mortgages, and already using the
Mortgage rules that are stored in a running instance of Guvnor.
Going back to 'toe in water', lets assume that all 'facts' are loaded on
call (so nothing is pre-loaded, all data to run a rule is supplied at the
time the rule is called). This is to make it easier to get started without
jumping all-in just yet ;-)
Using the mortgage business rule 'CreditApproval' that is already loaded
into Guvnor, I can see passing the Application object, with the creditRating
field/fact to a rule.
However, instead of populating and returning a loanApplication object, how
would I return just the decision/end result of a rule if it was only one
value (the approved/not approved decision) from the java app? KnowledgeBase
is loaded from the java app, but struggling with StatefulKnowledgeSession
versus StatelessKnowledgeSession and how to simply get back the rule
decision value (again, preferably without a specific object if it is only
one value)?
I'm also looking to only fire/execute one rule at a time for now until we
get comfortable - any help for an app developer trying to ease their way
into drools?
Sorry if I not overly clear, still trying to learn the appropriate
terminology :-)
-Darren
--
View this message in context: http://drools.46999.n3.nabble.com/app-dev-toe-in-water-help-please-tp3249...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
working with version 5.0
by Oli Blub
hello,
i work with drools guvnor and expert version 5.0.0.
I hat the problem with stateless session in comibnation with rule flow
componentet.
So i use stateful session and build a second delete ruleflow to delete all
objects in memory. Is there a better solution?
I installed v. 5.2 but the import of the repository from 5.0 caused many
compilation problems. Is there a workaround?
I'm interested in working with GWT and fix some little bugs of Guvnor V 5.0.
Is there a good guidence to get started?
14 years, 5 months
What would you call a Fact that is only evaluated once?
by Mark Proctor
What would you call a fact that is inserted once and the conflict set
computed (the rules that can fire). The fact is then retracted so no
more matches can take place, but the conflict set itself is allowed to
fire (assuming their other facts remain true).
I think this is quite a common use case and most users will handle this
via a lower salience and retracting the fact manually, but I think it's
useful enough to build in as a keyword on type declaration. We just need
a name for it :)
Mark
14 years, 5 months
Error in Guvnor with Enumerations (5.1.1)
by John Peterson
Hi,
I'm trying to utilize a "load method" for Guvnor, but I can't seem to get it working. His is my DataHelper class (modeling it off the documentation):
package com.enumerations;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class DataHelper {
public List<String> getQuestionNumberList(){
ArrayList returnList = new ArrayList();
Iterator it = com.enumerations.DroolsTest.questionList.iterator();
while (it.hasNext()){
QuestionAndAnswer qAndA = (QuestionAndAnswer)it.next();
if (!returnList.contains(qAndA.getQuestionNumber())){
returnList.add((String)qAndA.getQuestionNumber());
}
}
return (List<String>)returnList;
}
}
I've placed this (both as a .jar and .class file) in my JBoss installation under \jboss-4.2.3.GA\server\default\deploy\drools-guvnor.war\WEB-INF\classes\com\enumerations.
Using this syntax as an enumeration in Guvnor:
'QuestionAndAnswer.questionNumber' : (new com.enumerations.DataHelper()).getQuestionNumberList()
I get the following errors:
[Enumerations] Unable to load enumeration data.
[Enumerations] [Error: failed to access property: getQuestionNumberList(): [Error: unable to invoke method: getQuestionNumberList] [Near : {... Unknown ....}] ^[Line: 1, Column: 0]][Near : {... r()).getQuestionNumberList() ....}] ^ [Line: 1, Column: 0]
[Enumerations] Error type: org.mvel2.PropertyAccessException
I am using Drools 5.1.1. Does anyone have any suggestions on what to do to correct this error?
jp
14 years, 5 months
Collect with same value
by wendy
Hi,
I'm trying to write the following rule but am having some trouble.
We have a object say Shape and which has attributes size and color. I
want to get a list of all shapes with the same color that have size > 5.
How can I make sure the color is the same for all objects in the collect
without having different rules for 'red', 'green'...?
Thank you,
Wendy
--
View this message in context: http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p32429...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
New Fact Role
by Isaac Pereira
Hi,
I would like to know if there's a way to add new role types without change
the drools core? The reason is to build a module that handles situations
(state of affairs) to support context aware systems. Situation would be the
new role and then adds all specific handling for this type of fact.
Thanks,
Isaac Pereira
14 years, 5 months
Drools Queries with relation to the LHS and RHS syntax of the rule
by Dibya
I have the below two requirement for Drools implementation.
1. To use a java method(with single argument) of my application class in the
'LHS' of the rule .
2. To pass the object set in 'RHS' of the rule back to my application.
Is it possible to implement point 1 and point 2 as below ?
Example :
Application class is defined as :
//Class for getting various types from my application
package application.custom;
public class Project
{
public string getStringValue(String name) {
<Logic of the application>
return ;
}
}
//Class 2 for setting the rule result
package application.customresults;
public class ProjectResults
{
public void setResult(String name) {
<Logic of the application>
}}
===========================================================================
Drl file like :
package application.rules
#I shall set the object 'projRes' in my appl using setGlobal
global application.customresults.ProjectResults projRes ;
import application.custom.Project;
rule "project-1.option1"
when
$proj : application.custom.Project();
eval ($proj.getStringValue("Drools") .equals ("ABC")) # Logic specific to my
application
then
#Requirement is to set and make use of the object 'projRes' in my
application
modify (projRes) {projRes.setResult("Drools project"); }
end
rule "project-1.option2"
when
$proj : application.custom.Project();
$projRes : application.customresults.ProjectResults();
eval ($proj.getStringValue("Java") .equals ("DEF")) # Logic specific to my
application
then
#Requirement is to set and make use of the object 'projRes' in my
application
modify (projRes) {projRes.setResult("Java project");
}
end
Please let me know if the above way of writing the drl would suffice both
the requirements (or) is there a better way to implement it.
Thanks
Dibya
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Queries-with-relation-to-the-LHS...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Drools 4.0.7 compatible with Jboss 3.2.7
by Dibya Ranjan
Thanks for the update.
Would like to know if Drools version 4.0.7 is compatible with J-boss version
3.2.7.
/BR
Dibya
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools5-2-2-integration-with-scala2-9-0...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 7 Aug 2011 14:33:25 +0200
> From: Dibya Ranjan <dibya.tcs(a)gmail.com>
> Subject: [rules-users] Regd Drools compatibility with Jboss version
> To: rules-users(a)lists.jboss.org
> Message-ID:
> <CAK=+3B9m73RKWQB951Ze1Ca-rpFbB+a+gds4aHVmaGNB4TZ+Vg(a)mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi
>
> We have a requirement to implement Drools in an application ,which is
> hosting the application server in Jboss with version as 3.2.7.
>
> It further uses java 1.4 version with the application being build and
> deployed with Ant 1.6.2.
>
> Could anyone help me in providing the Drools version that is compatible
> with
> above .
>
> --
> With Warm Regards
>
> Dibya Ranjan
> -
> *******************************************
>
14 years, 5 months
Rule o
by DroolersEye
Hi,
Some one can help me,
I want to use Rule object...I noticed Rule interface available in two
packages ...which one to be used...
"org.drools.definitions.rule" or "org.drools.rule"
please some one can advise us...
thanks,
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-o-tp3243667p3243667.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Lock-on-active and ruleflow-group
by bitter
I have three rules:
rule "First rule"
salience 20
ruleflow-group "rfs_1"
lock-on-active true
when
$c: Car(color == "red")
then
$c.setPrice(1);
update($c);
end
rule "Second rule"
salience 25
ruleflow-group "rfs_1"
lock-on-active true
when
$c: Car(size == "small")
then
$c.setPrice(2);
update($c);
end
rule "Second step"
salience 40
ruleflow-group "rfs_2"
lock-on-active true
when
$c: Car()
then
System.out.println($c);
end
I have class, for example Car, which has three prioperties: color, size,
price.
I insert into session fact-Car("red", "small"), next start process, and
execute rules.
After that, price value is 1. I thought that "Second rule" should be fired
only because it has bigger salience but it is exactly the opposite. Could
anyone explain me why first rule was executed/fired and what can I do to
fire only "Second rule" (without invoking "First rule").
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Lock-on-active-and-ruleflow-group-tp323...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months