Query on web services and database stuff
by starfish15
Hello All,
I am starting up on a project which requires Drools rules. I have been asked
certain basic Q's. Am jotting them below
1. *Can the Drools Rule engine communicate to a DB *
I know by default, drools does use the *Apache JackRabbit DB* to store
respective assets and there are means to use other DBs as well. Not sure
what else this Q could mean. So would really appreciate if some light can be
thrown on this. What else things which could be achieved through the rules
and DB connection
2. *Can the Drools Rule engine do web service calls to other system*
I am not sure if this can be achieved through Drools. Would appreciate if
some assistance could be provided on this and some working examples as well
if this can actually be achieved.
Regards,
starfish
--
View this message in context: http://drools.46999.n3.nabble.com/Query-on-web-services-and-database-stuf...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Questions about Drools runtime & Guvnor
by Charles Moulliard
Hi,
I have different questions concerning drools & guvnor.
Q1 : How can Drools runtime (Knowledge builder / base) gets/collects
*.brl, .drl files from Guvnor (using REST api, ....) ?
Q2 : How can drools runtime being informed that rules have been modified
in Guvnor Repo ?
Q2 : Is there a document describing best practices to setup knowledge
base (how many rules / base, ...) and sessions to be created ?
Q3 : Is it a good practice to access Guvnor from Drools runtime or
better to export from Guvnor a package and import it in Drools runtime
(Can we import guvnor package in Drools runtime) ?
Regards,
--
Ir. Charles Moulliard
Sr. Enterprise Architect / Apache Committer | RedHat, Inc
FuseSource is now part of Red Hat
cmoullia(a)redhat.com | mobile: +32 473 604 014 | RedHat.com
<http://www.redhat.com>
skype: cmoulliard | twitter: @cmoulliard
blog: cmoulliard.blogspot.com <http://cmoulliard.blogspot.com>
13 years
NPE at distribution [Planner]
by André Fróes
Hello, I am getting an NPE when trying to solve a simple problem with 3
workorder and 3 engineers.
------------
Exception in thread "main" java.lang.NullPointerException
at java.util.ArrayList.addAll(Unknown Source)
at
org.drools.planner.core.domain.solution.SolutionDescriptor.getAllFacts(SolutionDescriptor.java:178)
at
org.drools.planner.core.score.director.drools.DroolsScoreDirector.getWorkingFacts(DroolsScoreDirector.java:88)
at
org.drools.planner.core.score.director.drools.DroolsScoreDirector.resetWorkingMemory(DroolsScoreDirector.java:81)
at
org.drools.planner.core.score.director.drools.DroolsScoreDirector.setWorkingSolution(DroolsScoreDirector.java:70)
at
org.drools.planner.core.solver.scope.DefaultSolverScope.setWorkingSolutionFromBestSolution(DefaultSolverScope.java:158)
at
org.drools.planner.core.solver.DefaultSolver.solvingStarted(DefaultSolver.java:176)
at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:154)
at com.swa.planner.snap1.app.SortWorkOrder.main(SortWorkOrder.java:41)
-----------------
the rule for it is simple (adapted from cloudbalancing):
----------
rule "requiredWorkTimeTotal"
when
$engineer : Engineer($worktime : worktime )
$requiredEngineerWorktimeTotal : Number(intValue > $worktime) from
accumulate(
WorkOrder(
engineer == $engineer,
$requiredWorktime : requiredWorktime ),
sum($requiredWorktime)
)
then
insertLogical(new IntConstraintOccurrence("requiredWorkTimeTotal",
ConstraintType.NEGATIVE_HARD,
$requiredEngineerWorktimeTotal.intValue() - $worktime,
$engineer));
end
----------
I'm rebuilding the app bit by bit and then evolve it. The skill is not
considered yet to make the comparison, just worktime. This is the data i'm
working with right now:
-----------
List<Engineer> engineerList = new ArrayList<Engineer>();
engineerList.add(new Engineer(1l, 8, ABC1, "Fabio"));
engineerList.add(new Engineer(2l, 8, ABC2, "Qwert"));
engineerList.add(new Engineer(3l, 8, ABC3, "Trewq"));
List<WorkOrder> workOrderList = new ArrayList<WorkOrder>();
workOrderList.add(new WorkOrder(101l, 8, ABC1));
workOrderList.add(new WorkOrder(102L, 8, ABC2));
workOrderList.add(new WorkOrder(103L, 8, ABC3));
-----------
13 years
Check a set of objects for a value?
by Patrick
Hello,
This is my current drool rule:
rule "RULE1"
when
context : StaticTaskContext(
taskToPerform.name == "TRANSFER",
deallocatedOrder == true,
currentTask != null
)
then
context.setRuleResult("STAYPUT");
end
What I need to do is check to see if the predecessor task is of a certain
value.
ie:
currentTask.getPredecessorTaskChains().iterate().next().getPredecessorTask.getTaskType()
== "VALUE"
The predecessorTaskChain is declared as:
private Set<TaskChain> predecessorTaskChains;
How can I go through all the task chains on the current task?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Check-a-set-of-objects-for-a-value-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
MavenImporter from GuvnorIntegrationTest
by MaverickDrools
Hi,
Any idea about this exception? Tried to google it up, but didn't get
anything satisfactory.
java.lang.RuntimeException: Could not invoke deployment method: public
static org.jboss.shrinkwrap.api.spec.WebArchive
org.drools.guvnor.server.test.GuvnorIntegrationTest.createDeployment()
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:94)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:57)
at
org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:156)
... 50 more
Caused by: java.lang.NoClassDefFoundError:
org/jboss/shrinkwrap/resolver/api/maven/MavenImporter
at
org.drools.guvnor.server.test.GuvnorIntegrationTest.createDeployment(GuvnorIntegrationTest.java:60)
... 55 more
Caused by: java.lang.ClassNotFoundException:
org.jboss.shrinkwrap.resolver.api.maven.MavenImporter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 56 more
I have the following dependency in my project pom:
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven-archive</artifactId>
<version>2.0.0-alpha-7</version>
</dependency>
But it seems like the jar doesn't have that class anymore. Any thoughts?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/MavenImporter-from-GuvnorIntegrationTes...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Drools Planner Chaining/Cloning Documentation Suggestion
by Trails
Hi all,
I'm new to drools planner and liking it a lot!
I spent some hours last night cracking my head on something. I have
switched my domain from planning variable pointing to planning facts to
using chained planning variables.
I ran into a problem with score corruption, which was surprising as I am
still using a Simple Score Calculator.
It turns out my problem was when cloning the solution the planning variable
(now chained) was still pointing to entities in the old solution. I was
following along the user guide when I fell over this.
I'd like to humbly suggest that the drools planner user guide include a
note/warning/something in the chained variable section about ensuring that
when cloning the solution, the chained planning variables are updated to
point to the cloned planning entities. There is currently no mention of
solution cloning in this section, and the code included in the doc does not
mention this either.
This is illustrated in the examples, e.g. TSP, but it's in the Solution, not
the planning entities.
Just hoping to save others the head scratching.
Thanks!
Taylor
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Chaining-Cloning-Documen...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
guvnor 5.5 - Guided decision tables (web based)
by Apurva Joshi
Hi,
I am trying to create a rule using Guided decision tables (web based).How
can I use any of the collection classes in my rule?I know that we have to
first import the model POJO jar in order to use the class types in our
rule.when I try to upload JDK jar(rt.jar),which contain implementation for
the collection classes and try to validate it,the guvnor tool gives me error
that the POJO jar is not valid.
I would appreciate any help of this issue.
--
View this message in context: http://drools.46999.n3.nabble.com/guvnor-5-5-Guided-decision-tables-web-b...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Mapping to '==' in enumeration
by rjr201
Hi,
I've created an enumeration in Guvnor like so:
'Object.operator[]': ['== = equals', '!= = does not equal', '< = less than',
'> = greater than']
The less than and greater than map fine. But the equals and does not equal
don't. I realise that I need to escape the first two = signs, but can't find
a way to do it.
'\=\= = equals' doesn't work. Anyone got any ideas?
Sorry if this is something really easy to solve, but I can't work it out.
(also I realise that I could just have a drop down box with the mathematical
symbols in and not worry about mapping it to english, but apparently that
would be too technical for non-technical users )
--
View this message in context: http://drools.46999.n3.nabble.com/Mapping-to-in-enumeration-tp4022245.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Unmarshall large session fails
by Magnus Vojbacke
I'm trying to unmarshal a knowledge session that has been persisted to file, but I get the following exception:
Stack Trace:
com.google.protobuf.InvalidProtocolBufferException: Protocol message was too large. May be malicious. Use CodedInputStream.setSizeLimit() to increase the size limit.
at com.google.protobuf.InvalidProtocolBufferException.sizeLimitExceeded:89
at com.google.protobuf.CodedInputStream.refillBuffer:720
at com.google.protobuf.CodedInputStream.isAtEnd:666
at com.google.protobuf.CodedInputStream.readTag:99
at org.drools.marshalling.impl.ProtobufMessages$Header$Builder.mergeFrom:967
at org.drools.marshalling.impl.ProtobufMessages$Header$Builder.mergeFrom:773
at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom:212
at com.google.protobuf.AbstractMessage$Builder.mergeFrom:746
at org.drools.marshalling.impl.ProtobufMessages$Header.parseFrom:724
at org.drools.marshalling.impl.PersisterHelper.readFromStreamWithHeader:234
at org.drools.marshalling.impl.ProtobufInputMarshaller.loadAndParseSession:217
at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession:107
at org.drools.marshalling.impl.ProtobufMarshaller.unmarshall:143
The session consists of >1M facts, and the file is ~167 MB in size.
While Googling, I stumbled upon the recommendation to run CodedInputStream.resetSizeCounter() inbetween deserializing messages. Is this a fix that could be implemented in Drools?
Is there any way of configuring or parameterizing the unmarshalling size limit used by Drools?
13 years, 1 month