Help with LHS part of the Rule
by new2drools
I am using Drools 5.
In the LHS part of a rule, is it possible to call a method, in a class
instance (that has been inserted into the working memory) which expects two
parameters, and returns a boolean?
For example, how can I invoke the following method in LHS (in a DRL file)
part of the rule?
public class BusinessService {
public boolean isValidSomething(String param1, String param2) {
return true;
}
}
The only way I could do this was:
$bService : BusinessService()
$retValue : Boolean() from $bService.isValidSomething("param1", "param2")
The problem I am running into is, by using the above syntax, I am forced to
use 'eval', when I have to use some conditional logic. My understanding is
that using 'eval' will result in sub-optimal performance.
Another question I have is related to conditional logic in the rule
language. When I capture the return values (as shown above) in variables, I
am not able to use the following syntax...
$date1 : Date() from Object1.getBeginDate()
$date2 : Date() from Object2.getCancelDate()
(Object1 and Object2 are different object's)
(($retValue == Boolean.FALSE) && ($date1 > $date2))
I have to do the following:
eval (($retValue == Bollean.FALSE) && ($date1.getTime() > $date2.getTime()))
I am not sure if I am using the rule language correctly. So, please bear
with me, if I making some obvious mistakes.
Any help, would be highly appreciated.
Thanks!
--
View this message in context: http://www.nabble.com/Help-with-LHS-part-of-the-Rule-tp24128872p24128872....
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
Compatibility of Drools for High Traffic events
by Thilina Anjitha
Hi,
I'm planning to use drools to define rules and execute promotions for
telecommunication events such as voice call, SMS, MMS, etc.. events. So
we can expect very large amount of events per day.
We need to define different business rules to provide promotions,
bonuses to the subscribers. Some of the example promotions are listed
here.
1. During the period of X-Y, every 10th MMS sender gets $ 2.00 worth of
free SMS. And the winners will be notified via SMS.
2. During the period of X-Y, random 100 calls to Japan of the CHAT
tariff plan get free movie tickets. And the winners will be notified via
SMS. The same subscriber will not be selected as winner again and again.
3. During the period of X-Y, any subscribers have usage for voice call
or SMS get bonuses as follows :
$ 10 - 20 : get 20% as bonus of free SMS
$ 20 - 50 : get 50% as bonus of free air time
$ 50 - 70 : get 70% as bonus of free IDD
I'm in the evaluation period of the Drools for the system. If anybody
give recommendations or flexibilities/limitations of the drools for our
application.
Thanks,
Thilina
15 years, 5 months
Re: [rules-users] Drools Result
by Greg Barton
I usually use the "insert object, keep the FactHandle, then retract by FactHandle later" technique. That's just how I roll.
--- On Sat, 6/20/09, Mark Proctor <mproctor(a)codehaus.org> wrote:
> You can also insert the object and then use a query to
> retrieve it - lots of ways to slice and dice this one :)
> Wolfgang Laun wrote:
> One good way of producing results from rule is indeed to
> create and insert an object as a fact. The idiom on the RHS is
>
> inser( new DroolsResult(...) );
>
> The application could retrieve this with a query over all
> DroolsResult
15 years, 5 months
Drools Result
by skasab2s
Hello guys,
I'm writing a medical application for weaning from artificial respiration.
I'm putting some medical facts into the working memory and some rules work
on them.
The only problem is that I should return an result object (I called it
DroolsResult) and there should stay if weaning can be successful, remarks
and so on.
I heard that globals are good for returning result. Are there other
approaches? Can't one rule create the result object and put it in the
working memory so that I can fetch it from there using java code?
Thanks a lot and regards!
skasab2s
--
View this message in context: http://www.nabble.com/Drools-Result-tp24119232p24119232.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
Creating drools rules porgramatically?
by Malay Shah
Hi,
I am looking to create the drools Rule objects programatically, and I
believe there is API to do that in 4.0.7. But, the API looks complex and the
documentation is not sufficient. Could anyone please point me to some
examples of doing this? I basically don't want to write rules in .drl files,
but have a database store the rules and make them strongly typed (by
generating Rule Objects directly from DB). Any help is much appreciated.
Thanks
Malay
--
View this message in context: http://www.nabble.com/Creating-drools-rules-porgramatically--tp24077426p2...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
help
by SHIMI Abdelouahad ( Prestataire )
I was deploy Guvnor(drools-5.0.0.CR1-guvnor) as an exploded archive on
the JBoss Application Server(version jboss-4.2.3.GA).
And I was
* Create categories, ok
* Create package,ok
* Importe model, ok
* Create rule, ok
And create a simple Drools application(with Eclipse version 3.4 and
pluging drools 5.0) that will use a package served by Guvnor:
public class GuvnorTest {
public static final void main(String[] args) {
RuleAgent agent =
RuleAgent.newRuleAgent("/Guvnor.properties");
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory =
ruleBase.newStatefulSession();
Driver d = new Driver("Jarek", 20, null);
workingMemory.insert(d);
workingMemory.fireAllRules();
for (Iterator i = workingMemory.iterateObjects();
i.hasNext();) {
System.out.println(i.next().getClass().getCanonicalName());
}
}
}
The properties file:
url=http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package
/myNewPackage/LATEST
And When the application is run I have this Exception:
RuleAgent(default) EXCEPTION (Thu Jun 18 10:46:40 CEST 2009): null.
Stack trace should follow.
java.io.OptionalDataException
at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1310)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at
org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)
at
org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:50)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:148)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:120)
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:96)
at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:410)
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:362)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)
at org.drools.agent.RuleAgent.init(RuleAgent.java:247)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
at kijanowski.eu.GuvnorTest.main(GuvnorTest.java:13)
Exception in thread "main" java.lang.NullPointerException
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:363)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)
at org.drools.agent.RuleAgent.init(RuleAgent.java:247)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
at kijanowski.eu.GuvnorTest.main(GuvnorTest.java:13)
I am realy stuck in the middle please please please please please help.
This e-mail and/or attachment(s) is (are) confidential and may be legally
protected. This message is addressed to the intended recipient only. If you
are not the intended recipient of the message, please notify the sender
immediately. Its contents do not constitute a commitment by the sender's
company except where provided for in a written and signed agreement between
you and sender's company. Any disclosure, use or dissemination, either in
whole or in partial, shall be prior authorized by the sender's company by
written and signed agreement. E-mail and/or attachment(s) cannot be guaranteed
to be secured or error-free as information can be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or contain viruses. The sender.s
company has taken all reasonable precautions to ensure that any attachment to
this message does not contain a virus. However, the sender.s company (and not
any of its Officers, Directors, Employees or Agents) cannot be held liable for
any damages resulting from or linked to the existence of a virus. You are
therefore strongly advised to carry out all your own anti-virus checks before
opening any and all attachments to this message.
15 years, 5 months
Re: [rules-users] help
by SHIMI Abdelouahad ( Prestataire )
Yes I have build package with any probleme
When the application run I have this message:
connection, reason: No current connection., state/code: 08003/40000
16:22:35,981 INFO [STDOUT] ERROR 19-06 16:22:35,981
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
16:22:36,153 INFO [STDOUT] ERROR 19-06 16:22:36,153
(ConnectionRecoveryManager.java:logException:447) failed to close
connection, reason: No current connection., state/code: 08003/40000
16:22:36,231 INFO [STDOUT] ERROR 19-06 16:22:36,231
(ConnectionRecoveryManager.java:logException:447) failed to close
connection, reason: No current connection., state/code: 08003/40000
16:22:36,247 INFO [STDOUT] PackageName: myNewPackage
16:22:36,247 INFO [STDOUT] PackageVersion: LATEST
16:22:36,247 INFO [STDOUT] PackageIsLatest: true
16:22:36,247 INFO [STDOUT] PackageIsSource: false
16:22:36,606 INFO [STDOUT] ERROR 19-06 16:22:36,606
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
16:22:36,716 INFO [STDOUT] ERROR 19-06 16:22:36,716
(ConnectionRecoveryManager.java:logException:447) failed to close
connection, reason: No current connection., state/code: 08003/40000
16:22:36,825 INFO [STDOUT] ERROR 19-06 16:22:36,825
(ConnectionRecoveryManager.java:logException:447) failed to close
connection, reason: No current connection., state/code: 08003/40000
This e-mail and/or attachment(s) is (are) confidential and may be legally
protected. This message is addressed to the intended recipient only. If you
are not the intended recipient of the message, please notify the sender
immediately. Its contents do not constitute a commitment by the sender's
company except where provided for in a written and signed agreement between
you and sender's company. Any disclosure, use or dissemination, either in
whole or in partial, shall be prior authorized by the sender's company by
written and signed agreement. E-mail and/or attachment(s) cannot be guaranteed
to be secured or error-free as information can be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or contain viruses. The sender.s
company has taken all reasonable precautions to ensure that any attachment to
this message does not contain a virus. However, the sender.s company (and not
any of its Officers, Directors, Employees or Agents) cannot be held liable for
any damages resulting from or linked to the existence of a virus. You are
therefore strongly advised to carry out all your own anti-virus checks before
opening any and all attachments to this message.
15 years, 5 months
Is work item configuration needed at run time? Can it be built programmatically?
by msully
Hi folks,
I'm trying to use Drools Flow in a Spring DM environment. I've OSGified its
jars and things look promising. The thing is, I want to use Work Items for
my domain interface, and I want WorkItemHandler's to come from the service
broker. I can see how most of this would work, except for reading in the
workDefinitions.conf for a new work item. I've down a quick browse through
the source code and I think it might be that I don't need the work item
configuration file during run time, just for visual rule building. Anyone
know if that is true?
If it is needed, is there an API that I can introduce it into while building
the session, the way I can introduce KnowledgePackages/rules files?
Thanks,
mike
--
View this message in context: http://www.nabble.com/Is-work-item-configuration-needed-at-run-time---Can...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
functions .drl file
by Chris Richmond
Is it possible to create a .drl file of nothing but functions then import
those into another .drl file to make it easy to maintain one file of API
style functions and then beable to call them from any additional .drl files?
Thanks,
Chris
15 years, 5 months