I have 1000 rules, i want to create each 100 as one set , and fire each set when necessary
by srinivasasanda
Hi EveryOne..
Please if any one know give me some link, or sample example, or
suggest how to do this, Thank u in advance
I am Having 1000 rules and i want to make each 100 rules as one set, so i
will 10 set , can i fire only 1 set when necessary, can i add a new rule to
existing set dynamically,
what is necessary of making more than one drl files, and how to load all drl
at once.
I am very new to drools.. Please suggest me some solution
--
View this message in context: http://drools.46999.n3.nabble.com/I-have-1000-rules-i-want-to-create-each...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
How to get the declared FactType in Guvnor into Eclipse ?
by Manohar Kokkula
Hi All,
I defined Declarative model, Bank with fields( name, accntno, balance,
deposit) in com.simple package in Guvnor-5.2,
and also defined one Guided rule and one test scenario and tested
successfully in Guvnor.
But when I am trying to use same Declarative model(Bank) through API's in
Eclipse,
I am getting following error,
java.lang.NullPointerException
Here is my Declarativemainclass:
In Eclipse, I defined BankDTableChangeSet.xml and
Declarativemainclass.java defined in com/model package.
public class Declarativemainclass {
public static void main(String args[])
{
try
{
// get a reference to a knowledge base with a declared
type:
KnowledgeBase kbase =createKnowledgeBase();
// get the declared FactType from Guvnor
FactType bankType = (FactType) kbase.getFactType( "com.simple", "Bank" );
// Here I am getting above exception
// handle the type as necessary:
// create instances:
Object bank = bankType.newInstance();
// set attributes values
bankType.set(bank, "name","Govinda");
bankType.set(bank, "accntno", 498);
// insert fact into a session
StatefulKnowledgeSession ksession
=kbase.newStatefulKnowledgeSession();
ksession.insert(bank);
ksession.fireAllRules();
// read attributes
int value1=(Integer) bankType.get(bank, "balance");
int value2=(Integer) bankType.get(bank,"deposit");
System.out.println(value1+"\t"+value2);
}
catch(Exception e)
{
System.out.println(e);
}
}
private static KnowledgeBase createKnowledgeBase()
{
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("BankAgent");
Resource changeset =
ResourceFactory.newClassPathResource("com/model/BankDTableChangeSet.xml");
kagent.applyChangeSet(changeset);
KnowledgeBase kbase = kagent.getKnowledgeBase();
return kbase;
}
}
Please help me anyone...
Thanks and regards
Manohar Kokkula
Mailto: manohar.kokkula(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
14 years, 5 months
Camel Endpoint usage strategy
by esstrata
Hi,
we're refactoring a standalone application (Spring 3.0.5, Drool 5.1.1) to
use Apache Camel 2.8.0. As seen in other post, there is very little
information available about (
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-integrati...
Drools Endpoint or Camel integration ). We don't want to use drools-server
as having a web container is not an option.
The app basically loads from large CSV files, processes each row with lots
of rules and inserts the result in a DB. It is therefore a pretty demanding
process.
Here is an excerpt of what it does without Camel:
/
while (scanner.hasNextLine()) {
...
FactHandle trafficHandle = session.insert(row);
session.fireAllRules();
session.retract(trafficHandle);
}
/
What we'd like to achieve is performing the above loop content in an
endpoint/processor (?) and configure it to use multiple threads so several
rows can be handled simultaneously.
Any sugestions?.
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/Camel-Endpoint-usage-strategy-tp3524173...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Ordered lists in drl
by LCode
I am trying to write a rule via the guided rule editor and (again!!) I am
really struggling.
The following is a simplified explanation of my scenario:
I have a model where there is one 'Supermarket' object which has a list of
integers 'locationID'. Elsewhere I have another list of 'Place' objects,
each of which has an integer locationReference.
Something like this....
<Supermarket name = 'asda'>
<LocationID>21</LocationID>
<LocationID>18</LocationID>
<LocationID>19</LocationID>
</Supermarket>
<Places>
<Place>
<LocationReference>21</LocationReference>
</Place>
<Place>
<LocationReference>18</LocationReference>
</Place>
<Place>
<LocationReference>19</LocationReference>
</Place>
</Places>
I need to write a rule that fires when the *order* of locationIDs does not
match the order of the locationReferences. So the above example would be
fine but the model below would not...
<Supermarket name = 'asda'>
<LocationID>18</LocationID>
<LocationID>21</LocationID>
<LocationID>19</LocationID>
</Supermarket>
<Places>
<Place>
<LocationReference>21</LocationReference>
</Place>
<Place>
<LocationReference>18</LocationReference>
</Place>
<Place>
<LocationReference>19</LocationReference>
</Place>
</Places>
I know that drools does not consider the order of facts in the model,
however since both facts are java.util.Lists I wonder if it possible to
compare the elements at position 0, 1, 2 etc. I am afraid my drl skills are
really not up to scratch.
Any thoughts?
--
View this message in context: http://drools.46999.n3.nabble.com/Ordered-lists-in-drl-tp3519453p3519453....
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Knowledge Base Agent : getLastModified
by Vishwanath Dubey
Hi,
It seems Rule Agent does not check does not provide credential to get last
modified time for a snpashot of a package and also on Guvnor side no
security check is provided when last modified time is retreived for the
snapshot of respective package.
Relevant security check is only provided when agent downloads the snapshot.
I do not know why it is so, but security check is provided for any request
of resource to the server.
Thanks,
V
14 years, 5 months
Can't open bpmn from Visual Editor in Process Editor
by ANJALI
I hope to fill in the properties not yet handled in the Visual Editor with
the Process Editor.
A workflow created with the Visual Editor that contains Rule Tasks throws an
exception when opened in the Process Editor "An exception occurred while
reading in the RuleFlow XML: No messages found See the error log for more
details". Where is the error log and how do I fix the xml in a text editor?
Another error when opening with the Process Editor is a Gateway direction is
unspecified. I set Gateway directions in the Visual Editor to Diverging and
Converging, save the file, but the properties view shows it goes back to
Unspecified.
Could any one help me??
Thanks in advance,
Anjali
--
View this message in context: http://drools.46999.n3.nabble.com/Can-t-open-bpmn-from-Visual-Editor-in-P...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Exclude certain rules
by icechunk
I am trying to validate an incoming set of application forms. Each form has
a number of validations that apply. But there could be special cases where
certain rules need to be excluded. The exclusions are based on certain
conditions that will vary at runtime and will need to be stored in the
database (if from type x and user is y then exclude rule z).
Is there a graceful way of handling this? I am thinking of inserting a
Metadata fact into the session that has the rules that need to be excluded.
Rules will then check if they are to be excluded in LHS. Would this work?
--
View this message in context: http://drools.46999.n3.nabble.com/Exclude-certain-rules-tp3517185p3517185...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Inadvertant type conversion while using keyword "in"
by TroyL
We ran into an issue when evaluating string values against a list of values
while using the keyword "in".
We find that when there is a decimal place in the string value and either
the fact inserted into the session or the string values in the list end with
a zero, the string will be truncated, as if it were being type converted
from a string to an int.
As as example: Fact type "Test"
package com.sample;
public class Test {
private String code;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
Sample DRL:
package com.sample
//Test code value == "1.5"
rule "Incorrect Execution"
when
Test($code : code in ("1.50"))
then
System.out.println("Unexpected execution: 1.50, 2.50 - actual code
value: 1.5");
end
//Test code Value == "1.5"
rule "Correct Execution"
when
Test(code == "1.5")
then
System.out.println("Expected execution - Code compared values: 1.5,
2.5 - actual code value: 1.5");
end
We insert a "Test" fact into the session with a code value of 1.5. The
output is as follows:
Unexpected execution: 1.50, 2.50 - actual code value: 1.5
correct execution - Code compared values: 1.5, 2.5 - actual code value: 1.5
Drools Expert documentation states:
Type coercion is always attempted if the field and the value are of
different types; exceptions will be thrown if a bad coercion is attempted.
For instance, if "ten" is provided as a string in a numeric evaluator, an
exception is thrown, whereas "10" would coerce to a numeric 10. Coercion is
always in favor of the field type and not the value type:
Both evaluators are actually syntactic sugar, internally rewritten as a list
of multiple restrictions using the operators != and ==.
Is there some way to disable the auto-conversion feature?
--
View this message in context: http://drools.46999.n3.nabble.com/Inadvertant-type-conversion-while-using...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months