Re: [rules-users] drools-server empty response body
by lhorton
you'd do something like this... in your Java code, instantiate an instance
of your logger (of whatever class)
import org.apache.commons.Log; // or whatever logger class you are using
private Log mylogger = new Log();
then create your command list and add the logger instance as a global:
List commands = new ArrayList<Command>();
commands.add(CommandFactory.newSetGlobal("logger", mylogger));
then in your rule you declare the global:
global org.apache.commons.Log logger;
--
View this message in context: http://drools.46999.n3.nabble.com/drools-server-empty-response-body-tp319...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Minimax Planning
by Chris Spencer
How would you use Drools Planner to decide moves in a zero-sum
complete information game like Tic-Tac-Toe, Chess, Go, etc?
I understand how algorithms like Minimax are used for this, and I can
see how I could build a solver to calculate legal moves as well as the
fitness of each player's position after N hypothetical moves, but I'm
not sure I see how Planner could aggregate the scores of arbitrary
plans to find the action corresponding to the minimum/maximum score at
each step.
Regards,
Chris
13 years, 3 months
Planning Under Uncertainty
by Chris Spencer
Hi,
Does Drools Planner support uncertainty / probabilistic planning? I've
Googled, and only found a single reference, in the form of a research
paper, "Reasoning with Uncertainty in Drools", which doesn't even
appear to be publicly downloadable.
If not, how difficult would it be to add?
Regards,
Chris
13 years, 3 months
RuleML2011@BRF - Call for participation
by Adrian Paschke
*Apologies for any duplicates*
===================================================================
Challenge-2011 Demo Award: Late-Breaking Demos until 7th Oct.
http://2011.ruleml.org/america/?page_id=113
===================================================================
Want to learn more about rule technologies, applications and standards?
Want to discuss the latest industrial and research developments?
Want to get in touch with researchers and experts in rule-based systems and
technologies?
Want to see demos of state-of-the-art rule technologies and beyond?
Want to discuss with industries and academia on the future of rule
technologies?
Don't miss RuleML-2011@BRF
http://2011.ruleml.org/america/
===================================================================
RuleML 2011@BRF
5th International Symposium on Rules: Research-Based, Industry-Focused
Ft. Lauderdale, Florida, 3-5 November 2011
http://2011.ruleml.org/america/
===================================================================
We cordially invite you to participate to the 5th International Symposium on
Rules: Research-Based and Industry-Focused (RuleML-2011@BRF) - the premier
conference event emphasizing the synergy between high-quality research and
industry operating in the rule modeling, markup and reasoning domain, with
particular regard to the usability of such rule systems in the Web
environment.
It takes place in Ft. Lauderdale, Florida, November 3-5, 2011,
collocated with
the International Business Rules Forum.
News
===================================================================
List of accepted papers published
Draft Programme published
Best paper prize
Challenge-2011 Demo Award: Late-Breaking Demos until 7th Oct.
Special invited speakers included in the programme:
- Keynotes: Christian de Sainte Marie (IBM ILOG), Marcus Spies
(Ludwig-Maximilians
University, Munich), Paul Vincent, (CTO Business Rules& CEP, TIBCO
Software) and Jan Vanthienen (KU Leuven, World Authority on Decision
Tables).
- An OMG presentation will be given by Said Tabet (EMC) and one from
NIEM and OASIS by David Webber (Oracle Corporation).
- Special invited demos will be presented by Jans Aasman (Franz Inc.)
and by Benjamin Grosof (Vulcan Inc.)
Supported by
===================================================================
W3C, OMG, OASIS, AAAI, ECCAI, EPTS
15% special discount code for OASIS, OMG, W3C, ACM, ECCAI, EPTS, SemWeb
and WSWM members.
15% special discount code for RuleML2011@IJCAI attendees and Ph.D students
Sponsored by
===================================================================
Franz Inc.
NICTA (National ICT Australia) Ltd
Vulcan Inc.
CIRSFID - University of Bologna
Corporate Semantic Web
Model Systems Ltd
OASIS-LEGALXML
(sponsoring opportunities:http://2011.ruleml.org/america/?page_id=30)
===================================================================
13 years, 3 months
Re: [rules-users] Ant Build of PKG with Declared Types
by Ansgar Konermann
Am 23.09.2011 20:03 schrieb "TroyL" <troylparrish(a)aol.com>:
>
> Thank you for the reply. I have run a number of much simpler applications
in
> several environments, below are my results:
>
> My Ant Script remains unchanged.
Next things to try could be:
- increase verbosity of your ant compile so you can see what is actually
being compiled.
- make sure the Ant build is as similar as possible to your unit test
(observe verbose output of Ant build carefully)
Best regards,
Ansgar
>
> *My Test Application*:
>
> KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>
builder.add(ResourceFactory.newClassPathResource("declaredType.drl"),
> ResourceType.DRL);
>
> if(builder.hasErrors()){
> System.out.println(builder.getErrors().toString());
> }
>
> KnowledgeBase base =
KnowledgeBaseFactory.newKnowledgeBase();
> base.addKnowledgePackages(builder.getKnowledgePackages());
>
> StatefulKnowledgeSession session =
base.newStatefulKnowledgeSession();
>
> Test test = new Test();
> test.setName("Test");
>
> session.insert(test);
> session.fireAllRules();
>
> session.dispose();
>
> *My DRL*:
>
> package com.test
>
> declare SubTest
>
> name : String
> id : int
>
> end
>
> rule "Test Rule"
>
> when
> Test(name == "Test")
> then
> SubTest sTest = new SubTest();
> sTest.setName("SubTest");
> sTest.setId(12);
> System.out.println("Test Ran");
> System.out.println(sTest.getName() + " " + sTest.getId());
>
> end
>
> When I run my test application the drl compiles and I get the following
> output to the console:
>
> Test Ran
> SubTest 12
>
> However I get the following error when trying to compile it with the Ant
> Script:
>
> [compiler] Duplicate type definition. A class with the name
> 'com.test.SubTest' was found in the classpath while
>
> trying to redefine the fields in the declare statement. Fields can only be
> defined for non-existing classes.
>
> BUILD FAILED
> C:\Users\troy.l\conceptsWorkspace\DeclaredType\build1.xml:23: RuleBaseTask
> failed: Duplicate type definition. A
>
> class with the name 'com.test.SubTest' was found in the classpath while
> trying to redefine the fields in the
>
> declare statement. Fields can only be defined for non-existing classes.
>
> This error goes away when the Declared Type has only one field IE:
>
> declare SubTest
>
> name : String
>
> end
>
> The drl compiles into a PKG and the I can successfully use the PKG in my
> test application when the Declared Type has only one field. Also I do not
> have this issue in other Drools versions (I have tried 5.1.1, 5.0.1 and
> 5.2.0.M2).
>
> This is a stand alone test application and the above represents almost the
> entire test project with the exception of the Test.java class which is a
> pojo.
>
> Thanks again for responding.
>
> --
> View this message in context:
http://drools.46999.n3.nabble.com/Re-rules-users-Ant-Build-of-PKG-with-De...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 3 months
Re: [rules-users] Ant Build of PKG with Declared Types
by Ansgar Konermann
Am 16.09.2011 16:15 schrieb "TroyL" <troylparrish(a)aol.com>:
>
> I am attempting to build a PKG utilizing an Ant Script. My DRL includes
two
> declared types. When the declared types have only one field the PKG will
> compile but when the declared types have more than one field I get an
error
> stating that a class of that name was already found on the class path :
> specifically the error states:
>
> [compiler] Duplicate type definition. A class with the name XXXXXXX was
> found in the classpath while trying to redefine the fields in the declare
> statement. Fields can only be defined for non-existing classes.
Hi,
please optimize your signal/noise ratio:
* try to reduce your use case to a minimal test case which still exhibits
the erroneous behaviour
* a self contained unit test would be perfect
* try compiling the files from your use case using a plain KnowledgeBuilder.
As the Ant task is merely a wrapper around it, try to reproduce the
erroneous behaviour with the simplest setup possible.
* put the rule source code into your test as string literals.
* reduce the rule source code as much as possible while still reproducing
the error
* then, identify the smallest rule source code delta which makes the error
go away.
If you finally manage to reproduce the error using this minimal setup, make
sure to include complete information. In particular, don't XXX out parts of
the error message.
I'm quite sure if you follow at least some of these hints, you will probably
get more feedback from this list.
Best regards,
Ansgar
>
> My ant script:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <project default="rules">
> <property name="projectPath" value="" />
> <property name="droolsPath"
> value="C:/Users/266571/Documents/drools-distribution-5.2.0.Final/binaries"
> />
> <property name="eclipsePath"
> value="C:/Users/266571/Documents/eclipse/plugins" />
>
>
> <path id="drools.classpath">
> <pathelement location="${droolsPath}/drools-ant-5.2.0.FINAL.jar" />
> <pathelement location="${droolsPath}/drools-api-5.2.0.jar" />
> <pathelement location="${droolsPath}/drools-core-5.2.0.FINAL.jar" />
> <pathelement location="${droolsPath}/drools-compiler-5.2.0.FINAL.jar"
/>
> <pathelement location="${droolsPath}/antlr-runtime-3.3.jar" />
> <pathelement location="${droolsPath}/mvel2-2.0.19.jar" />
> <pathelement location="${droolsPath}/knowledge-api-5.2.0.Final.jar" />
> <pathelement
> location="${eclipsePath}/org.eclipse.jdt.core_3.6.2.v_A76_R36x.jar" />
>
> </path>
> <path id="model.classpath">
> <pathelement location="bin" />
> </path>
> <taskdef name="compiler" classpathref="drools.classpath"
> classname="org.drools.contrib.DroolsCompilerAntTask" />
> <target name="rules" >
> <compiler
> srcdir="${projectPath}src/rules"
> tofile="${projectPath}src/rules/rules.pkg"
> binformat="package"
> classpathref="model.classpath" >
> <include name="supportObjects.drl" />
> </compiler>
> </target>
>
>
> </project>
>
> My DRL:
>
> package gov.ssa.codedObjects
>
> import gov.ssa.codedObjects.SupportObjectsCollection;
>
> declare SecondaryBrain
>
> name : String
> id : int
>
> end
>
> declare ICDCode
>
> code : String
> name : String
>
> end
>
> global SupportObjectsCollection supportObjectsList;
>
> rule "Evaluate Coded Object"
>
> when
> $codedObject : CodedObject(code == 191.0)
> then
> SecondaryBrain brain = new SecondaryBrain();
> brain.setName("Brain Tumor, Cerebrum");
> insert (brain);
> end
>
>
> rule "Evaluate Coded Object Malignent"
>
> when
> $codedObject : CodedObject(code == "239.6" || code ==
"C71.9", $code :
> code)
>
> then
> ICDCode code = new ICDCode();
> code.setCode($code);
> code.setName("Neoplasm of uspecified nature of the Brain");
> insert(code);
>
> end
>
>
>
> rule "Add Brain Neoplasm to List"
>
> when
> $code : ICDCode(code == "239.6" || code == "C71.9")
> then
> supportObjectsList.addToSupportObjects($code);
>
> end
>
> rule "Megaduodenum"
>
> when
> $codedObject : CodedObject(code == "537.3" || code ==
"K59.3", $code :
> code)
>
> then
> ICDCode code = new ICDCode();
> code.setCode($code);
> code.setName("Megaduodenum");
> insert(code);
>
>
> end
>
> rule "Add Megaduodenum to List"
>
> when
> $code : ICDCode(code == "537.3" || code == "K59.3")
> then
> supportObjectsList.addToSupportObjects($code);
>
> end
>
>
> Any suggestions would be helpful.
>
> --
> View this message in context:
http://drools.46999.n3.nabble.com/Ant-Build-of-PKG-with-Declared-Types-tp...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 3 months
Fusion and open-ended intervals?
by Barry Kaplan
A fusion design question:
I have events that represent intervals. Initially the intervals are
open-ended (kind a like the current state of an entity). Other events are
matched "during" the interval and correlated. At some point the interval
will be closed (eg, a specific downtime interval is closed because the
device is no online again).
All the events in this system are immutable -- so if some property of an
event changes, it is cloned and modified in working-memory. For the case of
the interval events, initially the interval is inserted open-ended, and at
some point later closed and then modified.
This does not work with fusion however, since an event's duration is
maintained by the fact-handle not the event itself. Hence a modify with a
now closed interval (ie, a finite @duration) has no effect. I'm guessing the
temporal values are maintained the handle to ensure stable values for the
behaviors that trigger based on temporal values, which is reasonable.
So I'm looking for alternative designs. Some are:
1) Modeled the intervals as begin/end events, but that gets messy real
fast (have to correlate
the begin/end events somehow, can't use evaluators like 'includes' or
'during', etc).
2) Retract the interval event when it is closed (this way closed intervals
no longer correlate
with other incoming events). But then we really have a manually
maintained state machine
using only facts, and there can be no reasoning over a series these
interval events.
(eg, 3 downtimes longer than 2 minutes in the last hour).
Opinions?
-barry
--
View this message in context: http://n3.nabble.com/Fusion-and-open-ended-intervals-tp719076p719076.html
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 3 months
CEP sliding window in the past
by cfuser
Can you offset the sliding window functionality to look for a window in the
past? What I'm trying to do is offset the window from 'now'. E.g.
Assuming it is 12:05 and I have been receiving objects for 5 minutes, I'm
trying to get this to sum received objects between 2 and 3 minutes ago.
rule "Accumulate attempts over 1 minute (window over time)"
when
$measure : Number()
from accumulate( MyData( $m:measures["attempts"],
objectType=="climber" )
over window:time( 2m, 3m ) from entry-point "My Stream",
sum($m))
then
#
end
Looking at the SlidingTimeWindow source code, it looks as though you can't
offset the window by a delay? Is that accurate? If you can't do that
directly via a sliding window, is there a way to work around this?
TIA.
--
View this message in context: http://drools.46999.n3.nabble.com/CEP-sliding-window-in-the-past-tp331463...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Help with URL resource caching
by benji2212
I'm using KnowledgeAgent to poll regularly for three DRL files hosted on a
web server. If the web server goes down for any reason or one of the DRL
files becomes unavailable, the change scanner and knowledge agent
unsubscribe from the resource(s) that were unavailable.
After reading some topics on the forum, I found that setting the
drools.resource.urlcache system property should correct this. However, I've
been unable to get this to work properly. The code I'm using is below. Any
insight into what I'm doing wrong would be appreciated. I'm using drools
5.1.1.
System.setProperty("drools.dateformat",
"MM/dd/yyyy");
System.setProperty("drools.resource.urlcache",
"C:\\Users\\0000000\\Documents\\rule-cache");
//start the scanner service and resource change notifier service
changeNotifier = ResourceFactory.getResourceChangeNotifierService();
changeScanner = ResourceFactory.getResourceChangeScannerService();
changeNotifier.start();
changeScanner.start();
kagent = KnowledgeAgentFactory.newKnowledgeAgent("My Knowledge Agent");
URL url = RulesRuntimeImpl.class.getResource(CHANGE_SET_PATH);
Resource drl = ResourceFactory.newUrlResource(url);
kagent.applyChangeSet(drl);
My change set file looks like this:
<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
drools-change-set-5.0.xsd" >
<add>
<resource source="http://mysite.com/test/FirstDecisionTable.drl"
type="DRL" />
<resource source="http://mysite.com/test/SecondDecisionTable.drl"
type="DRL" />
<resource source="http://mysite.com/test/ThirdDecisionTable.drl"
type="DRL" />
</add>
</change-set>
and the output I get when a resource in the change set becomes unavailable:
[9/21/11 10:49:28:015 EDT] 0000004e SystemOut O [2011:09:264
10:09:15:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:49:28:046 EDT] 0000004e SystemOut O [2011:09:264
10:09:46:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:055 EDT] 0000004e SystemOut O [2011:09:264
10:09:55:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:50:28:259 EDT] 0000004e SystemOut O [2011:09:264
10:09:259:debug] ResourceChangeScanner removed resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:309 EDT] 0000004e SystemOut O [2011:09:264
10:09:309:debug] ResourceChangeNotification received ChangeSet notification
[9/21/11 10:50:28:345 EDT] 0000004e SystemOut O [2011:09:264
10:09:345:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:426 EDT] 0000004f SystemOut O [2011:09:264
10:09:417:debug] ResourceChangeNotification processing ChangeSet
[9/21/11 10:50:28:535 EDT] 0000004f SystemOut O [2011:09:264
10:09:535:debug] ResourceChangeNotification ChangeSet removed
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
for listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a
[9/21/11 10:50:28:560 EDT] 0000004f SystemOut O [2011:09:264
10:09:560:debug] KnowledgeAgent received ChangeSet changed notification
[9/21/11 10:50:28:611 EDT] 0000004f SystemOut O [2011:09:264
10:09:611:debug] ResourceChangeNotification thread is waiting for queue
update
[9/21/11 10:50:28:626 EDT] 00000050 SystemOut O [2011:09:264
10:09:625:info] KnowledgeAgent applying ChangeSet
[9/21/11 10:50:28:663 EDT] 00000050 SystemOut O [2011:09:264
10:09:663:debug] KnowledgeAgent removing mappings for resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl'] with unsubscribe=true
[9/21/11 10:50:28:684 EDT] 00000050 SystemOut O [2011:09:264
10:09:684:debug] KnowledgeAgent notifier unsubscribing to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 00000050 SystemOut O [2011:09:264
10:09:689:debug] ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 00000050 SystemOut O [2011:09:264
10:09:689:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
...
--
View this message in context: http://drools.46999.n3.nabble.com/Help-with-URL-resource-caching-tp336204...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Issue using global 'variable' with Drools 5.2 in DRL
by Slorg1
Good evening,
I am porting our project from Drools 5.1 to Drools 5.2 and I am running into
a couple of issues. Most I solved except:
It seems that our global variable is being completely ignored.
I have declared the following after package & imports :
global java.util.Date now;
When calling it in a rule:
rule "MyRule"
when
EXPRESSION >= now.time
then
// things to do
end
Then I get the following error at 'compile' time :
Not possible to directly access the property 'time' of declaration 'now'
since it is not a pattern
I do not know what to make of it.
I have tried to change it to now.getTime() without success.
Thank you in advance for your help.
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-using-global-variable-with-Drools...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months