Urgent..Dynamic nature of rules
by nkumar
Hi,
Is there any way to get the rules from external source rather than loading
this from .drl file every time? because of changing behavior of the rules,
rule file has to be changed if a user introduces a new rule in the system.
Please help me out how can we solve this. i am new to drools and even i
don't know how to write rules properly. Can we store this in a database or
can we save rules somewhere so that next time rather than loading this from
direct rule file, we load this from that data source. User of this
application is non technical and i also need to make an interface to get the
rules in plane English which will convert those into rules accordingly.
Guvnor is not much user friendly. Can anyone please help me out. My deadline
is near.
this is the structure of the rule which i need to make after loading the
data.
when
b:Feature(featureClass.name=="FrontSuspension")
c:Feature(featureClass.name=="FrontAxle")
eval(b.attributes.Capacity>=c.attributes.Capacity)
then
AvailabilityRuleState s = new
AvailabilityRuleState();
s.setValue("A");//Available
s.setReason("");
s.setReference("FA-FS:1");
resultState.add(s);
end
Please help me out. i will really appreciate your help.
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Urgent-Dynamic-nature...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Single Session versus Multiple Sessions
by Brian Wallis
I'm (very) new to Drools and am trying to determine the best way to use it for our scenario.
I have a domain model that has millions of object instances representing Documents, People and Incidents.
- Incidents are associated with People (1-100+ per person)
- Documents are associated with Incidents (1-50+ per incident)
- Documents are also associated directly with People (1-100+)
- Typical number of documents directly or indirectly associated with
a person is 20-40.
- An incident has a start and end date
- The documents associated with the incident will be created
approximately within the time bounds of the incident
I need to have a workflow for which there will be 1000's of instances that wait for certain documents to be associated with an Incident (or Person) and then continues with an interaction with a user before terminating. It may have to exist for days or weeks.
The simple solution is to have a single session that contains all the documents, incidents and people and to which new documents, incidents and people are added as they arrive at the system. Then I can have a workflow that runs with rules over those facts that will wait until all the necessary documents are available and continue on with the human interaction part.
Of course this won't work. There are too many facts and most of them are not relevant to any particular workflow instance anyway.
So, I'm thinking of doing this with a session per workflow instance where the session is populated with the relevant documents on startup and has any new relevant documents are added when they arrive (using a jms event pipeline).
I can easily filter the event stream to just insert new facts into the session's working memory for documents that are associated with the person and I can pre-populate the session's working memory with a selection of existing documents before starting the workflow. A typical number of documents required for a workflow instance is in the order of 6-50.
So I would create a knowledgebase preloaded with the workflow and rules and create a new session each time I need to run the workflow. At any one time I could have 1000's of sessions. I delete sessions (and reclaim any associated resources) when the workflow completes so I don't need to clean up individual facts. The sessions would need to be stateful and persistent (to a database).
Does this make sense or is there a better way to approach this? Will Drools scale OK when used like this?
thanks,
Brian Wallis
InfoMedix | Architect
p: 3 8615 4553 | f: 3 8615 4501
e: brian.wallis(a)infomedix.com.au
Level 5, 451 Little Bourke Street, Melbourne VIC 3000
15 years, 7 months
Are implicit ANDs allowed in "not" blocks?
by Nathan Bell
This rule:
rule "Not"
when
not(
RuleTime()
Patient()
)
then
System.out.println("not");
end
produces the following errors when compiled:
[ERR 102] Line 43:5 mismatched input 'Patient' expecting ')' in rule
"Not"
[ERR 102] Line 44:5 mismatched input ')' expecting 'then' in rule "Not"
But if I change it to use explicit ANDs instead of implicit ANDs it
compiles and runs.
rule "NotBlock"
when
not(
RuleTime()
and
Patient()
)
then
System.out.println("notBlock");
end
Is it invalid syntax to use implicit ANDs in a not block? If so, why?
Thank You,
Nathan Bell
15 years, 7 months
Deadlock using BatchExecutionCommand and Rule that uses the duration attribute
by MacDonald, Bob
Has anyone run into this issue? I've found a couple other references to
deadlocks but nothing that seems to match exactly what I'm seeing. I'm
running with drools 5.1.1 and using the BatchExecutionCommand interface
to feed a set of commands into my StatefulKnowledgeSession. I also have
a simple rule that uses the duration attribute to clean up old facts.
The problem is that the thread that executes the rule associated with
the duration attribute acquires the lock associated with the
DefaultAgenda class object and subsequently tries to acquire the locks
managed by the AbstractWorkingMemory. However, my main thread that uses
the BatchExecutionCommand interface could run while the other thread is
running and this thread first acquires the AbstractWorkingMemory locks
and later tries to acquire the DefaultAgenda class object lock resulting
in the deadlock.
Here's is the stack trace for the thread that runs when duration
expires:
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: 158
ReentrantLock$NonfairSync(AbstractQueuedSynchronizer).parkAndCheckInterr
upt() line: 747
ReentrantLock$NonfairSync(AbstractQueuedSynchronizer).acquireQueued(Abst
ractQueuedSynchronizer$Node, int) line: 778
ReentrantLock$NonfairSync(AbstractQueuedSynchronizer).acquire(int) line:
1114
ReentrantLock$NonfairSync.lock() line: 186
ReentrantLock.lock() line: 262
ReteooStatefulSession(AbstractWorkingMemory).retract(FactHandle,
boolean, boolean, Rule, Activation) line: 1256
DefaultKnowledgeHelper.retract(FactHandle) line: 201
DefaultKnowledgeHelper.retract(Object) line: 214
Rule_Automatically_Remove_Old_Events_0.defaultConsequence(KnowledgeHelpe
r, Event, FactHandle) line: 10
Rule_Automatically_Remove_Old_Events_0DefaultConsequenceInvoker.evaluate
(KnowledgeHelper, WorkingMemory) line: 29
DefaultAgenda.fireActivation(Activation) line: 917
Scheduler$ActivationTimerJob.execute(JobContext) line: 73
JDKTimerService$JDKCallableJob.call() line: 147
JDKTimerService$JDKCallableJob.call() line: 125
FutureTask$Sync.innerRun() line: 303
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>(FutureTask<V>).run()
line: 138
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.access$301(ScheduledT
hreadPoolExecutor$ScheduledFutureTask) line: 98
ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.run() line: 207
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
Thread.run() line: 619
And here's the stack trace of the thread using the BatchExecutionCommand
interface:
DefaultAgenda.fireActivation(Activation) line: 889
DefaultAgenda.fireNextItem(AgendaFilter) line: 856
DefaultAgenda.fireAllRules(AgendaFilter, int) line: 1071
ReteooStatefulSession(AbstractWorkingMemory).fireAllRules(AgendaFilter,
int) line: 785
ReteooStatefulSession(AbstractWorkingMemory).fireAllRules() line: 751
StatefulKnowledgeSessionImpl.fireAllRules() line: 218
FireAllRulesCommand.execute(Context) line: 99
FireAllRulesCommand.execute(Context) line: 33
BatchExecutionCommandImpl.execute(Context) line: 159
BatchExecutionCommandImpl.execute(Context) line: 81
StatefulKnowledgeSessionImpl.execute(Context, Command<T>) line: 887
StatefulKnowledgeSessionImpl.execute(Command<T>) line: 862
Rules$RuleRunnerThread.run() line: 554
The rule with the duration attribute is very simple and included below:
rule "Automatically Remove Old Events"
agenda-group "SYSTEM"
// 1 hour (specified in milliseconds)
duration 3600000
when
$event : Event(eventId : id)
not SituationEvent(correlator == eventId)
then
retract($event);
end
CONFIDENTIALITY NOTICE: The information contained in this e-mail and its
attachments are privileged and confidential and may contain proprietary,
copyrighted or other legally protected information which is intended
solely for the use of the addressee(s). If you are not the intended
recipient, you are hereby notified that any disclosure, use, copying or
distribution of this communication is strictly prohibited. Please
notify the sender immediately and permanently delete this e-mail from
your computer.
15 years, 7 months
Droos Guvnor 5.1.1 - Relation between Category and Package
by Achyutha, Venkata
Hi,
I am using ServiceImplementaion.java class to read categories and packages in repository, I didn't find any method in this class to get like what all packages are there for Category. Can someone please point out me how to get this relation.
We are developing small ui, where we show Category in dropdown, its packages in one more dropdown and rules in one more dropdown. This is little urgent requirement, help would be highly appreciated.
Thanks
Kumar
15 years, 7 months
Scenario issue with ruleflow-group in guvnor
by kyori
Hello,
I created a rule flow in Eclipse with some rules (BRLs, DRLs and XLS format
decision tables) which worked perfectly in Eclipse (with jBoss IDE plugin
5.1).
Then I committed the flow and all the rules to Guvnor and created a scenario
with "ruleflow-group" activation. But none of these rules is fired, even
the simplest ones...
The error message was "Rule [...] was not activated. Expected it to be
activated".
If I remove the "ruleflow-group" option from the rules, they worked fine
again.
I've tested in Guvnor 5.1 and 5.2 snapshot, the same result.
Does anybody else have this problem. Did I miss something except the
activation of ruleflow-group in the scenario?
Regards,
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Scenario-issue-with-r...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
drools with IKVM
by Piyush Goel
We are using Drools engine on our client written in C#. We are using IKVM to
convert the drools jar and our java beans into dll's using IKVM. We have a
rule similar to this:-
rule "aggregate rule"
when
$b : Bill(billAmount > 100)
$n : Number(doubleValue > 100) from accumulate ( $l : LineItem()
from $b.findItems("color", "blue"), sum($l.getSellingValue()))
then
VoucherSeries fact0 = new VoucherSeries();
fact0.setSeriesCode( "aggregate voucher" );
insert(fact0 );
voucherlist.add(fact0);
System.out.println("sum" + $n);
end
This rule works fine when it is run with java based drools API's, but while
running it with IKVM converted drools, it throws the following error:-
Unable to cast object of type 'AccumulateMemory' to type 'FromMemory'.
Any ideas on what might be going wrong ?
thanks,
piyush
15 years, 7 months