Some Querries on Drools
by Sumeet Karawal
Hello All,
I have some queries regarding use of drools as rule engine for my
Application. It would be very helpful if I get some guidance regarding
these:
1) I have an application in which a user logs in, and according to his
profile he is provided with some benefits, and rule engine check for the
eligibility criteria. But if hundreds of thousands of user will log in at
same time, then what will be the performance accordingly. Like, these
concurrent users hitting the server, and so many threads will be generated
and many number of rules will be fired in the session. Will this hamper the
performance of Rule Engine.
2) Suppose I have an application using drools. I create EAR / WAR file of
that application and deploy it on some other system. Would it be still
possible for me to change the rules on the fly. Or some dependencies might
have to be managed.
3) How can we manage sessions in drools? Suppose we are having different
stateful sessions in our application, but time consumption when we
fireAllRules() exceeds the expected time. So is there a mechanism to kill,
restart the session in drools. Could I get some help/document regarding
session Management on drools.
Thanks & Regards,
Sumeet Karawal
CEG - Open Source Technology Group
Tata Consultancy Services
Ph:- +912267782556
Cell:- +919833236440
Mailto: sumeet.karawal(a)tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________ rules-users(a)lists.jboss.org
=====-----=====-----=====
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
13 years, 8 months
Drools DB configuration mysql
by MichaelBini
Hi ,
I am using brms-standalone-5.1.0
I try to connect it into MySql DB.
My step are :
1.Run Guvnor with default,and generate the repository.xml and folder at
JBOSS_HOME\bin dictionary
2.I edit repository.xml and delete the folder.
3.install Mysql database,and create the drools database instance,and copy
mysql driver to JBOSS_HOME\server\deploy\lib
4.Restart the JBoss ,i get the exception:
ERROR 18-04 14:46:24,922 (DatabasePersistenceManager.java:store:476)
failed to write node state: deadbeef-cafe-babe-cafe-babecafebabe
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Duplicate entry 'deadbeef-cafe-babe-cafe-babecafebabe' for key
'DEFAULT_NODE_IDX'
repository.xml -
<?xml version="1.0"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD
Jackrabbit 1.4//EN"
"http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
</FileSystem>
<Security appName="Jackrabbit">
<AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager">
</AccessManager>
<LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="default"/>
<Workspace name="default">
<FileSystem
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
</FileSystem>
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
</FileSystem>
<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
</PersistenceManager>
</Versioning>
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Repository>
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-DB-configuration-mysql-tp2834080...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Test Scenarion in guvnor does not give me correct results
by navneet.singh
Hi,
I have created a decision table, using drools guvnor, which has some
condition columns, which is dependent on fact named "Feature", which has
columns defined under "Fact Field" column in below table, and its respective
values
Name Data Type Fact Field
Operator Value
Surface Area Decimal number surface_area
== 48
Flatness Deviation Decimal number flatness_deviation
== 0.8
Surface Finish min Decimal number surface_finish
>= 0.8
Surface Finish max Decimal number surface_finish
<= 0.8
Material Name Text material
== ALUMINIUM
Material Fraction Decimal number material_fraction
== 32
Action column gives an output, a fact of type "Process", as an output with
following details
Name Data Type Fact Field Value
Process Name Text Name
Magnesium Tooling Plate
I've crated a test scenario in which I insert a fact of type Feature, with
values which do not match any of the condition columns (I feed in wrong
values just to check if the test fails), but the test runs successfully.
When I click the show events button, I can see that the rule from decision
table has not been fired.
Can anyone please help me understand what is happening here.
Thanks in advance.
Navneet Singh
--
View this message in context: http://drools.46999.n3.nabble.com/Test-Scenarion-in-guvnor-does-not-give-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Searching a list - Is Drools the answer?
by Drools User
I have been using Drools for several years, but just with constraints
(rules) on 1 set of objects at a time. Think many rules, few facts in a
stateless session. I have been given a new project at the office which
requires having about 10-100k facts and few rules. These 10k facts would be
basically constants, a list of things I need to search on each request. I
would then need to load a single object, based on a request to see if my
request object matched the list. It is somewhat a simple search, but I need
to be able to inject aliases and search partial matches in addition to exact
matches. A generic example:
List:
Object 1 (FirstName=John, LastName=Smith)
Object 2 (FirstName=Will, LastName=Smith)
Object 3 (FirstName=Jon, LastName=Smith)
Request/Use Case:
LastName=Smith, would return all 3 objects, but marked as single match
LastName=Smith, Firstname =John, Would return object 1, as exact double
match, and Object 3 a nickname double match
LastName=Smith, Firstname =J, Would return object 1 and 3, as partial match
In the second request, I need to run all names through a nickname DB/list to
explode the name into multiple search patterns. Possibly using (
http://code.google.com/p/nickname-and-diminutive-names-lookup/)
Hopefully that explains a bit about the problem.
So to the question, there are a few ways to solve this. The simplest is just
SQL from a DB, but this proves to be slow to search all the ways I need. I
need sub second response times. An in memory DB is another possible solution
we are looking at. Not to think of Drools as the golden hammer, but this
smells like something I can use Drools for. My first thought was to load the
"List" as facts into a stateful session. My concern is wouldn't I need N
copies of the list loaded to have N threads? This would be inefficient if
so. I know rules aren't copied per working memory, but is there a way to
create a master working memory for facts to use?
So my second thought is to convert my List into rules so they would only be
stored once in the system, regardless of number of threads using the engine.
What do you guys think, am I on the right track with this? Is Drools a good
way to do this or is there something better I have overlooked?
Thank you for taking the time.
-Drools user
13 years, 8 months
Double Referencing
by Guy Moas
Hi,
Could you please assist me whether I can double referencing issues
Person.GetDOB().GetYear(); with Drools (Java, Guvnor)
Please try to send an exmaple
Many thanks,
Regards,
Guy Moas - Technical Project Manager
tel: +972 (73) 2608276 | mobile: +972 (52) 3624583 | X-Lite: 8276 | fax:
+972 (73) 2608205
GMoas(a)fis-software.com | http://www.fis-software.com
<http://www.fis-software.com/>
13 years, 8 months
Simple rule and Query
by DECOUX Yannick
Hi,
I'am trying to use Query and i'am facing a little problem :
Given this simple rule :
package be.test.person
import be.test.person.*
query "get adult"
adult : Adult( )
end
query "get person"
person : Person( )
end
declare Adult
name : String
end
rule "A person over 18 is an adult"
when
Person( age >= 18)
then
System.out.println("Adult detected");
insert(new Adult());
end
Lets suppose one Person over 18 is inserted inside the working memory, the result of the query < get adult > is 0 (Please note the declaration of Adult type inside the rule)
If I create a Java class Adult (commenting the one in the .drl file) and then run the query again, this time the result is 1
Also, the signature of org.drools.runtime.rule.WorkingMemory.getQueryResults(String) says IllegalArgumentException when query is not found in the KnowledgeBase. This doesn't seems to be the case when I use a fake query name.
I'am using drools 5.1.1
Any idea on this ?
Thanks
13 years, 8 months
Planner and optional rules
by ToTToRRo
Hello.
I'm working on a planning system and my customer is requesting to use a rule
engine. Of course, we are gonna use Drools and we are considering planner.
The customer already talked about having hard and soft constraints, however,
one request of the users is to enable them to inactivate specific
constraints for some specific one-shot calculation when required.
I've been thinking of using specific RuleFlows in order to not use the
different constraints selected by the user, but is seems a bit long and
risky as the number of selectable constraints could be high therefore
increasing the number of combination (RuleFlows) to write.
Is there any native solution to this issue knowing that performances are in
the spotlight as well?
Thanx in advance.
Nico
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-and-optional-rules-tp2823955p28...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Re: [rules-users] Expert versus Expert
by martindavid@free.fr
Hi, thanks for the tips.
I wasn't aware of drools-server. There's not much documentation about it, especially how it can work with Guvnor in order to get the assets. Or maybe I wasn't able to find it.
Such a centralized approach makes sense to me, I hope it to be a reality soon.
David
----- Mail Original -----
De: "Mark Proctor" <mproctor(a)codehaus.org>
À: rules-users(a)lists.jboss.org
Envoyé: Jeudi 14 Avril 2011 16h07:10 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [rules-users] Expert versus Expert
On 14/04/2011 09:11, delirii wrote:
> A few months ago a question was asked about the difference and the use case
> involving Drools Expert and Drools Guvnor.
>
> To be honest, it isn't clear for me too and as there wasn't any answer to
> this first question, so I'm trying to have an answer with your help :)
>
> What's clear :
> - Guvnor is a repository for the assets
> - The easiest (?) and certainly the mainly available as a tutorial solution
> is to create in each application an agent that grabs the assets and execute
> the whole thing in its own context.
>
> What's not clear :
> - how to centralize the execution in order to know exactly what's executed,
> by whom, and how (be able to log which facts are sent, to which rules, and
> be able to read the execution plan
> - if it exists a "real" stand alone centralized engine that match this need
> (Drools Expert ?)
>
> If some can explain this a little bit more, I'll be really happy to read !
> And if it can be added to the current documentation, it could be a great
> idea too.
>
I think that's fair. We don't have centralised management of expert
runtime's yet. It's currently de-coupled via a pull mechanism.
Mark
> Thanks for your help.
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515....
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 8 months
help! rule"rule_key" failed to predicate
by 赵慧
hello,everyone! I wrote a rule with Drools, I compile the program and get the errors as follows:
[3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate: {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
[3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule package
[7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule package in rule sample
I don't know how it happened, looking forward to your reply! thank you !!!
PS: My rules are here:
dialect "mvel"
package com.sample
import com.sample.Server;
rule "system will execute 'tc' command"
when
eval(Server.Message>8388608)
then
System.out.println("The network is so crowd that it needs repairing.");
Runtime.getRuntime().exec("tc");#give the authority and execute the "tc" command
end
rule "caution"
when
eval(Server.Message==8388608)
then
System.out.println("caution!The network maybe will get blocked very soon.");
end
rule "fluent network"
when
eval(Server.Message<8388608)#conditions
then
System.out.println("the current network is very good");#actions
end
13 years, 8 months
Re: [rules-users] execute particular rules programmatically and dynamically
by Robert Christenson
I will concede that we had discussed an AgendaFilter only recently and a prototype did prove successful.
It may not be ideal and based on this thread I'm challenging my team for a pure rule solution.
Our specific issue is that the rules need to activate both when a field is tabbed off in a GUI, but also as a result of a higher-level validation of all data within our larger dog show event. In this case, if I added specific logic to the rule, how/when could the rule activate when the overall event is submitted to the session? Perhaps Context( (action == all) || (action == taboff, fieldsAffected contains field1)
I viewed the filter as a direct way to allow the activations to be filtered (in the case of taboff, keep only the rules affected by the field)
I would welcome any suggestions, I'm still trying to learn as much as I can.
Sorry for the smell.
-bob
13 years, 8 months