Guvnor custom form not working for DSL sentences
by GPatel@tsys.com
Hi
Is the guvnor custom form not meant for use with fact fields appearing in
dsl sentences? It works fine with guided editor, not with dsl though.
Using 5.3.CR1
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 4 months
Online 5.3.0 javadocs
by Martin A
Hello,
I'm looking for the online 5.3.0 javadocs, but can't find it... Would you
point me to a reference?
Thanks,
Martin
14 years, 4 months
rule fires several times
by elsdestickere
Hi,
The Expert documentation says " a rule may fire once or several times", but
I don't understand why a rule sould fire several times if the objects state
does not change?
I have an example of a Customer object inserted in the Working Memory, with
2 rules that should fire, but the last rule fires twice.
Can someone explain?
rule "isAdult"
when
k : Customer( age(date)>=18, adult==false );
then
modify( k ) { setAdult(true) };
System.out.println( "Drools "+drools.getRule().getName()+": "+
k.getAdult() );
end
rule "WM"
when
k : Customer( ) ;
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName());
end
...
Customer bert = new Customer ();
bert.setName("Bert");
bert.setDate(30);
ksession.insert(bert);
ksession.fireAllRules();
...
Output:
Drools WM: Bert
Drools isAdult: true
Drools WM: Bert
Br,
Els Destickere
--
View this message in context: http://drools.46999.n3.nabble.com/rule-fires-several-times-tp3466250p3466...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
global as link to DB: different results
by elsdestickere
Hi,
I read docs about global and Hibernate to access your DB from the rules.
I tried something simular for in memory DAO's.
But some rules fire ("WM" in RHS) as the DAO has 3 items, but others ("dao"
in LHS) don't, how is that possible?
global RepositoryFactory repFact;
rule "dao"
when
k : Customer( ) from repFact.getCustomerRepository().findAll();
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName());
end
rule "WM"
when
k : Customer( ) ;
then
System.out.println( "Drools "+drools.getRule().getName()+": "
+k.getName()+" + size: "+repFact.getCustomerRepository().findAll().size());
end
...
RepositoryFactory repFact = Registry.getRepositoryFactory();
ksession.setGlobal("repFact", repFact);
...
CustomerRepository customerRepo = Registry.getRepositoryFactory()
.getCustomerRepository();
customerRepo.add(tom);
customerRepo.add(elise);
customerRepo.add(bert);
ksession.insert(bert);
ksession.fireAllRules();
...
Output:
Drools WM: Bert + size: 3
br,
Els
--
View this message in context: http://drools.46999.n3.nabble.com/global-as-link-to-DB-different-results-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Sliding Length Windows
by diana-mendes
Hello,
I'm having trouble using sliding length windows. Either I'm implementing
them wrong or I have misunderstood how they're supposed to work.
I have a class named Notif:
*public class Notif implements Serializable{
...
private String specificProblem;
...
public String getSpecificProblem() {
return specificProblem;
}
public void setSpecificProblem(String specificProblem) {
this.specificProblem = specificProblem;
}
}*
These Notif's represent my events. I want to know how many Notifs with
specificProblem "New ONT" are there in the last 2 received events.
My .drl file looks like this:
*declare Notif
@role( event )
end
rule "Rule1"
when
$event : Notif()
$nNewONT : Number() from accumulate (
Notif( specificProblem == "New ONT" ) over window:length(2), count() )
then
System.out.println("In the last 2 events there were "+$nNewONT+" events
'New ONT'");
end*
My test file:
*...
session.insert(ONTIsInactive1);
session.insert(newONT1);
session.insert(ONTIsInactive2);
session.insert(newONT2);
session.insert(LOKS1);
session.insert(LOKS2);
session.insert(LOKS3);
session.insert(newONT3);
session.fireAllRules(); *
As you probably can tell by the names, the events I'm looking for are the
2nd, the 4th and the last one.
But the output I get is:
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
In the last 2 events there were 2 events 'New ONT'
The output I'm looking for is:
In the last 2 events there were 0 events 'New ONT' (because the received
event is "ONTIsInactive")
In the last 2 events there were 1 events 'New ONT' (because the last 2
received events are "ONTIsInactive" and "New ONT")
In the last 2 events there were 1 events 'New ONT' (because the last 2
received events are "New ONT" and "ONTIsInactive")
...
and so on...
What am I doing wrong? Any help would be appreciated!
Thanks in advance,
Diana
--
View this message in context: http://drools.46999.n3.nabble.com/Sliding-Length-Windows-tp3438408p343840...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Time Window
by diana-mendes
Hello,
I want to implement a simple scenario using Drools, but I can't find the
right functions to do so.
I have a class named Notif that represents my events.
When I receive a Notif with a certain attribute (for example, type == "A") I
want to get a list of all the events I receive in the next 10 seconds.
If I receive a second event of type "A" during those 10 seconds, I don't
want to start another count. It should only restart the count after the 10
seconds have expired.
Example:
1s: Notif (type=="A") should start the 10 second count
2s: Notif (type=="B")
3s: Notif (type=="C")
4s: Notif (type=="A")
5s: Notif (type=="D")
12s: Notif(type=="E")
10 seconds after the first Notif(type=="A") I would like to receive the
following list:
Notif (type=="A")
Notif (type=="B")
Notif (type=="C")
Notif (type=="A")
Notif (type=="D")
Note that Notif(type=="E") (at 12 seconds) should not be in the list because
it's outside of the 10 seconds interval. Also, note that the second
Notif(type=="A") (at 4 seconds) should not start a new count because it's
included in the 10 seconds interval.
Thanks in advance,
Diana
--
View this message in context: http://drools.46999.n3.nabble.com/Time-Window-tp3468566p3468566.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Turning off strict mode
by Alexander
Hello.
Is it possible to turn off strict mode in Drools 5.2 or 5.3 like in 5.1? How
can i do it?
We use Drools 5.1 and we use lots of maps so we turned off strict mode. I
tried to switch to Drools 5.2 or 5.3 but setting
System.setProperty("drools.dialect.mvel.strict", "false") doesn't work with
those versions. Our domain model is basicaly a hierarchy of Maps without
generics so using strict mode will force us to write alot of casts. This is
not acceptable cause we want our non technical guys to write some rules. One
of our goals was to make it possible to update our application without
recompiling and redeploying any java code only rules and flows, thats why we
have such "domain model".
--
View this message in context: http://drools.46999.n3.nabble.com/Turning-off-strict-mode-tp3468094p34680...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Does window:length work in Drools version 5.1.1 ?
by eskomk
Drools-expert 5.1.1
Does window:length work in Drools version 5.1.1 ?
It seems that "over window:length( 5 )" in rule "PossibleFFF_launch_level1"
does not work.
It seems that it returns only the last MMMBean added in trackers in rules
"PossibleFFF_Level1_update_tracker_count" and
"PossibleFFF_Level2_update_tracker_count".
The idea here is that trackers keep count of how many MMMBeans have entered
the system, after incoming BBBBean with bbbEmpty == true have initiated the
tracking (PossibleFFF).
App domain specific operations are launched if there is no active counts
(actCount) in a series of MMMBeans ("PossibleFFF_launch_level1" and
"PossibleFFF_launch_level2").
actCount is an integer but accumulate function sum apparently returns a
floating point number, hence the check "doubleValue < 0.5".
Rules "PossibleFFF_kill_tracker_with_bbb" and
"PossibleFFF_kill_tracker_with_count" are to retract the trackers from
memory, so ending the tracking.
Rule "PossibleFFF_kill_tracker_with_bbb" kills this profileID's tracker if
bbbEmpty == false.
Rule "PossibleFFF_kill_tracker_with_count" kills tracker if count > 5, count
indicating that no operations were launched ("PossibleFFF_launch_level1" and
"PossibleFFF_launch_level2").
Problem is, that the condition
$theSum : Number(doubleValue < 0.5) from accumulate(
// MMMBean( $actCount : activeCount) over window:length( 5 ) from
$tracker.mdsBeanList,
MMMBean( $actCount : activeCount) over window:length( 5 ) from
$tracker.getMdsBeanList(),
sum( $actCount ) )
in rules
"PossibleFFF_launch_level1" and "PossibleFFF_launch_level2"
does not seem to work as expected.
I expected that the sum would be calculated from field MMMBean.actCount over
all MMMBean members of list $tracker.mdsBeanList.
It seems that sum returns only the actCount of last MMMBean which was
inserted in $tracker.mdsBeanList.
Is there something wrong with the rules ?
Rules are like these:
// RULES -->
rule "PossibleFFF" dialect "mvel"
when
$bsb : BBBBean(bbbEmpty == true)
not FFFTracker(profileID == $bsb.profileID)
then
FFFTracker $tracker = new FFFTracker();
$tracker.level = 1;
$tracker.count = 0;
$tracker.profileID = $bsb.profileID;
$tracker.location = $bsb.location;
retract($bsb);
$tracker.sensorBean = $bsb;
insert($tracker);
end
rule "PossibleFFF_Level1_update_tracker_count" dialect "mvel"
when
$tracker : FFFTracker(level == 1)
$mds : MMMBean(profileID == $tracker.profileID, this after $tracker)
then
drools.retract($mds);
$tracker.addMdsBean($mds);
$tracker.count = $tracker.count + 1;
drools.update($tracker);
end
rule "PossibleFFF_launch_level1" dialect "mvel"
when
$tracker : FFFTracker(level == 1, count == 5, $prof : profileID)
$theSum : Number(doubleValue < 0.5) from accumulate(
// MMMBean( $actCount : activeCount) over window:length( 5 ) from
$tracker.mdsBeanList,
MMMBean( $actCount : activeCount) over window:length( 5 ) from
$tracker.getMdsBeanList(),
sum( $actCount ) )
then
retract($tracker);
FFFTracker $tracker2 = new FFFTracker();
$tracker2.level = 2;
$tracker2.profileID = $tracker.profileID;
$tracker2.location = $tracker.location;
$tracker2.sensorBean = $tracker.sensorBean;
$tracker2.count = 0;
// Tracker2 is set to track further conditions
insert($tracker2);
// launch the app domain specific things
end
rule "PossibleFFF_Level2_update_tracker_count" dialect "mvel"
when
$tracker : FFFTracker(level == 2)
$mds : MMMBean(profileID == $tracker.profileID, this after $tracker)
then
drools.retract($mds);
$tracker.addMdsBean($mds);
$tracker.count = $tracker.count + 1;
drools.update($tracker);
end
rule "PossibleFFF_launch_level2" dialect "mvel"
when
$tracker : FFFTracker(level == 2, count == 5, $prof : profileID)
$theSum : Number(doubleValue < 0.5) from accumulate(
// MMMBean( $actCount : activeCount, profileID == $prof) over
window:length( 5 ) from $tracker.mdsBeanList,
MMMBean( $actCount : activeCount, profileID == $prof) over
window:length( 5 ) from $tracker.getMdsBeanList(),
sum( $actCount ) )
then
retract($tracker);
// launch the app domain specific things
end
rule "PossibleFFF_kill_tracker_with_bbb" dialect "mvel"
when
$tracker : FFFTracker($prof : profileID, $loc : location)
$bsb : BBBBean(profileID == $prof, location == $loc, bbbEmpty == false,
this after $tracker)
then
retract($tracker);
end
rule "PossibleFFF_kill_tracker_with_count" dialect "mvel"
when
$tracker : FFFTracker(count > 5, $prof : profileID)
then
retract($tracker);
end
// <-- RULES
BBBBean, MMMBean, FFFTracker are declared as events.
class FFFTracker:
public class FFFTracker extends Tracker
{
private ArrayList<MMMMBean> mdsBeanList = new ArrayList<MMMMBean>();
public ArrayList<MMMBean> getMdsBeanList()
{
return mdsBeanList;
}
public void setMdsBeanList(ArrayList<MMMBean> pmdsbeanlist)
{
this.mdsBeanList = pmdsbeanlist;
}
public void addMdsBean(MMMBean pbean)
{
this.mdsBeanList.add(pbean);
}
}
class Tracker:
public class Tracker
{
private long profileID = 0;
private short location = 0;
private int level = 0;
private int count = 0;
private ASensorBean sensorBean = null; // AsensorBean is an abstract
class from which BBBBean and MMMBean are derived
// getters and setters goes here
}
Best Regards,
Esko
------
Esko Hujanen
www.ebsolut.fi
--
View this message in context: http://drools.46999.n3.nabble.com/Does-window-length-work-in-Drools-versi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Drools session reuse question
by arrehman
Is creation of StatefulKnowledgeSession expensive? Is there a guideline or
best practice regarding this?
Currently I am creating a new session /kbase.newStatefulKnowledgeSession()/
each time I want to call /session.fireAllRules()/. I do this for each of the
200,000 data records that I have. So it creates and destroys 200 drools
sessions (monitored via drools JMX bean)
I was trying to reuse the same drools session for each of those 200,000 data
records to see if it improves the performance (don't know if this is frowned
upon or recommended). However this was failing my rules left and right, not
sure why, possibly because I am not cleaning up the session cleanly. I have
been calling /session.dispose() /after every /fireAllRules() /though.
Any thoughts?
Thanks,
Abdul
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-session-reuse-question-tp3466635...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months