Creating a KnowledgeBase using a KnowledgeAgent, KnowledgeAgentConfiguration and KnowledgeBaseConfiguration
by Tina Vießmann
Hi,
I want to create a KnowledgeBase using stream processing mode, getting
its resources from an change-set xml and getting the updated when
resources are changed. So far I'm aware I need a KnowledgeAgent and a
configuration for the kagent and the kbase.
My code is:
// create knowledge base
// knowledge base configuration
KnowledgeBaseConfiguration kbaseConf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbaseConf.setOption(EventProcessingOption.STREAM);
// knowledge base
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);
// create knowledge agent
// create knowledge agent configuration
KnowledgeAgentConfiguration kagentConf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
//enable incremental knowledge base build
kagentConf.setProperty("drools.agent.newInstance", "false");
//create knowledge agent
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("AITS CEP Engine Agent",
kbase, kagentConf);
// apply change-set XML to knowledge agent
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset.xml"));
// get updated knowledge base object
kbase = kagent.getKnowledgeBase();
// create session
session = kbase.newStatefulKnowledgeSession();
Can it be done in a more compact way?
Thank you! :)
Tina
14 years, 1 month
no visitor implementation for : class org.drools.rule.TypeDeclaration
by Tina Vießmann
Hi,
I'm getting a two red highlighted outputs in eclipse if I modify my
rules file during run time. Besides that the modifications seem to work.
What does it mean?
The full output I get when the resource change is detected is listed
below. The bold lines are the concerned ones.
Thanks for any help! :)
Tina
[2010:08:235 21:08:296:debug] ResourceChangeScanner attempt to scan 1
resources
[2010:08:235 21:08:296:debug] ResourceChangeScanner modified
resource=[ClassPathResource path='testRule.drl'] : 1282559206875 :
1282591705000
[2010:08:235 21:08:296:debug] ResourceChangeNotification received
ChangeSet notification
[2010:08:235 21:08:296:debug] ResourceChangeScanner thread is waiting
for 10 seconds.
[2010:08:235 21:08:296:debug] ResourceChangeNotification processing
ChangeSet
[2010:08:235 21:08:296:debug] ResourceChangeNotification ChangeSet
modified resource=[ClassPathResource path='testRule.drl'] for
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4
[2010:08:235 21:08:296:debug] KnowledgeAgent received ChangeSet changed
notification
[2010:08:235 21:08:296:info] KnowledgeAgent applying ChangeSet
[2010:08:235 21:08:296:debug] KnowledgeAgent removing mappings for
resource=[ClassPathResource path='testRule.drl'] with unsubscribe=true
[2010:08:235 21:08:296:debug] KnowledgeAgent notifier unsubscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:296:debug] ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:296:debug] ResourceChangeScanner unsubcribing
notifier=org.drools.io.impl.ResourceChangeNotifierImpl@13576a2 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:296:debug] ResourceChangeScanner
resource=[ClassPathResource path='testRule.drl'] now has no subscribers
[2010:08:235 21:08:296:debug] KnowledgeAgent rebuilding KnowledgeBase
using ChangeSet
[2010:08:235 21:08:296:info] KnowledgeAgent performing an incremental
build of the ChangeSet
[2010:08:235 21:08:296:debug] ResourceChangeNotification thread is
waiting for queue update
[INFO ] 21:30:10,375 [main] "Event retracted." (DRL Logger)
[2010:08:235 21:08:453:debug] KnowledgeAgent: Diffing:
[ClassPathResource path='testRule.drl']
[INFO ] 21:30:10,453 [main] "Event retracted." (DRL Logger)
[2010:08:235 21:08:500:debug] BinaryResourceDiffProducerImpl: [Rule
name=delete parameter values, agendaGroup=MAIN, salience=0,
no-loop=false] is not present anymore. Adding to removed list.
[2010:08:235 21:08:500:debug] BinaryResourceDiffProducerImpl:
org.drools.rule.Function@67fe80 did change. Marking as removed so it new
version could be added later.
[2010:08:235 21:08:500:debug] BinaryResourceDiffProducerImpl: Comparing
[Rule name=Warning threshold exceeded to many times, agendaGroup=MAIN,
salience=0, no-loop=false] against [Rule name=Warning threshold exceeded
to many times, agendaGroup=MAIN, salience=0, no-loop=false]
*no visitor implementation for : class org.drools.rule.TypeDeclaration :
org.drools.rule.TypeDeclaration@95f290
no visitor implementation for : class org.drools.rule.TypeDeclaration :
org.drools.rule.TypeDeclaration@bfd66a*
[2010:08:235 21:08:546:debug] BinaryResourceDiffProducerImpl: [Rule
name=Warning threshold exceeded to many times, agendaGroup=MAIN,
salience=0, no-loop=false] didn't change. Removing from diff package and
adding it to unmodified list.
[2010:08:235 21:08:546:debug] BinaryResourceDiffProducerImpl: Comparing
[Rule name=Insert Watcher Into Knowledge Base, agendaGroup=MAIN,
salience=0, no-loop=false] against [Rule name=Insert Watcher Into
Knowledge Base, agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:546:debug] BinaryResourceDiffProducerImpl: The rules
have different LHS
[2010:08:235 21:08:546:debug] BinaryResourceDiffProducerImpl: Comparing
[Rule name=Add Event to Watcher Set, agendaGroup=MAIN, salience=0,
no-loop=false] against [Rule name=Add Event to Watcher Set,
agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:546:debug] BinaryResourceDiffProducerImpl: The rules
have different LHS
[2010:08:235 21:08:546:debug] KnowledgeAgent: Removing: [Rule
name=delete parameter values, agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:546:debug] KnowledgeAgent removing Rule=[Rule
name=delete parameter values, agendaGroup=MAIN, salience=0,
no-loop=false] from package=net.eads.astrium.aits.cep.rules
[2010:08:235 21:08:546:debug] KnowledgeAgent: Removing:
org.drools.rule.Function@67fe80
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=[Rule name=Warning threshold exceeded to many times,
agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:562:debug] KnowledgeAgent obtaining pkg
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=[Rule name=Insert Watcher Into Knowledge Base,
agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:562:debug] KnowledgeAgent notifier subscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.ResourceChangeNotifierImpl@13576a2 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=[Rule name=Add Event to Watcher Set,
agendaGroup=MAIN, salience=0, no-loop=false]
[2010:08:235 21:08:562:debug] KnowledgeAgent notifier subscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=org.drools.rule.TypeDeclaration@17dff15
[2010:08:235 21:08:562:debug] KnowledgeAgent notifier subscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=org.drools.rule.TypeDeclaration@f5cbda
[2010:08:235 21:08:562:debug] KnowledgeAgent notifier subscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent mapping
resource=[ClassPathResource path='testRule.drl'] to
KnowledgeDefinition=org.drools.rule.Function@11a59ce
[2010:08:235 21:08:562:debug] KnowledgeAgent notifier subscribing to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@b40ec4 to
resource=[ClassPathResource path='testRule.drl']
[2010:08:235 21:08:562:debug] KnowledgeAgent adding
KnowledgeDefinitionsPackage net.eads.astrium.aits.cep.rules
[2010:08:235 21:08:578:info] KnowledgeAgent incremental build of
KnowledgeBase finished and in use
[2010:08:235 21:08:578:debug] KnowledgeAgent finished rebuilding
KnowledgeBase using ChangeSet
14 years, 1 month
Blurring the lines of jBPM and Drools
by keithnielsen
I have been researching both jBPM and Drools for sometime now and am
wondering what the future holds for jBPM. This is based on my research of
Drools 5, which is bringing what I would consider more BPM constructs into
the core engine, things such as Wait States, Human Tasks, etc. One of the
main things I don't see yet is the whole persistence and support of long
running processes. My question is will the trend with Drools continue,
eventually consuming jBPM?
I must say that my perception is that Drools is more active which makes me
wonder if I should go with Drools hoping that it builds out more BPM
features going forward.
Thanks
--
View this message in context: http://www.nabble.com/Blurring-the-lines-of-jBPM-and-Drools-tp20099731p20...
Sent from the drools - user mailing list archive at Nabble.com.
14 years, 1 month
Resuming a simple process involving human task
by Touma
Hi all,
For the past few weeks I've been trying to get a simple drools flow example
involving human tasks up and running. I've done quite a bit to the point
that my session, process, task and workitems are being persisted in the
database. Here is what my flow looks like:
Start -> Ruleflow -> Decision node -> Human Task -> Printing Node -> End
The work item handler for the Human task simply performs the task of
persisting the Task instance. After reaching the Human Task, the flow stops
and the state is persisted. But how would I go about restarting/resuming the
flow so that the 'Printing node' is reached? I've tried using the
loadStatefulKnowledgeSession(sessionId) to load the session but querying the
list of all the processes for the given session returns an empty list. Ditto
with the list of all the process events. I have all the ID's with me
(workitem, process, task, session) but am pretty confused as to how these
can be put to use to resume my suspended workflow.
Any pointers would be much appreciated. TIA.
Peace,
/T\
--
View this message in context: http://n3.nabble.com/Resuming-a-simple-process-involving-human-task-tp716...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 1 month
Using rule flow in Guvnor
by Dinesh kumar
Hi,
I am having an issue in implementing the rule flow in guvnor.
I created a simple rule flow using eclipse plug in.
http://drools-java-rules-engine.46999.n3.nabble.com/file/n1057004/rules.jpg
I checked the rule flow model in eclipse using the green tick mark and it
showed Drools flow model checked successfully. My .rf and .rfm files were
created.
But when I imported .rf file in my guvnor and build the package I am getting
the following error : Unable to parse xml
When i checked the server log, only this was printed :
(null: 1, 93): cvc-elt.1: Cannot find the declaration of element
'org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper'.
This is the source of the generated .rfm file
1
1
Start
1
ailmentreserves
2
AilmentReserves
1
benefitreserves
3
BenefitReserves
1
4
End
2
3
4
4
resistrationflow
RuleFlowTest
1.0
RuleFlow
HealthCareTest
Am I missing anything. Should the package name in the eclipse same as the
package I use in guvnor ?
I have only the rule flow file in Eclipse and remaining are written directly
in guvnor.
Any hint on this will be of great help.
Regards,
Dinesh
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-rule-flow-in-Gu...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 1 month
Chained Rules
by djb
Hi all,
I know there are some basic ways to chain rules together, by setting flags
in consequences that are checked in the conditions of other rules...
but in a large system based on rule templates, where thousands of rules are
generated, it is not feasible to chain rules in this manner, especially when
they are chained in a somewhat arbitrary fashion
(eg. True if Rule 130 AND Rule 200 AND Rule 480 fire)
has anyone had this situation before? would I need to execute this as a
post-processing step? or, is there any design pattern that will allow rules
to be chained, preferably in a manageable way?
regards,
Daniel
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Chained-Rules-tp77549...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
I'd like to get Drools 5.0
by 多田丈晃
Hi,
Does anyone know where I can get older version Drools archive?
On my work, I need to use Drools 5.0.
but In Drools download page only have latest version.
Please let me know where is older version archive download page.
14 years, 2 months
Re: [rules-users] Incorrect allowable comparison when using Guvnor GUI Rules - known bug?
by Alex.Porras@dds.net
Stephen Mcgruer <s0840449 <at> sms.ed.ac.uk> wrote:
> Now, I want to match on the fooBar's barInt property being less than a
hundred. So, I click on fooBar,
> and choose the 'barInt' subfield. It appears, *BUT* there is no option
for "is greater than" or "is
> less than", only "is equals to" and "is not equals to"!
I recently downloaded drools 5.1.1 and am experiencing the same issue.
Anyone else?
Cheers,
Alex
14 years, 2 months