New Operators
by Ahmed Hafsi
Hi Guys ,
I am using the latest version of drools fusion .
Is it possible to create new operators ? For example I want to make the
logic rule OR
i.e :
a :- b;c.
I know I can make a rule for it like this ::
rule _Rule
when
$a Event()
$b Event(this after $a || this before $a)
then
//..
end
can I embed this rule to make more complex logical rules ? say for example I
want to represent the following rule :
Exp :- (a AND b AND c) OR (d AND e)
One more question ::
how can I represent the not operator ? i.e :
a :- b AND (NOT(b))
Thanks,
Khalil Hafsi
16 years, 6 months
java.lang.IllegalArgumentException: Could not parse knowledge.
by Lindy hagan
Getting below error for each and every rule in Vote.drl . Using Drools 5 and
eclipse 3.4.
Trying this example
http://www.developer.com/java/ent/article.php/10933_3821101_3
Rule Compilation error : [Rule name='VeryGoodValue – between 6-9']
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:79) : Syntax error
on tokens, delete these tokens
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:92) : The public
type Rule_VeryGoodValue_ must be defined in its own file
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:127) : Syntax
error, insert "}" to complete Block
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (4:134) : Syntax error
on tokens, delete these tokens
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:202) : Syntax error
on token "void", @ expected
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:234) : Syntax error
on token "KnowledgeHelper", ( expected after this token
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:284) : Syntax error
on token "m", delete this token
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:287) : Syntax error
on token(s), misplaced construct(s)
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert ")" to complete MethodInvocation
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert ")" to complete SingleMemberAnnotation
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert "enum Identifier" to complete EnumHeaderName
com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert "EnumBody" to complete EnumDeclaration
*Vote.drl*
package com.examples
import com.examples.drools.Vote;
rule "WrongValue – less than 0"
when
m : Vote( average < 0.0, vote : vote )
then
m.setAverage(0.0f);
update( m );
end
rule "WrongValue – bigger than 10"
when
m : Vote( average > 10.0, vote : vote )
then
m.setAverage(10.0f);
update( m );
end
rule "BadValue – between 0-3"
when
m : Vote( average >= 0.0 && average <=3.0, vote : vote )
then
m.setVote("Bad!");
System.out.println( m.getVote() );
end
rule "GoodValue – between 3-6"
when
m : Vote( average >3.0 && average <=6.0, vote : vote )
then
m.setVote("Good!");
System.out.println( m.getVote() );
end
rule "VeryGoodValue – between 6-9"
when
m : Vote( average >6.0 && average <=9.0, vote : vote )
then
m.setVote("Very Good!");
System.out.println( m.getVote() );
end
rule "ExcellentValue – between 9-10"
when
m : Vote( average >9.0 && average <=10.0, vote : vote )
then
m.setVote("Excellent!");
System.out.println( m.getVote() );
end
*
*
16 years, 6 months
Doubt regarding the Email WorkItem in Drool Flow
by Pardeep.Ruhil@lntinfotech.com
Hi,
I have a question regarding the email workItem that is present in the
Drool Flow.
I want to know, does Drool Flow support for sending the emails or we have
to externally provide
the functionality for sending the emails in the WorkItemHandler for email.
If Drool provides the in-built functionality of email sending through the
Email workitem, so where
I have to provide the configuration for SMTP server for sending of Emails
and
other related setting that are required for using the Drools in-built
email functionality.
Thanks & Regards
Pardeep Ruhil
______________________________________________________________________
16 years, 6 months
Re: [rules-users] Doubt regarding the Email WorkItem in Drool Flow
by Pardeep.Ruhil@lntinfotech.com
Hi Mauricio
No I haven't seen that. Thanks for telling me this.
Now I am able to send Email through the Email WorkItem Handler.
Thanks & Regards
Pardeep Ruhil
> did you see
>
>trunk/drools-process/drools-workitems/src/test/java/org/drools/process/workitem/email/EmailWorkItemHandlerTest.java
> ?
2009/8/24 <Pardeep.Ruhil(a)lntinfotech.com>
>
> Hi,
> I have a question regarding the email workItem that is present in the
Drool
> Flow.
> I want to know, does Drool Flow support for sending the emails or we
have
> to externally provide
> the functionality for sending the emails in the WorkItemHandler for
email.
>
> If Drool provides the in-built functionality of email sending through
the
> Email workitem, so where
> I have to provide the configuration for SMTP server for sending of
Emails
> and
> other related setting that are required for using the Drools in-built
email
> functionality.
>
> Thanks & Regards
>
> Pardeep Ruhil
>
______________________________________________________________________
16 years, 6 months
drools-[slidingTimeCount]
by Francesco Chiarelli
Hi!
I'm trying to use a sliding time fro count a facts with a condition.
I'have set a stream mode.
In test, with pseudo clock active, set this to current Time (it's correct?),
declare a fact type in drl with
declare MyFact (i've a javabean)
@role(event)
@timestamp(myTimestamp)
end
attribute type of myTimestamp must be long or Date? I've tried with both but
nothing, engine count all fact
ex: n fact in x days ago from now, the statement over window:time(1s) result
always n fact. why?
in when:
// $o : Order(<condition>)
$nRic : Number(intValue<maxRic) from accumulate($n: Order(this==$o) over
window:time(1s),count($n))
ps. if i set a real clock altough a pseudo, in runTime i've a ClassCastExc.
to JdkTimerService
Thanks in advance.
*Francesco*
16 years, 6 months
drools-[SplitConstraint]
by Francesco Chiarelli
Hi!
In a split constraint i've:
$bool:Boolean(booleanValue==true) from hbnSession.createQuery("select active
from Euristic where name=:name").setString("name","C").uniqueResult()
eval($bool)
but the result is:
XOR split could not find at least one valid outgoing connection for split
C_isActive?
hbnSession is an active hibernateSession
In a simple drl rule, this works fine.
unfortunately, the previous post (slidingTime) is yet unresolved. :(
Thanks in advance.
*Francesco*
16 years, 6 months
DROOLS 4.0.7 Regular expression
by Romain Van der Keilen
Hi there,
I'm looking how to use regular expression with Drools 4.
I've already found some things but they don't work.
Here is an example I want to do, considering all getters and setters are properly written:
Class House
+ private Window myWindow
+ private Phone myPhone
Class Door
+ private String name
Class Phone
+ private String phoneNumber
Let's say in my country phone numbers are the following type: xx/xxx.xx.xx
If I give my house to the session, how can I check if the phone is correct? I've tryied this but that's not working:
rule "Check phone"
when
h : House ( phone: phone );
eval ( phone != null );
Phone ( phoneNumber matches "^ -regex- $");
then
System.out.println("my phone is correct");
End
Thanks for help,
Romain Van der Keilen
16 years, 6 months
Using constants in drools flow
by kothvandir kothvandir
Hello,
How can I define a constant in en jboss flow process so I can use it in a
flow-group rules?
I have defined it in the .drl that contains the ruleflow-group but when i
try to set the constant with my service object using:
ksession.setGlobal("myService", serviceObject);
an Exception is thrown
java.lang.RuntimeException: Unexpected global
[myService]
Is there any way to define globals in the .rf file within <head> tag? anyone
knows where can i find the xsd description for .tf files?
Thanks
16 years, 6 months