No String constructor found on type [org.drools.builder.ResourceType]
by ashokkuppuswamy
I am trying to integrate with spring and I am stuck on this error
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemProperties] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemEnvironment] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Initialized
StandardEnvironment with PropertySources
[systemProperties,systemEnvironment]
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Initializing new
StandardEnvironment
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemProperties] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemEnvironment] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Initialized
StandardEnvironment with PropertySources
[systemProperties,systemEnvironment]
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Initializing new
StandardEnvironment
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemProperties] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Adding
[systemEnvironment] PropertySource with lowest search precedence
2012-12-05 04:43:45 [main] DEBUG
org.springframework.core.env.StandardEnvironment - Initialized
StandardEnvironment with PropertySources
[systemProperties,systemEnvironment]
2012-12-05 04:43:45 [main] DEBUG org.springframework.beans.BeanUtils - No
property editor [org.drools.builder.ResourceTypeEditor] found for type
org.drools.builder.ResourceType according to 'Editor' suffix convention
2012-12-05 04:43:45 [main] DEBUG
org.springframework.beans.TypeConverterDelegate - No String constructor
found on type [org.drools.builder.ResourceType]
java.lang.NoSuchMethodException:
org.drools.builder.ResourceType.<init>(java.lang.String)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getConstructor(Class.java:1657)
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:197)
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
This is the config I have
<jbpm:kbase id="kbase">
<jbpm:resources>
<jbpm:resource type="BPMN2" source="classpath:Evaluation.bpmn"/>
</jbpm:resources>
</jbpm:kbase>
Any help is greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/No-String-constructor-found-on-type-org...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Mixing Drools language and Java implementions without performance loss
by Oliver Libutzki
Hello everyone,
as I try to find the best solution for a scheduling problem Drools
Planner seems to be the perfect fit.
Instead of using drl files I want to implement the rules in Java, but I
still would like to use the power of Drools (Planner) to find the best
solution as fast as possible.
My first attempt is to use the Description API (Examples:
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test...).
This might work, but I wonder if I really have to write the whole rule
this way. Of course I can use "eval" Expressions to integrate Java code,
but I would like to know how expensive this is in certain situations.
So, which information does Drools use to optimize the algorithm?
An example taken from the Test class I mentioned:
.lhs()
.pattern("StockTick").constraint("company ==
\"RHT\"").end()
.end()
I guess it's important to select the StockTick by using the pattern. But
what about the company criteria? Is using the constraint faster than
invoking a method like "checkType"?
.lhs().pattern("StockTick").name("myStockTick").eval().constraint(
"checkCompany(myCheese, \"RHT\"").end()
.end()
In general, I would like to know which parts can be implemented in
"secret Java" which the drools compiler doesn't know and which parts
should be implemented by using the explicit descr api elements in order
to use the full power of the Drools engine. Thanks for your answers!
Kind regards Oliver
12 years
How to ensure that a person does not execute the same task twice in a row?
by Michiel Vermandel
Hi,
In my usecase I need to plan tasks (PlanningEntity).
I have two kinds of tasks (for example CleaningTask and InspectionTask (inspect that cleaning was OK)).
Each taskneeds to be assigned to a person and a period.
Person and period both are PlanningVariables.
I need to ensure that a person does not execute an InspectionTask twice in a row.
How can I find out what the previous task is that is assigned to a person?
It is not guaranteed that the person had a task in the previous period (period-1).
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
12 years
Re: [rules-users] Value is not reflected in Fact Object at Drool Client Side
by Esteban Aliverti
'*MortgageAgent'*is just the name you want to use for the agent. You could
use whatever name you want. The important parts of the code snippet are:
Resource changeset = ResourceFactory.newClassPathResource(
"org/drools/guvnor/examples/mortgage/mortgage-changeset.xml");
kagent.applyChangeSet(changeset);
Please take a look at the content of 'mortgage-changeset.xml' to get a
better understanding of how this works.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
On Wed, Dec 5, 2012 at 10:44 AM, Hushen Savani
<hushen.savani(a)elitecore.com>wrote:
> MortgageAgent
12 years
Re: [rules-users] Value is not reflected in Fact Object at Drool Client Side
by Esteban Aliverti
I'm wondering where did you get the content of that Guvnor.properties file.
The problem you are having is that the property file is not used to tell
the agent which resources should it use, but to set some of its internal
configurations such as:
- drools.agent.monitorChangeSetEvents (boolean)
- drools.agent.scanDirectories (boolean)
- drools.agent.scanResources (boolean)
- drools.agent.newInstance (boolean)
- drools.agent.useKBaseClassLoaderForCompiling (boolean)
- drools.agent.validationTimeout (long)
So, the properties you have there are not even being user, nor understood,
by drools.
In order to tell the agent which resources should it use, you must provide
a change-set pointing to those resources. You can find more information
about change-sets in Drools documentation.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
On Wed, Dec 5, 2012 at 8:52 AM, Hushen Savani
<hushen.savani(a)elitecore.com>wrote:
> It seems that problem is with rule consumer (client), because even when
> I mess up with url of guvnor, it is giving me the same behavior:****
>
> ** **
>
> *Guvnor.properties*:****
>
> ** **
>
> url=http://localhost:10080/ *guvnor*-5.5.0.Final-*tomcat*
> -6.0/org.drools.guvnor.Guvnor/package/new *Pkg*/car111_*messed_up_url*****
>
> enableBasicAuthentication=true****
>
> username=*admin*****
>
> password=*admin*****
>
> name=*drooltest*
>
> * *
>
> ** **
>
> *Drool Consumer*:****
>
> ** **
>
> *package* kijanowski.eu;****
>
> ** **
>
> *import* java.util.Collection;****
>
> *import* java.util.Iterator;****
>
> ** **
>
> *import* org.drools.KnowledgeBase;****
>
> *import* org.drools.agent.KnowledgeAgent;****
>
> *import* org.drools.agent.KnowledgeAgentFactory;****
>
> *import* org.drools.runtime.StatefulKnowledgeSession;****
>
> ** **
>
> *public* *class* GuvnorTest {****
>
> ** **
>
> *public* *static* *final* *void* main(String[] args) {****
>
> ** **
>
> KnowledgeAgent agent = KnowledgeAgentFactory.*
> newKnowledgeAgent*("/Guvnor.properties"); ****
>
> KnowledgeBase ruleBase = agent.getKnowledgeBase();****
>
> ** **
>
> StatefulKnowledgeSession workingMemory =
> ruleBase.newStatefulKnowledgeSession();****
>
> ****
>
> Driver d = *new* Driver("Jarek", 20, *null*);****
>
> workingMemory.insert(d);****
>
> ** **
>
> workingMemory.fireAllRules();****
>
> ****
>
> *Collection* c = workingMemory.getObjects();****
>
> ****
>
> *for*(*Iterator* i = c.iterator(); i.hasNext();) {****
>
>
> //System.out.println(i.next().getClass().getCanonicalName());****
>
> Driver e = (Driver)i.next();****
>
> System.*out*.println(" Age: " + e.getAge() + " Name: "+ e.getName() + "
> Car: " + e.getCar() + " Object: " + e);****
>
> }****
>
> }****
>
> }****
>
> ** **
>
> Can anyone please suggest some pointers on the same.****
>
> ** **
>
> Thanks.****
>
> ** **
>
> Best Regards****
>
> *Hushen Savani*****
>
> ** **
>
> *From:* rules-users-bounces(a)lists.jboss.org [mailto:
> rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Esteban Aliverti
> *Sent:* Tuesday, December 04, 2012 9:38 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Value is not reflected in Fact Object at
> Drool Client Side****
>
> ** **
>
> Sorry, I've just re-read your post and saw that you already mentioned that
> you are not seeing the system.out of your rule.****
>
> What you can do is to debug (or add some code) to see which rules do you
> have in the kbase returned by the kagent.****
>
> My guess is that your are not getting what you are expecting from Guvnor.*
> ***
>
> ** **
>
> Best Regards, ****
>
>
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Blog @ http://ilesteban.wordpress.com
>
> ****
>
> On Tue, Dec 4, 2012 at 5:03 PM, Esteban Aliverti <
> esteban.aliverti(a)gmail.com> wrote:****
>
> Do you see the message you are printing in the RHS of your rule?****
>
> ** **
>
> Best Regards,****
>
>
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Blog @ http://ilesteban.wordpress.com****
>
>
>
> ****
>
> On Tue, Dec 4, 2012 at 3:28 PM, Mister Nono <noel.maurice(a)univ-jfc.fr>
> wrote:****
>
> Hi,
>
> Have you try to add in the then of the drools rule the line : *update(a);*
>
> Best regards. ;)
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Value-is-not-reflected-in-F...
> 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****
>
> ** **
>
> ** **
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
12 years
Guvnor and Global Functions
by Dean Whisnant
I'm using Drools/Guvnor version 5.1.1.
In the Global Area of Guvnor, under functions, I've created a function called splitDiagnosis.
In another package, we'll call it V222, I have a rule called LoadDiag.
In the Then section of the rule, I set the value of a field "=splitDiagnosis(diag,type)"
When run through our live software, the rule errors out because it evidently does not see the global area. If the rule is in the local package, then it works properly, but I have dozens of packages that all need access to this function and I don't want to keep copying it from one package to another.
I must be missing something to tell package V222 to include the global area. Any thoughts?
Thank you,
Dean Whisnant
12 years
Value is not reflected in Fact Object at Drool Client Side
by Hushen Savani
Hi,
I m a newbie. Again, stuck with a problem.
I have created a package in Drools Guvnor as:
Created two POJO. Driver and Car as following:
Driver.java:
package kijanowski.eu;
public class Driver {
private String name;
private int age;
private Car car;
public Driver(String name, int age, Car car) {
this.name = name;
this.age = age;
this.car = car;
}
.
//Setter and Getters
.
}
Car.java:
package kijanowski.eu;
public class Car {
private String color;
private double value;
public Car() {}
public Car(String color, double value) {
this.color = color;
this.value = value;
}
.
//Setter and Getters
.
}
Prepared its jar and uploaded to Guvnor as following:
Both POJO are loaded successfully:
Then I created a new rule as following:
Then I verified, build and created Snapshot.
Now, I prepared a client program to consume rules deployed
in guvnor as following:
package kijanowski.eu;
import java.util.Collection;
import java.util.Iterator;
import org.drools.KnowledgeBase;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.runtime.StatefulKnowledgeSession;
public class GuvnorTest {
public static final void main(String[] args) {
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("/Guvnor.properties");
KnowledgeBase kbase = kagent.getKnowledgeBase();
StatefulKnowledgeSession workingMemory =
kbase.newStatefulKnowledgeSession();
Driver d = new Driver("Jarek", 20, null);
workingMemory.insert(d);
workingMemory.fireAllRules();
Collection c = workingMemory.getObjects();
for (Iterator i = c.iterator(); i.hasNext();) {
d = (Driver)i.next();
System.out.println(" Age: " + d.getAge() + " Name: " +
d.getName() + " Car: " + d.getCar() + " Object: " + d);
}
}
}
And Guvnor.properties is as following:
url=http://localhost:10080/guvnor-5.5.0.Final-tomcat-6.0/org.drools.guvnor.G
uvnor/package/myNewPackage/car_example_snapshot
enableBasicAuthentication=true
username=admin
password=admin
name=drooltest
But when I run the client, I get following o/p:
Age: 20 Name: Jarek Car: null Object:
kijanowski.eu.Driver@15b9e68
I cannot see name changed to "Applicable" and cannot even see the o/p
of sysout on server side:
Can anyone please help me with this. Thanks.
Best Regards
Hushen Savani
12 years
Rules Unit Testing
by John Poole
How is unit testing handled for rules? I'm playing with the nurse
rostering app and the only test I see is a performance test.
-John
12 years
Using outcome of previous planning as input of new planning
by Michiel Vermandel
Hi,
We need to plan tasks over a period of 6 months.
But when the next planning is done (months after the first planning) we need to know some details about the previous planning.
For example, a person should not execute the same task twice in a row.
So I need to know who did a specific task in the previous planning in order to verify that it is not the same in this planning.
Do I need to persist the solution of the first planning?
Is there any example amongst the list of available examples which can give me a head-start on this?
Any help is greatly appreciated.
Regards,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
12 years
how to get first and last element of list of facts?
by Michiel Vermandel
Hi,
I need to plan some tasks within a nr of timeslots.
Until now a task was always done within the period of one timeslot and I could validate my rules since a task has a planning variablegetTimeSlot/ setTimeSlot.
Now requirements have changed and a task can take more than one timeslot to complete.
What is the best way to validate that the task is not started in a timeslot that would end the task after the last timeslot?
- Timeslots are always equally long (for example a week).
- All timeslots in the list of timeslots are sequential (no gaps).
So if I have a list of timeslots W18, W19, W20, W21 and I have a task taking 3 TimeSlots to complete, it should start in W18 or W19.
Should I create a single planningRange fact, holding the first and last slot?
Any directions would be appreciated.
Regards,
Michiel Vermandel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
12 years