Drools beginner - unable to resolve method using strict-mode
by Stefan Schuster
Hi,
I'm new to drools, and I made my first steps using the very nice
video-tutorial "Build Pong in 13 minutes using JBoss Drools" found here:
http://www.youtube.com/watch?v=Omj4PR3v-nI
Eclipse shows building errors, but Pong start anyway. What does this error
mean?
in move.drl there is following rule:
*<rule "Move Bat Up" timer(expr: bat.speed, bat.speed) no-loop when*
* ui : PongUI( ready == true )*
* ( KeyPressed( keyText == "A" ) and bat : Bat( playerId ==
PlayerId.PlayerOne, y > pconf.padding + pconf.sideLineWidth )*
* or*
* KeyPressed( keyText == "K" ) and bat : Bat( playerId ==
PlayerId.PlayerTwo, y > pconf.padding + pconf.sideLineWidth ) ) *
* td : TableDirty( ) *
*then *
* tableG = ui.getTablePanel().getTableG();*
* tableG.setColor( Color.BLACK ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height );*
* *
* modify( bat ) { y = bat.y - 2 };*
* tableG.setColor( Color.WHITE ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height ); *
* modify( td ) { dirty = true };*
*end*
the error message is:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.td<http://org.drools.spi.knowledgehelper.td/>
()]
[Near : {... @Modify with( td ) { dirty = true }; ....}]
in another File (ui.drl) TableDirty is defined:
*declare TableDirty*
* @propertyReactive*
* dirty : boolean*
*end*
Any ideas what this error message means? And why can I start pong despite
this error?
Thanks a lot for helping me
Stefan
2 weeks
conways game of life
by Mark Proctor
For anyone looking for a good and complex example on how to write rules
properly, please look at Conways Game of Life in drools-examples, for
extra bonus points compare it to the old version in M1. You'll see
nearly all the logic is moved from java to the drl and we have removed
the need for nested objects by using objects relaitionally, which also
allows us to exploit cross products to drive the application.
Mark
2 weeks
How to read XML using XMLPackageReader-Drools-compiler.5.2.1.final?
by Praveen
Hi,
I am using Drools-compiler.5.2.1.final.
I am trying to convert an drl to xml and vice versa using DrlParser,
DrlDumper, XMLPackageReader and XML Dumper.
Drl to XML conversion works fine but XML to Drl throws NPE.
I have placed the XML file under a folder called sample.
NPE is thrown at line 5..
Also attached is the exception.
Please suggest.
TIA.
Reader source = new InputStreamReader(
DroolsConversionHelper.class.getResourceAsStream(xmlFileName));
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
XmlPackageReader reader = new
XmlPackageReader(conf.getSemanticModules());
DrlDumper dumper = new DrlDumper();
//line 5 reader.read(source);
PackageDescr descr = reader.getPackageDescr();
String test = dumper.dump(descr);
System.out.println(test);
java.lang.NullPointerException
at
org.drools.xml.ExtensibleXmlParser.resolveSchema(ExtensibleXmlParser.java:696)
at
org.drools.xml.ExtensibleXmlParser.resolveEntity(ExtensibleXmlParser.java:622)
at
com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)
Regards,
Praveen.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-read-XML-using-XMLPackageReader-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 2 months
Drools Planner: Vehicle routing problems
by davidglassborow
Hi,
as discussed the other day with Ge0ffrey on IRC, I've been trying to
get some vehicle routing done using the new TSP / chaining functionality in
drools planner.
I've written an example, but am having problems with the chaining of jobs
together. After pulling my hair out, I've put together an example into my
fork of planner, showing a simplified example of how I am approaching it,
and the problem that can be replicated.
https://github.com/davidglassborow/drools-planner/tree/vehicle_routing
It is a very simple console app along the same lines as the hello world
example for NQueens.
On running it will print out the chains, and you will see the some Jobs
appear more than once in the same list.
On the planning variable it seems to be get assigned in front of itself,
I've put some notes in the source, and checked that the same doesn't occur
in your TSP example.
I'm not sure if its a bug in the way I've setup things, or whether its an
issue in the chain move code.
Greatly appreciated if anybody in the know gets a chance to have a look.
Thanks,
David
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Drools 6 support for changeset
by wtang
I have a requirement in which when a rule is changed, the change needs to be
reflected immediately without retarting the system.
In Drools 5.x we can use the changeset.xml with the knowlegde agent. Now in
Drool 6.0 we have Kie API.
1) does Kie support changeset.xml?
2) Upper management don't want to use kie, they want to use jsr94. Does
jsr94 support changeset.xml?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp402713...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 5 months
Drools Planner: what if possible values of a PlanningVariable are dependent of another one?
by Willem van Asperen
Hi All,
I have a PlanningEntity that has several planning variables, say A and
B. Now, if A is O then B can be X or Y and when A is P then B can be Y or Z.
I see two routes:
* create a solution property that generates X, Y and Z as alternatives
for B and rely on the score rules to dismiss improper values,
depending on the value of A
* create an entity property that only generates the possible values
for B (i.e. X,Y for A=O and Y,Z for A=P)
What is the best route?
(Alternatively I do not use the constructionHeuristic and just start of
my solution with a randomly (but correct) generated solution)
Regards,
Willem
11 years, 5 months
Spring, KnowledgeAgent, and Guvnor
by paulB
I'm having a problem connecting my KnowledgeAgent to a package in Guvnor.
I'm using Spring to instantiate the KnowledgeAgent. The agent initializes
perfectly well when I point to a local change-set that in-turn points to a
local rule. However, even though I have the same rule in a package in
Guvnor, the KnowledgeAgent fails with the following exception when I point
to the package's change-set in Guvnor:
The code at KnowledgeBaseImpl.java:148 is (using 5.3.0.Final):
Here is the simple rule in the Guvnor as returned by the URL for the package
source URL:
Here is the local change-set definition. The line that is commented is the
failing resource, whereas the local file resource works fine:
Guvnor is residing on a Tomcat server.
I could not find anything related to this on the forum. Thank you for any
hints.
-Paul
--
View this message in context: http://drools.46999.n3.nabble.com/Spring-KnowledgeAgent-and-Guvnor-tp3500...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 5 months