JRuby Objects as Drools Facts
by Ray Hooker
I have seen where one group in India claimed to be able to inserts JRuby
objects as facts to Drools. I am very open to suggestions. The JRuby
objects appear to Java to be class RubyObject. When I insert say a JRuby
class named "Message", here is the message:
[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#<Message:0x145462bc>],
getObject()=#<Message:0x145462bc>,
getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@4cb91eff,
getPropagationContext()=PhreakPropagationContext
[entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#<Message:0x145462bc>],
leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]
On the other hand if I insert a Java class in the same way, it is seen as:
==>[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message@4e9e75f6],
getObject()=com.antelopesoftware.drools.Message@4e9e75f6,
getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@139ba1d8,
getPropagationContext()=PhreakPropagationContext
[entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message@4e9e75f6],
leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]
So how can I get the Drools engine to recognize the fact. BTW my real
application is read from a MongoDB database using Mongoid and insert the
data into Drools. I wrote wrapper Java classes to make it easier.
Thanks in advance,
Ray
--
View this message in context: http://drools.46999.n3.nabble.com/JRuby-Objects-as-Drools-Facts-tp4027079...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
drools 6 equivalent of addKnowledgePackages
by pmander
Just doing some investigation of the drools 6 release. We dynamically build
our rules and use some thing like the following to bring them into a
stateful session:
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add(ResourceFactory.newReaderResource(new StringReader(
compiledRules)), ResourceType.DRL);
KnowledgeBuilderErrors errors = builder.getErrors();
kbase.addKnowledgePackages(builder.getKnowledgePackages());
This appears to be deprecated but there is no indication in the javadoc for
what the alternative is.
--
View this message in context: http://drools.46999.n3.nabble.com/drools-6-equivalent-of-addKnowledgePack...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
How to declare custom accumulators in kmodule.xml?
by abr
Hello everyone,
I tried to move from Drools 5.5.0.Final to 6.0.0.Final and I've some issues
with moving from declaring kbase in Spring to the new kmodule.xml.
My main concern for the moment is about custom accumulators.
In the 5.5.0.Final Spring config, I had something like :
<bean id="myAcc" class="my.namespace.rules.accumulators.MyCustomAccumulator"
/>
<drools:kbase id="kb1">
<drools:resources>
[...]
</drools:resources>
<drools:configuration>
<drools:accumulate-functions>
<drools:accumulate-function name="myAcc" ref="myAcc" />
[...]
</drools:accumulate-functions>
</drools:configuration>
</drools:kbase>
I've thoroughly read the 6.0.0.Final documentation and the
kie-spring-6.0.0.xsd (found here:
https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-spri...)
but I haven't find a way to declare custom accumulators.
I also tested my luck by changing all "drools:" by "kie:" but with no
success.
Would you point me to a working example of declaring custom accumulators in
6.0.0.Final?
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-declare-custom-accumulators-in-k...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
KIE Internal M2 Repository Access Denied
by marjan.sterjev
I have installed drools-wb-6.0.0.Final-tomcat7.0 on Tomcat 7.0 with all
default settings. The OS platform is windows 7.
I’m trying to access the internal KIE M2-Repository in order to dynamically
load (re-load with KieScanner) Kie Modules. The repository is defined in the
POM the following way:
<repository>
<id>kie-wb</id>
<url>http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/</url>
</repository>
The maven build fails with Unauthorized error:
Could not transfer artifact com.masterit.labs:my-model:pom:0.0.1-SNAPSHOT
from/to kie-wb
(http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2): Not
authorized , ReasonPhrase:Unauthorized. -> [Help 1]
If I access the maven2 repository directly in the browser the error is:
java.io.FileNotFoundException: repositories\kie (Access is denied)
java.io.RandomAccessFile.open(Native Method)
java.io.RandomAccessFile.<init>(RandomAccessFile.java:216)
org.guvnor.m2repo.backend.server.FileDownloadServlet.serveResource(FileDownloadServlet.java:166)
org.guvnor.m2repo.backend.server.FileDownloadServlet.doGet(FileDownloadServlet.java:65)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266)
However, manually I can always type the path to some M2 resource in the
browser and get the result. For example the URL below returns the required
artifact:
http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/com/interwo...
--
View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denie...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Drools 6.0.0 Final - execution rules with process flow
by vince
I have started taking a look at the 6.0.0 Final and I imported and executed
the Drools Hello World sample process project. So far so good.
Then I wanted to execute a rule from the ruleflow. To test that scenario I
replaced the script task with a businss rule task and created the
ruleflow-group property in the ruleflow node and in the rule I want to fire
(which just print a text message, no objects are involved).But this is not
working.
I noticed that the starting actions of the package are executed but not the
final ones, but I am not able to explain why.
What am I missing here? Is there an example where I can compare the code?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Final-execution-rules-with...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
dzone cheat sheets
by Mark Proctor
Anyone in the community want to help create and publish a new set of cheat sheets, for the 6.0 stuff?
Mark
12 years
[Optaplanner] Scheduling + VRP
by Mats Norén
Hi,
I'm looking for an example that does both scheduling and vrp.
I have workers with certain skills and I have goods (which require a particular skill set) to be delivered or picked up within certain time windows.
Each worker work in a team.
The team should if possible be assigned to the same delivery/pickup.
The workers work in shifts and by law has to have breaks etc.
I want to create a schedule that assigns workers/teams to deliveries/pickups and stay within the time windows as well as optimizing the distance travelled.
I thought about the nurse rostering example together with cvrptw but the nurse rostering uses shifts (day, night).
Do I have to do it in two steps? First VRP and then try to assign the workers?
The only hard facts are the workers worktime and the goods delivery/pickup time.
Any suggestions?
Best regards,
Mats
12 years
6.0 Architecture cheat Sheets
by Mark Proctor
I sketched up this over the weekend, as a sort of architectural cheat sheet. Hope it helps clarifies some things around GIT and Maven.
Mark
12 years