Mechanism to prevent redundant inferences
by Tracey Lall
Hi folks
I am writing a logical inference engine in drools. Logical sentences (class
Sentence) which are proven are indicated by the fact Proven( sentence =
$sentence )
All Proven(sentence) facts are asserted using the drools logical mechanism
(since logical backtracking is required).
For efficiency purposes I want to be able to suppress firing any rules which
assert proof of a logical sentence which has already been proven (there may
be multiple inferences which prove the same sentence).
If the non existence of a proof of a sentence (not exists
Proven(sentence=$sentence) is included in the lhs conditions then that
causes problems when the rule logically asserts Proven(sentence) since the
insertion invalidates the lhs conditions and hence the rule causes its own
retraction (the inserted fact handle return is null).
As a way around this I created a class Piton() to record whether a
particular rule has fired. The lhs conditions then become:
(Proven( predicate == $sentence ) or Piton( fireName == $descriptor ) )
And then in the body of the rule the first thing it asserts is the fact:
Piton( fireName == $descriptor )
Where $descriptor is a string built from the rulename + the set of facts
which matched the lhs (ie a descriptor which is unique to the rule fire)
With this approach when a rule asserts Proven(sentence) because it has also
asserted Piton( fireName == descriptor ) ) the lhs of the rule still
matches the the rule fire is not retracted.
This approach works, but it is rather tedious to implement since the
descriptor must be defined in such as way to make it unique (or as far as
possible unique) to the particular rule activation. Since the drools
variable is not accessible in the lhs of a rule (and hence the activation
details are not accessible in the lhs), this means that the descriptor must
be handcoded to consist of all matching facts for that lhs.
Is this approach the only way to prevent multiple rule firings for the same
proof, or is there a simpler way to achieve this?
Any advice greatly appreciated!
thanks
Tracey
16 years
Deep Links in Guvnor
by Jörg Herbst
Hi,
I'm currently evaluating Guvnor. The application is really great for
managing rools for none developers. But I've got a special requirement.
Is it possible to provide deep links for editing assets or a list of
assets? I'm looking for a way to create something like a bookmarkable URL
when using the navigator which can be used in another web application.
The background is, I've got different usergroups editing different rules and
I'm looking for a way linking to guvnor and displaying "their" rules.
"Their" can be defined by a package or some naming convention.
Any ideas?
Joerg
16 years
Drools upgrade from 3 to 5 - '||' OR syntax
by Nars
We are migrating couple hundred rules from Drools 3 to 5.
We have rules like below.
rule "Test rule"
salience 100000
when
core : BWCore(systemId == "1" ) ||
BWCore(systemId == "2" ) ||
BWCore(systemId == "3")
then
System.out.println( "bwid: " + core.getBWIntId());
end
This rule works fine in 3, but in 4 and 5 it throws below exception when we
insert a BWCore object with systemId 2. The same works fine if the object
inserted has systemId as 1.
org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
at com.sample.BWTest.main(BWTest.java:32)
Caused by: java.lang.NullPointerException
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
at
com.sample.Rule_Make_BossBWs_FABWs_and_TMCBWs_retail_bws_0ConsequenceInvoker.evaluate(Rule_Make_BossBWs_FABWs_and_TMCBWs_retail_bws_0ConsequenceInvoker.java:15)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
... 6 more
Is this kind of || syntax no longer supported in 4 and 5?
Thanks
--
View this message in context: http://n3.nabble.com/Drools-upgrade-from-3-to-5-OR-syntax-tp471205p471205...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Guvnor users and case sensitivity
by Régis Ramillien
Hello all,
I wonder if I can easily disable the case sensitivity for the user login in
guvnor.
My users credentials are stored in an LDAP and the server does not ask for
case sensitivity.
Therefore, for each application, if a user is named "fr001", he can also log
as "FR001".
But in guvnor, if the administrator create the user "fr001", then, this user
will not be able to log as "FR001" even if he is successfully authenticated.
Guvnor returns the error "This user has no permissions setup.".
Can we easily disble this, please ?
Regards,
Régis Ramillien
16 years
Process with WSHumanTaskHandler
by nanic23
Before I try to get an example working I thought it would be a good idea to
post this as it might just be a quick answer to my question.
Lets say I have a process with a Human Task and I'm using
WSHumanTaskHandler.
(Start) --> [Action] --> [Human Task] --> [action] --> ......... --> (end)
The process requires manual intervention (approval from supervisor) so when
I get to Human Task my process will get persisted.
Now, it is not until next day that the supervisor makes the approval and the
Human Task gets mark as completed.
Question: will my process be resumed after this and run to completion? or
human task will be marked as complete but process will NOT continue?
Thanks!!!
--
View this message in context: http://n3.nabble.com/Process-with-WSHumanTaskHandler-tp469303p469303.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Process in GWT Console
by nanic23
I can run simple processes through the gwt console but now I'm trying to
deploy a process that uses a WorkItemHandler. Gwt console server doesn't
know about this work item handler and when execution gets to that point it
complains saying that it didn't find a work item (Of course!!!).
So, question is..... How do I register my work item handler and make
gwt-console-server aware of it so it can find it at execution time?
Thanks
--
View this message in context: http://n3.nabble.com/Process-in-GWT-Console-tp468883p468883.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years
Junit, PseudoClock and NPE
by Makewise - Vitor Rui Mendonça
Hi folks!
First time in this mailing-list, with very little experience in Drools (Fusion, regarding CEP).
I hope that someone could help me out J
I've being investigating about this issue and I'm not getting any answer.
Here's the problem:
I've got a DRL file with a simple rule:
rule "...."
when
$offline : Event( code == "101", $offlineLane : lane ) from entry-point "incoming"
not ( $online : Event(code == "102", lane == $offlineLane, this after [0s,3m] $offline ) from entry-point "incoming" )
then
// some code here
end
What I want is: when there's an offline for more than 3 minutes *without* any online event (meanwhile), that execute the rule.
I've got JUnits, with Drools configured with STREAM mode and PSEUDO clock.
All is good in JUnit world except in this testcase:
· Insert an offline event (workingMemoryEntryPoint.insert( offlineEvent );)
· Clock advances 2m50s (clock.advanceTime(2,TimeUnit.MINUTES );clock.advanceTime(50, TimeUnit.SECONDS );)
· Insert an online event (workingMemoryEntryPoint.insert( onlineEvent );)
· Clock advances 0m15s (clock.advanceTime(15,TimeUnit.SECONDS );)
· Assertion error: the rule runs when it shouldn't (online event cancels offline event).
I've got no clue about this but I have some more interesting info:
· When clock advances 0m15s, there's an NPE on a LinkedList:
java.lang.NullPointerException
at org.drools.util.LinkedList.remove(LinkedList.java:113)
at org.drools.common.Scheduler$DuractionJob.execute(Scheduler.java:71)
at org.drools.time.impl.PseudoClockScheduler$ScheduledJob.call(PseudoClockScheduler.java:219)
at org.drools.time.impl.PseudoClockScheduler.runCallBacks(PseudoClockScheduler.java:168)
at org.drools.time.impl.PseudoClockScheduler.advanceTime(PseudoClockScheduler.java:130)
· I haven't any code/rule that retracts events (I shouldn't have it for this case, right?)
· I've tried Drools 5.0.1 and 5.1.0.M1, with the same results
· The issue causing NPE, I've found an old issue regarding Drools 3.0.4 and the bug was corrected in 3.0.5 (https://jira.jboss.org/jira/browse/JBRULES-455)
· I think that someone wrote about this error (in Drools 5) but I don't have the link to it.
Thanks In Advance!
Best regards,
Vítor Mendonça Moreira
Analista / Programador
Direcção de Investigação e Desenvolvimento
Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.
2500 - 206 - Caldas da Rainha
Tel: (+351) 262 832 196
Fax: (+351) 262 186 455
Web: www.makewise.pt <http://www.makewise.pt>
Uma empresa: Grupo Sousa Pedro <http://www.sousapedro.com>
16 years
NullPointerException while inserting Facts
by Sebastian Furth
Hi,
we are currently trying to integrate DROOLS 5.1 in our project.
In our Project we have two different kinds of Facts, called Values and
Inputs. We don't have any problems with inserting Input instances but
sometimes when we try to insert an instance of the Value class (@see:
http://www.pastie.org/private/juv7hh7rxahpluo5agu3q) we get the following
NullPointerException:
java.lang.NullPointerException
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
at
org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)
at
org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)
at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:98)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:34)
at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:123)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
at de.d3web.we.drools.DroolsAction.addFacts(DroolsAction.java:296)
at
de.d3web.we.drools.DroolsAction.createKnowledgeSession(DroolsAction.java:268)
at de.d3web.we.drools.DroolsAction.execute(DroolsAction.java:67)
The weird thing is that we don't get this exception with all instances of
the Value class - some of them can be inserted, others not. The objects are
created correctly - we've already debugged this. The crash happens somewhere
deeper in the drools api.
It would be really great if you could give us a hint how we could fix this
problem.
Thank you in advance.
Best regards
Sebastian Furth
16 years