Intersecting two collections in LHS
by Hezi Stern
I have in the working memory all possible sentences that can be presented to
the user ( class Sentence() ).
Each sentence holds a collection (String collection) called descriptor that
describe the sentence.
Based on various rules I populate a collection called messageFilter which
will be used to select the appropriate sentence.
The proper sentence is one that all its descriptors match the one in the
messageFilters
What I would like is something of the sort:
$sentences: ArrayList()
from collect (Sentence(descriptor contains messageFilter)
as messageFilter is a collection, this is not a valid code.
What would be the proper method to implement it.
I am using drools 5.1.1 but am willing to upgrade to 5.2 if required.
Thanks,
Hezi
13 years, 5 months
OutOfMemoryError happens when dynamic loading of Rules from Guvnor frequently
by Oliver Liu
I am using Drools 5.1.1 to design our rule engine, the rule engine need to
dynamic loading of rules from Guvnor because our marking team need to change
the rules frequently(about 40~100 times every day), we have over 5000 rules
in Guvnor.
This is my code ahout that:
public KnowledgeBase getKnowledgeBase() {
// hold a static reference in class
if(kagent != null) {
return kagent.getKnowledgeBase();
}
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "5");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset-url.xml"));
return kagent.getKnowledgeBase();
}
This is content of changeset-url.xml:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource
source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Pack...'
type='PKG' />
</add>
</change-set>
After i start my service, i found each time When i rebuild package and
created new snapshot to snapshot_release, my service indeed can find the
changing and start to reload rules from guvnor, but memory increased about
50M, it didn't down even if the reloading had finished. After i reput do
this step many times(about 25 times), OutOfMemoryError happened.
So, I want to know, why memory increased continually?It sames drools didn't
do garbage collection.
Has anyone experienced this?
Thanks
- Oliver
--
View this message in context: http://drools.46999.n3.nabble.com/OutOfMemoryError-happens-when-dynamic-l...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Filtering activations in stateless sessions
by drdaveg
Creating an AgendaFilter in stateful sessions is straightforward. Although
there are many API's that seem like they would foster discarding /filtering
rule activations in stateless sessions, each family of API seems to be
missing a key method to filter activations.
Can anyone suggest a way that works to filter rules from firing in stateless
sessions?
Command executors can use FireAllRules on a stateless session, but not with
an AgendaFilter.
Event listeners can detect rule activation events, but there doesn't seem a
way to ignore (e.g., not "accept") an activation.
Perhaps this can be accomplished by explicitly disposing of an activation
from a listener that detects this, but this approach seems like it could
have other consequences. Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Filtering-activations-in-stateless-sess...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
What does guvnor do when importing a global DSL? a snapshot or a link?
by James Gu
Hi,
I am using guvnor-5.2.0.CR1-jboss-as-5.1.
I created a DSL file in global area and imported it into package
"testpackage". I created a business rule based on it in package.
Today I added some new items in the DSL file and found I can't use it in the
business rule in package, the new item is not in the select list. I created
a business rule in global area and I can see the new item. It seems that the
package keeps a snapshot for global area, not a link. Is this a bug? If not,
how can I update the snapshot for package. I tried to import it again but
get error "the assert is already imported."
Thanks,
James
--
View this message in context: http://drools.46999.n3.nabble.com/What-does-guvnor-do-when-importing-a-gl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Guvnor 5.2 CR1 under IE8
by Vincent LEGENDRE
Hi all
I was using firefox for Guvnor, every thing was well.
But here, users use IE 8, and under IE8, Guvnor displays some strange list of icons in place of some other icons :
- validate rule dialog : in place of the check (or error icon) : a big image containing all icons
- new rule dialog : category icons are replaced by the same big image
- history part of a rule : one more time the same big image
Does anyone has the problem ?
Does anyone uses IE :) ?
I suspect something like GWT using a big image as a cache, and some javascript to display only a small part of it, and this javascript is not compatible with IE. Make sense ? If yes, is there a workaround ?
13 years, 5 months
Rule Templates - comma separated data
by Witham, Darren
I have successfully generated a .drl file from a decision table. The column headers in this table made use of the forall(||) construct which happily parsed the corresponding comma separated data in the relevant spreadsheet cell to nice || separated conditions.
We have since decided to use the template approach so we can store rule data in a db. We ideally want to store this data as key/value pairs in a db table where the values may contain comma separated data. The intention being these values would be processed as per the decision table.
How is this achieved using a template ? I note that a column can be denoted as an array column by adding [] i.e.
template header
column[]
However, although this appears create an ArrayColumn parser, and splits the comma separated data when running through a debugger, any attempt to access it in the template falls over in mvel code trying to call HashMap.column
Any examples on how to set this up ?
Thx
13 years, 5 months
comma on LHS in dsl
by Saleem Lakhani
Hi there,
I had something like this in drools 3.0 and it used to work but after I
upgraded to drools 5.0 it doesn't work.
[when]The Roof is not Type A , Type B , Type C , or RC=LM(rda != null,
rda != "A", rda != "B", rda != "C", rda != "R")
But to compile it now I had to make the following changes on both LHS
and RHS:
[when]The Roof is not Type A not Type B not Type C not RC=LM(rda != null
&& rda != "A" && rda != "B" && rda != "C" && rda != "R")
Why does the , on the LHS doesn't compile?
Thanks,
Saleem
13 years, 5 months
Drools' use of hashCode
by M. H.
Hi all,
I have encountered a situation I don't quite understand, I would be happy to
have some explanations about it. This is my first post here and I'm quite
new to all this so don't be afraid to go back to basics if I'm missing
something:
I have 3 classes :
public class Child
{
private Date time;
+get
+set
+constructor
}
public class Father
{
private Child child;
private int value;
+get
+set
+constructor
public void setTime(Date d)
{
child.setTime(d);
}
}
public class GdFather
{
private Father father;
+get
+set
+constructor
}
then 2 rules :
rule "1"
when
$father : Father(value==1)
then
$father.setTime(new Date(2));
$father.setValue(0);
update($father);
end
rule "2"
when
$father : Father()
$GdFather : GdFather(father==$father)
then
System.out.println($father);
end
////////////////////////////////////////
I didn't change the identity assert behavior, I insert a father and the
corresponding GdFather in the workingMemory, and all seems to work OK.
The issue occurs when I override the hashCode function in the Father class :
if I use this definition :
@Override
public int hashCode()
{
return child.getTime().hashCode();
}
then rule 2 is not fired after modification of the father, and is not either
if I change the function to return child.hashCode() with a Child hashCode
returning time.hashCode().
This also happens with a properly overriden equals function, and both Drools
5.1.1 and 5.2.0.CR1.
What I don't understand is why is it using the overriden hashCode function
with an identity assert behavior? What is it used for? And it looks like it
is using the overriden hashCode, but not equals, is that correct, and if so,
why?
How can I get the second rule to fire and have a custom hashCode() ?
Thank you in advance for your answers,
M.H.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-use-of-hashCode-tp3090424p309042...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months