"Thousands" of lines of DRL in a single file represent an issue not just to Guvnor but to anything handling it.
The recommendation would be to split the DRL into individual rules, resulting of thousands of assets in Guvnor.
The next question would be if you have "thousands" of similar rules why not use a singe Template or Decision Table?
Having said that, using a Template or Decision table in Guvnor with "thousands" of rows could exhibit a problem at present.
Both of the editors in Guvnor do not scale well past a few thousand. This is a known issue and we have an open item to address given time.
Using an Excel based decision table loaded into Guvnor would be workable, however the compilation time to build a binary package may be an issue (I don't know).
I can look into the solution of writing my own Java application for this solution. But I would still like to understand, if the problem is just because of the 3 values being checked in the rules ? Do complex rules dont have more than 1 checks ?
If yes then this case should be supported no matter how simple the rule is right ?
Also for the UI issue I mentioned. Assume some other complex rules. Is copying the thousands of lines in the text area not a problem in guvnor ?
On Tue, Jan 10, 2012 at 12:38 PM, laune [via Drools] <[hidden email]> wrote:
Assuming that the remaining 19998 rules are of the same kind, there is a lot of data in these rules, and only very little logic. Ignoring the issue of "Olympia" being one of the cities not being "Seattle", we have the problem of matching a triplet of <field,state,city> from a Student fact so that we can store one or more Subjects in Student.subjects.
Imagine that you have objects of type Inscribe containing a triplet of field, state, city and the pertaining List<Subject>. Then you could write a single (!) rule
rule register
when
$stu: Student ( $f: field, $s: state, $c: city )
$ins: Inscribe( field==$f, state==$s, city==$c )
then
$stu.setSubjects( $ins.getSubjects() );
end
BTW: Why do you use equals with state? Using "==" should be possible here, too.
And, of course, matching ~20000 different triplets to facts of a single type isn't really RBS fodder. You can design a simple Java program that achieves this goal, assuming you can come up with a straightforward representation of the <field,state,city;subject+> mapping.
-W2012/1/10 Shweta1986 <[hidden email]>
My rules are as follows.
rule "rule1"
salience -2
dialect "mvel"
when
stud : Student ( field == "ARTS", state.equals("WA"))
then
java.util.List subList = new java.util.ArrayList();
Subject subject = new Subject();
subject.setName("ABC");
subject.setFees(33454);
subject.duration(4);
subList.add(subject);
subject = new Subject();
subject.setName("XYZ");
subject.setFees(33454);
subject.duration(4);
subList.add(subject);
stud.setSubjects(subList);
end
rule "rule2"
salience -100
dialect "mvel"
when
stud : Student ( field == "ARTS", state.equals("WA") , city == "SEATTLE"))
then
java.util.List subList = new java.util.ArrayList();
Subject subject = new Subject();
subject.setName("ABC");
subject.setFees(33454);
subject.duration(4);
subList.add(subject);
subject = new Subject();
subject.setName("XYZ");
subject.setFees(33454);
subject.duration(4);
subList.add(subject);
stud.setSubjects(subList);
end
Student is the main object and it contains List of Subjects. here the way I am using the salience because
if the input us shweta, ARTS, WA,Olympia it matched rule1
but if the input is shweta, ARTS, WA, Seattle it matches 1 and 2 but i want the rule 2 to be executed so salience.
I am using StatelessKnowledge Session and also the resource change scanner.
I execute one rule at a time and the scanner poll interval is 1 hour.
When I started with 100 rules I was using "PK" as my source in changeSet.xml but when the rules grew to 20K I was not able to build the rules in Guvnor UI and hence I started using "DRL" as source.
The way I generate drl is using a script which converts the csv to drl format.
I copy the drl to the text area in techincal rules and save it. ( this copy is also paiful so I asked that if there is an upload drl file unlike the import drl file)
In changeset I give the path to the url in webdav /guvnor/org.drools.guvnor.Guvnor/webdav/packages/StudentRules/StudentRules.drl
I am not sure if I am doing it the right way. Please suggest.
Thanks,
Shweta
On Mon, Jan 9, 2012 at 11:58 PM, laune [via Drools] <[hidden email]> wrote:
Salience is just one way to force the evaluation of a condition before others. In fact, using salience throughout is just a way of re-creating a sequence of plain old if statements using a rules engine.
I'm not going to waste my time and yours by elaborating on possible alternatives unless you come up with a detailed description of your rules, and how you run your rules engine: fact insertion, calls to fire, etc.
-W2012/1/10 Shweta1986 <[hidden email]>
I am not sure I understand that. What is the other option for this case. Why would simple rules not work for 20 K rules. Am I missing something. I cannot use database to store my rules. Drools also gives me salience which I need for my usecase.
On Thu, Jan 5, 2012 at 11:29 PM, laune [via Drools] <[hidden email]> wrote:
2012/1/6 Shweta1986 <[hidden email]>And my rules are very simple it is like if string comparison then set that's it..
This doesn't really warrant the use of a rule based system. If keeping this logic out of the application or an easy maintenance of these if-then's are your main goals, there are other ways. I've already hinted at this, with the idea of providing the information embedded in similar rules as data.
-W
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
http://drools.46999.n3.nabble.com/Large-number-of-rules-in-Drools-tp3630385p3637255.htmlIf you reply to this email, your message will be added to the discussion below:To start a new topic under Drools: User forum, email [hidden email]
View this message in context: Re: [rules-users] Large number of rules in Drools_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
http://drools.46999.n3.nabble.com/Large-number-of-rules-in-Drools-tp3630385p3647015.htmlIf you reply to this email, your message will be added to the discussion below:To start a new topic under Drools: User forum, email [hidden email]
To unsubscribe from Drools: User forum, click here.
NAML
View this message in context: Re: [rules-users] Large number of rules in Drools
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
http://drools.46999.n3.nabble.com/Large-number-of-rules-in-Drools-tp3630385p3648792.htmlIf you reply to this email, your message will be added to the discussion below:To start a new topic under Drools: User forum, email [hidden email]
To unsubscribe from Drools: User forum, click here.
NAML
View this message in context: Re: [rules-users] Large number of rules in Drools
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