Partial Unification / Derivation of Facts?
by JohnnyCaimbridge
NOTE: Reposted because I only just subscribed to the mailing list.
Hello,
I have a set of Fact types which represent factors matched and used
throughout the other rules. Each of these Fact types may be derived in a
variety of mutually exclusive ways--ie based on the line of business or
other factors. The rules are all well-defined for these Facts. Something
like this:
declare FactorType1
value : BigDecimal
end
rule "FactorType1"
when
LineOfBusiness( this == LineOfBusiness.LOB1 )
// some other conditions
$prms : Params() // ***provisional*** where to specify needed context
dependent parameters? see below
then
BigDecimal value = new BigDecimal("0");
// ... determine value based on conditions and $prms
insert( new FactorType1(value) );
end
// <some other mutually exclusive rules to derive FactorType1 here>
The problem is that in the rules which match these Facts, there are many
context dependent (ie *always* unique to that particular rule) parameters
which must be "passed" to the derivation of those Facts. I'm referring to
these as "Params" above. Now, a rule that uses FactorType1:
rule "a rule that uses FactorType1"
when
// some conditions
FactorType1( $value )
$prms : Params(prm1,prm2,prm3,...) // ***provisional*** how to indicate
that FactorType1 should use these parameters in its derivation?
then
// perform some calculation with $value
end
The parameters which these Facts use cannot be asserted as Facts themselves.
They are unique to the rules which match on the FactorTypes, so that would
mean I'd need a duplicate rule for every rule that uses a FactorType (even
with "rule inheritance", this is excessive).
It's almost as if I need to specify a "partial derivation" or "partial
unification" of the Fact type, which is only asserted once a rule indicates
that it is providing the "unbound" portion of the derivation. I understand
queries can be used for some sort of partial unification, but I have no clue
how to apply them to my problem and I can't find any good examples or
documentation on their usage/behavior.
Thanks in advance
--
View this message in context: http://drools.46999.n3.nabble.com/Partial-Unification-Derivation-of-Facts...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
java.lang.IncompatibleClassChangeError: Found interface org.drools.reteoo.LeftTuple, but class was expected
by danielje
Hello drools users.
I'm developing a project that uses drools and jbpm2. I have a simple jbpm2
diagram that contains a few workItems, ruleflow groups and gateways.
I'm getting the following exception when the process flow goes into first
ruleflow-group:
java.lang.IncompatibleClassChangeError: Found interface
org.drools.reteoo.LeftTuple, but class was expected
2011-09-22 08:54:09,125 INFO [STDOUT]
(org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) at
tele2Demo.Rule_Load_Data_Tray_0DefaultConsequenceInvoker.evaluate(Rule_Load_Data_Tray_0DefaultConsequenceInvoker.java:17)
2011-09-22 08:54:09,125 INFO [STDOUT]
(org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:906)
2011-09-22 08:54:09,125 INFO [STDOUT]
(org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:845)
2011-09-22 08:54:09,125 INFO [STDOUT]
(org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1056)
...
The problem occurs only when I read a ChangeSet.xml from remote guvnor
repository.
When I read rules from local path the error does not occur.
The jars I use:
drools-compiler :5.2.0.Final
drools-core :5.2.0.Final
drools-persistence-jpa :5.2.0.Final
knowledge-api-5.2.0.Final
jbpm-bpmn2-5.1.0.Final
jbpm-flow-5.1.0.Final
jbpm-flow-builder-5.1.0.Final
jbpm-persistence-5.1.0.Final
I verified the history of LeftTuple and indeed it was a class in all 5.2.0
release beside the Final where it was changed to interface.
Does anyone here have any idea how to get rid of this error? Are newer
versions of jppm packages using LeftTuple interface instead of class?
Best regards
/danielje
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-IncompatibleClassChangeError-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Maven Drools Plugin needs proper de-serialization support from DroolsStreamUtils
by Ansgar Konermann
Hi all,
I think I've found a bug in DroolsStreamUtils.
It does not allow to deserialize a collection of KnowledgePackages with
dependencies between the packages. In this case, it fails with
ClassNotFoundException.
Example: Package A contains a type declaration, package B contains a
rule using this declaration. Compilation and serialization works fine,
but deserialization fails (complains that it cannot find declared type).
As it seems, the deserialization code does not consider classes
resulting from declared types when resolving type references.
This is true for Drools 5.2.0.Final, 5.3.0.CR1 and 5.3.0.Beta1. It works
fine for 5.1.1.
I was so bold to create a JIRA ticket for this problem right away:
https://issues.jboss.org/browse/JBRULES-3225 (with unit tests attached).
The functionality provided by class DroolsStreamUtils is essential for
the Maven Drools Plugin (compiler needs to serialize stuff, which then
needs to be *de-serializable* by applications).
If anyone is interested in using the upcoming Maven Drools Plugin to
compile rule source code into binary package files and *load* theses
packages from your application, please *vote* for this JIRA ticket, as
the maven plugin *must* rely on serialization functionality *provided by
drools* (a re-implementation is certainly out of scope and would be
more than "prone" to incompatibility). Without a fix or at least a
workaround for this bug, the maven plugin will only be able to work with
Drools 5.1.1 (newer versions are broken, older versions did not include
DroolsStreamUtils at all AFAIK).
Thanks in advance, to everyone who will contribute to a potential
solution or workaround.
Best regards
Ansgar
13 years, 3 months
How to terminate a StatefulKnowledgeSession
by bishopmm
I'm using Drools to build a wizard app within a web application. The
StatefulKnowledgeSession runs within its own thread. After loading the
rules, I call fireAllRules() to start the knowledge session. Within the
wizard app, the user has the option to click on a cancel button in order to
stop the wizard. When the user cancels the wizard, a rule is fired that
attempts to stop the knowledge session. I've tried calling drools.halt() and
drools.getWorkingMemory().clearAgenda() from within that rule, but
fireAllRules() doesn't return, and the thread is left hanging. What do I
need to do to get fireAllRules() to return? I'm fairly new to Drools, and I
apologize in advance if I've missed something blatantly obvious.
Thanks,
Mike
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-terminate-a-StatefulKnowledgeSes...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Weird human task behaviour
by HMandic
I have this strange problem, when I call
int taskId = 105; // dummy taskId, the real one is obtained
through TaskSummary
BlockingTaskOperationResponseHandler b = new
BlockingTaskOperationResponseHandler();
client.complete(taskId, "myusername", null, b);
while (!b.isDone()){
b.waitTillDone(100);
}
System.out.println("Completed task "+taskId+" owned by user
myusername.");
I get this in the log:
INFO [STDOUT] Completed task 105 owned by user myusername.
INFO [STDOUT] Notification of completed task 104
...and about 50 milliseconds later...
INFO [STDOUT] Notification of aborted task 104
No error messages between these two notifications.
I understand that these ID's are not the same because 104 is actually
workItemId that holds taskId 105.
The status of task 105 in the database table "task" is "Completed", but the
workflow stops after it and I can't do anything about it.
Is there any known issues with task persistence in JBoss 5.1 or something?
--
View this message in context: http://drools.46999.n3.nabble.com/Weird-human-task-behaviour-tp3368608p33...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Re: [rules-users] drools-server empty response body
by lhorton
In my test, I posted the set-global command along with the rule execution
commands, like this (snippet):
List commands = new ArrayList<Command>();
commands.add(CommandFactory.newSetGlobal("logger", logger));
commands.add(CommandFactory.newInsert(fact, "outId"));
commands.add(CommandFactory.newFireAllRules());
BatchExecutionCommand batchCommand =
CommandFactory.newBatchExecution(commands, "ksession");
.....etc.
(I had configured the ksession as stateless)
--
View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp319...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months