Hashing in JoinNode and CompositeObjectAdapter
by Philipp Herzig
Dear developers,
I have a question regarding the current implementation within reteoo.
In both cases, the JoinNode and CompositeObjectAdapter is doing a linear
search for Joins and "Splits" respectively.
For the BetaNodes the decision using lists or maps is done in
SingleBetaContraints() (line 82)
this.indexed = depth >= 1 && DefaultBetaConstraints.isIndexable( constraint
);
However, the MVELContraint (constraint) always returns false for an
equijoin predicate (always the MVELContraint constructor without index flag
is called). Consequently, createBetaMemory() creates lists rather than
maps. These are finally joined in assertLeftTuple and assertObject of the
JoinNode with complexity 2n-1.
(Note: Of course, IndexLeftBetaMemoryOption.YES
and IndexRightBetaMemoryOption.YES are set but ignored according to the
SingleBetaContraints' constructor).
Relatively similar the CompositeObjectAdapter:
While propagating objects (CompositeObjectAdapter.propagateAssertObject)
the method asks if a fieldIndex is hashed which always returns false.
However, I cannot find any possibility to set this flag to true.
Interestingly the fields are added to a collection called
hashedFieldIndexes in FieldIndex.registerFieldIndex. Moreover the code for
dispatching to the right sink via hashcode is there, but is not reachable
anyway.
Are there any design related reasons for not supporting this or am I
missing something? If not, I would love to open a FR for that. If someone
helps me in setting up the mvn stuff I could do that myself.
(Version 5.4.0.Final)
Thanks,
Philipp
13 years, 4 months
Re: [rules-users] How to deploy drools 5.5 on weblogic in eclipse
by droolist
The trace indicates there is an attempt to connect to a DB running on your
local.
I doubt Drools is trying to connect to a DB, unless you have objects in your
rules that access DB.
It looks like you are getting this error while deploying a webservice that
happens to use Drools Expert jars.
it is possible that this is coming from your application code and not
Drools.
I see you have another post on Guvnor 5.5 and Weblogic 11. I had no success
with that either. I had a similar post and didnt get any response. so, I
doubt anybody has done that succesfully. WLS 11 is jee5 and does not support
CDI. Even with WLS 12 (jee6), I couldnt as there seems to be conflicts with
wls and weld cdi implementations. I'll watch your other post to see if
anybody responds as I am curious as well.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-deploy-drools-5-5-on-weblogic-in...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Cannot invoke method because of ArrayIndexOutOfBoundsException
by Bojan Janisch
Hello Guys,
sorry to bother you with this problem, but I'm out of ideas.
I'm using Drools in textmining-context and in basic I have
a function that checks 2 named entites for equality to
ensure that the entities are all different and that the rules
do work only on different named entity objects:
public static boolean isEqual(Annotation a, Annotation b){
if(a.equals(b)){
return true;
}
return false;
}
Sometimes there are conditions that need tests of more than
2 named entites. For this I've written a super method that
calls the isEqual method in a loop:
public static boolean isEqual(Annotation... a){
ArrayList<Annotation> outLoop = new ArrayList<Annotation>(Arrays.asList(a));
ArrayList<Annotation> inLoop = new ArrayList<Annotation>(Arrays.asList(a));
for (Annotation anno1 : outLoop) {
inLoop.remove(anno1);
for (Annotation anno2 : inLoop) {
if(isEqual(anno1,anno2)){
return true;
}
}
}
return false;
}
My rules could (theoretically) now call the function
eval(isEqual($ne1,$ne2)) or
eval(isEqual($ne1,$ne2,$ne3) or even
eval(isEqual($ne1,$ne2,$ne3,$ne4,$ne5)) and so on.
So there starts my problem:
Each time I'm getting an ArrayIndexOutOfBounds Exception from the second
method that looks like this:
java.lang.RuntimeException: cannot invoke method: isEqual
...
at java.lang.Thread.dispatchUncaughtException(Thread.java:1888)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:149)
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
...
Could someone explain me what's wrong with my code? Thanks for any help.
Greetings
JB
13 years, 4 months
Working on the complete solution set on Drools Planner
by lbrito
Hi,
I am thinking about using Drools Planner for an internal project related to
order scheduling. It would in essence be a jobshop where we have 3 main
machines which are always followed on the same specific order (and we have
release dates for each task).
I thought about a solution that would shuffle the job sequences on each
machine looking for the best combination. However, the problem is that when
applying the rules on the drl to the score calculation I would need to
"pre-process" the solution in order to determine start-dates and end-dates
for all tasks/jobs.
Is there a way to access the complete solution from the drl, mash-up the
information and use it in the score calculation?
Kind Regards,
Luis
--
View this message in context: http://drools.46999.n3.nabble.com/Working-on-the-complete-solution-set-on...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Why no auto-retraction after adding this temporal rule?
by Ladd
I'm attaching a small standalone java program to demonstrate this. The code
should be self explanatory. But in a nutshell, I'm feeding events into this
rule:
rule averageOverTime
when
$avg: Number() from accumulate (
MyEvent( key == 'someKey', $val : value ) over window:time( 200ms
),
average( $val ) )
then
System.out.println( "--- $avg in then clause is " + $avg );
end
I set up a loop to feed events in and I do see the rule fire and my averages
print out as I'd expect. I also set up a session listener to see if events
are automatically expired/retracted. And they are.
The trouble begins when I add this rule:
rule RetractionBreaker
when
$a : MyEvent( key == 'A' )
MyEvent( key == 'B', this after $a )
then
System.out.println( "--- just saw A followed by B" );
end
Whether or not I inject events with key 'A' or 'B', no events of any kind
are ever automatically retracted.
Why is that?
Thanks for helping me understand this!!
- Ladd
NoRetractionTest.java
<http://drools.46999.n3.nabble.com/file/n4022716/NoRetractionTest.java>
--
View this message in context: http://drools.46999.n3.nabble.com/Why-no-auto-retraction-after-adding-thi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months