Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory
by guyramirez
I am looking into Planner for a schedule assignment business case.
I created a move factory, got the local search phase set up and quicly ran
into a "presumedScore is corrupted because it is not the realScore" error.
As a work around, I changed my Move::doMove(..) implementation to "retract"
then "insert" rather than "update" the new updated planning entity and the
issue went away.
Then I worked on setting a construction heuristic and I again ran into the
same error. By applying a local code patch to the
PlanningValueWalker::changeWorkingValue(..) method to also "retract" and
"insert" rather than "update" also fixed the issue.
I also tried to correctly implement the hashCode() and equals(..) methods on
my planning entity (as mentioned in Drools Expert documentation) as well as
use the default implementation of those methods (as in the nurse rostering
example) with the same unsuccessful results.
I must mention than I am able to run the nurse rostering example without any
issues.
Could someone maybe point me to the right direction on why "update" does not
work for me? I can provide detailed information if needed.
Thanks,
Guy
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
'else' in rule
by snehils
Hi All,
I want to take action when the condition in WHEN fails. Something like as
follows:
WHEN
<Condition>
THEN
<Action>
/ELSE
<Action when Condition fails>/
Is it possible to have else part in rule? Or I have to make another rule for
failed condition?
I am using Drools 5.1.0 version.
--
View this message in context: http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3264337.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Drools Ruleflow persistence on MySQL - invalid SQL query generated
by victorC
Hi,
After few days of struggling on Drools Ruleflow persistence setup on MySQL I
finally came to the point when I feel it almost works but I am getting an
MySQL error.
I see the following SQL query in the log /it does not look correct/ which
is followed by the MySQL error message.
select processins0_.InstanceId as col_0_0_ from ProcessInstanceInfo
processins0_, EventTypes eventtypes1_ where
processins0_.InstanceId=eventtypes1_.InstanceId and (? in (.))
WARN [JDBCExceptionReporter] SQL Error: 1064, SQLState: 42000
ERROR [JDBCExceptionReporter] You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near '))' at line 1
I googled for similar symptoms but with no success.
Will be very grateful for any support, hint, etc!
My setup is:
JBoss 4.2.3.GA
Hibernate 3.2.4.sp1
JBoss Seam 2.2.0.GA
Drools 5.1.1
MySQL 5.1.41 / mysql-connector 5.0.7
persistence.xml
...
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/edento-MySQL-ds-XA</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
<class>org.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
...
datasources-ds.xml
…
<xa-datasource>
<jndi-name>MySQL-ds-XA</jndi-name>
<xa-datasource-property
name="URL">jdbc:mysql://localhost:3306/db</xa-datasource-property>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<user-name>root</user-name>
<password></password>
<track-connection-by-tx>true</track-connection-by-tx>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
<idle-timeout-minutes>10</idle-timeout-minutes>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
...
orm.xml
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in (processInstanceInfo.eventTypes)
</query>
</named-query>
</entity-mappings>
The bean java code – just starts the process and then immediately attempts
to load it from the database.
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
WorkflowProcessInstance processInstance =
(WorkflowProcessInstance)ksession.startProcess("TestProcess");
//retrieving...
ksession =
JPAKnowledgeService.loadStatefulKnowledgeSession(ksession.getId(), kbase,
null, env);
processInstance =
(WorkflowProcessInstance)ksession.getProcessInstance(processInstance.getId());
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Ruleflow-persistence-on-MySQL-in...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
duration attribute & other rule language features issue
by Prashant Badhe
Hi,
we were using drools engine 5.0.1 version with rules having 'duration',
'agenda-group' attributes and now we want to upgrade drools engine to 5.1.1
or latest 5.3.0 but we find 'duration' feature not working. What are the
equivalents of those features in 5.1.1 and in 5.3.0?
>From drools-expert document, 'duration' seems as deprecated with 'timer'.
But even 'timer' is not working. Putting 'timer' attribute as:
rule "test timer attribute"
agenda-group "enrichment"
auto-focus true
no-loop
salience 140
timer ( int: 5s )
//duration ( 5000 )
when
......
then
......
end
gives "Error: java.lang.ArrayStoreException" Drools compilation error.
"timer ( 5s )" compiles, but the rule never fires.
We are also planning to use @expires in declare. But facts are not seems to
be expiring.
What am I missing here? What are the equivalent for 'duration' in
5.1.1/5.3.0 and how to use @expires in declare?
Please point us to some sample rules that uses these semantics and are
working.
Thanks in advance,
Prashant B.
13 years
MVEL expression
by Femke De Backere
Hi,
The following expression keeps returning the error [112,32]: [ERR 103]
Line 112:32 no viable alternative at input '+' in rule "RuleFlow-Split-
masterproef.ruleflows.shortsedation-18-22" in pattern Patient:
Patient(sedation.ultiva+0.02 > 0.1)
with sedation.ultiva returning a double
What am I doing wrong?
Thx,
Femke
13 years
facts custom sort
by Syargey
Hello all,
I experienced a problem I can't solve.
After rules firing I got a number of facts of certain type.
I would like to get a collection of facts sorted by custom field with a
query.
Drools guide proposes to sort facts by a rule like:
rule "Rule 03"
when
$number : Number( )
not Number( intValue < $number.intValue )
then
System.out.println("Number found with value: "+$number.intValue() );
retract( $number );
end
But it doesn't suit me:
1) I can't retract facts from session
2) I need to get sorted collection with a query which doesn't have 'then'
part.
Is there any method to get custom sorted collection with a query?
--
View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3538410.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
removing reference to Global Data Model from Drools Package in Guvnor
by Welsh, Armand
Hello community,
I have noticed in interesting paradox in Guvnor.
If I promote my data model to the Global package, I can then import the model from global into my individual packages, so that I can update the model once, and all packages that use the model automatically have the new model.
However, I have a need to remove the imported model from one of my packages.
If I select the Model view, I have three buttons, Refresh List, Open Selected, and Open Selected to Single Tab.
If I open the model, and select the Attributes tab, it show the model comes from Global. If I archive the model, the global model is archived, and removed from all packages. If I restore the model, it is restored to all the packages that referenced it prior to archiving the model.
So my question: how to I remove a model, that was imported into a package from the Global Area, from my package, without remove the global model from the global area?
Regards,
Armand Welsh
13 years
Re: [rules-users] Guvnor hates me
by Ronald Albury
Thanks Michael ... you've been very helpful.
Yes, I am considering helping out on the documentation (my undergrad is in
Instructional Technology) ... if I can ever figure out how all of this
works. I have also read thru some of the 3rd party books on the subject,
and I find them quite lacking also. I am not a dumb person, and I am not
inexperienced (been programming since 1980) ... so either I am just having
issues with the writing style of the manuals/books, or other people are
having trouble with them as well.
While we're waiting for an eclipse person to speak up, I have another
eclipse question. If I do a Project->Build All, I can see the errors in my
rule files. How can I configure eclipse to see the drl errors when I save
the files (as happens with my Java files).
Thanks.
13 years