[JBoss JIRA] Created: (JBRULES-2781) Optimization for sub-attributes in LHS conditions
by Frederico Ramos (JIRA)
Optimization for sub-attributes in LHS conditions
-------------------------------------------------
Key: JBRULES-2781
URL: https://jira.jboss.org/browse/JBRULES-2781
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler, drools-core
Affects Versions: 5.1.0.FINAL
Environment: Windows XP & 7 Pro, Eclipse Galileo, JDK 1.6 update 21
Reporter: Frederico Ramos
Assignee: Mark Proctor
Priority: Minor
When building a simple rule, we discovered that the resulting "rete tree" did not reused some node conditions, dispite they are listed in the same order. After some different approaches we get to the expected tree using explicit predicates.
Shouldn't both alternatives generate the same tree? And if don't, can some optimization be created in Drools CORE to handle this?
Note that although the tree is different, it uses the same node types.
OPTION 1: OPTIMIZED RETE TREE
------
{{{
#created on: 09/11/2010
package aa
#list any import classes here.
import br.com.auster.om.invoice.telco.CallDetail;
import br.com.auster.om.invoice.telco.ServiceTypeEnum;
import br.com.auster.om.util.UnitCounter;
import br.com.auster.om.util.UnitCounter.TypeOfUnitEnum;
import br.com.auster.om.invoice.telco.TelcoCustomer;
rule "call duration check 1"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds <= 3 )
then
// TODO
end
rule "call duration check 2"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds > 3 )
then
// TODO
end
rule "call-duration-check - realDuration > 30"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds > 30 )
then
// TODO
end
}}}
OPTION 2: NOT-OPTIMIZED RETE TREE
------
{{{
#created on: 09/11/2010
package aa
#list any import classes here.
import br.com.auster.om.invoice.telco.CallDetail;
import br.com.auster.om.invoice.telco.ServiceTypeEnum;
import br.com.auster.om.util.UnitCounter;
import br.com.auster.om.util.UnitCounter.TypeOfUnitEnum;
import br.com.auster.om.invoice.telco.TelcoCustomer;
rule "call duration check 1"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration.type == TypeOfUnitEnum.TIME,
$billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
realDuration.seconds <= 3 )
then
// TODO
end
rule "call duration check 2"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration.type == TypeOfUnitEnum.TIME,
$billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
realDuration.seconds > 3 )
then
// TODO
end
rule "call-duration-check - realDuration > 30"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration.type == TypeOfUnitEnum.TIME,
$billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
realDuration.seconds > 30 )
then
// TODO
end
}}}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[JBoss JIRA] Created: (JBRULES-2604) New simple JPAKnowledgeServiceBean that can be used to create / reload Stateful Knowledge Sessions
by Anatoly Polinsky (JIRA)
New simple JPAKnowledgeServiceBean that can be used to create / reload Stateful Knowledge Sessions
--------------------------------------------------------------------------------------------------
Key: JBRULES-2604
URL: https://jira.jboss.org/browse/JBRULES-2604
Project: Drools
Issue Type: Patch
Security Level: Public (Everyone can see)
Components: All
Affects Versions: 5.1.0.FINAL
Environment: N/A
Reporter: Anatoly Polinsky
Assignee: Mark Proctor
Attachments: JPAKnowledgeServiceBean.java
Spring bean that serves as a facade into Drools Session creation and reloading using persistent (JPA) knowledge state.
Public client APIs are newStatefulKnowledgeSession( ) and loadStatefulKnowledgeSession( sessionID ) which do just that:
newStatefulKnowledgeSession(): Creates a new StatefulKnowledgeSession
loadStatefulKnowledgeSession( sessionID ): Reloads an existing ( previously persisted StatefulKnowledgeSession ) by the sesssionID
Here is an example on how this bean can be configured:
<bean id="abstractKnowledgeProvider"
class="org.drools.container.spring.beans.persistence.JPAKnowledgeServiceBean">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="transactionManager" ref="txManager" />
<property name="knowledgeStore" ref="kstore"/>
<property name="kbase">
<drools:kbase id="kbase" node="node">
<drools:resources>
<drools:resource type="DRF"
source="classpath:./META-INF/flow/subprocess-flow.rf" />
<drools:resource type="DRF"
source="classpath:./META-INF/flow/parallel-subprocess-flow.rf" />
<drools:resource type="DRF"
source="classpath:./META-INF/flow/approval-flow.rf" />
</drools:resources>
</drools:kbase>
</property>
<property name="variablePersisters">
<util:map>
<entry key="javax.persistence.Entity"
value="org.drools.persistence.processinstance.persisters.JPAVariablePersister" />
<entry key="java.io.Serializable"
value="org.drools.persistence.processinstance.persisters.SerializableVariablePersister" />
<entry key="java.lang.String"
value="org.drools.persistence.processinstance.persisters.StringVariablePersister" />
</util:map>
</property>
</bean>
Besides "variablePersisters" all properties are mandatory ( cannot be NULL / not set ).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[JBoss JIRA] Created: (JBRULES-2462) Unable to read a properties file from DRL file
by Danny Shaw (JIRA)
Unable to read a properties file from DRL file
----------------------------------------------
Key: JBRULES-2462
URL: https://jira.jboss.org/jira/browse/JBRULES-2462
Project: Drools
Issue Type: Task
Security Level: Public (Everyone can see)
Reporter: Danny Shaw
Assignee: Mark Proctor
I am getting this error when my DRL file is attempting to read from a properties file
org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
Any suggestions then please let me know.
Thanks
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[JBoss JIRA] Created: (JBRULES-2321) Implicit binding and "or" CE in pattern cause ClassCastException
by Tihomir Surdilovic (JIRA)
Implicit binding and "or" CE in pattern cause ClassCastException
----------------------------------------------------------------
Key: JBRULES-2321
URL: https://jira.jboss.org/jira/browse/JBRULES-2321
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.7
Reporter: Tihomir Surdilovic
Assignee: Mark Proctor
This is a problem with Drools 4.0.7, it does not happen in Drools 5:
$factB.f1 is triggering a scenario where the engine creates an implicit biding to the "f1" field.
That in conjunction with the use of "or" is triggering the problem
rule "implicit bindings test"
when
FactA()
$factB : FactB( $fB : f1 )
(not FactC( f1 == $factB.f1 ) or FactC() )
then
end
The exception thrown is:
java.lang.ClassCastException: com.sample.FactAShadowProxy cannot be cast to com.sample.FactB
at org.drools.base.com.sample.FactB1865721816$getF1.getIntValue(Unknown Source)
at org.drools.base.extractors.BaseIntClassFieldExtractor.getHashCode(BaseIntClassFieldExtractor.java:85)
at org.drools.base.ClassFieldExtractor.getHashCode(ClassFieldExtractor.java:225)
at org.drools.rule.Declaration.getHashCode(Declaration.java:273)
at org.drools.util.AbstractHashTable$SingleIndex.hashCodeOf(AbstractHashTable.java:533)
at org.drools.util.TupleIndexHashTable.getOrCreate(TupleIndexHashTable.java:315)
at org.drools.util.TupleIndexHashTable.add(TupleIndexHashTable.java:227)
at org.drools.reteoo.NotNode.assertTuple(NotNode.java:93)
at org.drools.reteoo.CompositeTupleSinkAdapter.propagateAssertTuple(CompositeTupleSinkAdapter.java:30)
at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:156)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months