prevent infinite loops
by Garner, Shawn
Is there a good way to globally prevent infinite loops.
I had rule A and rule B and they both have FactA on the condition.
They also both modify FactA.
I tried no-loop and it prevents a loop of repeating RuleA over and over.
However it then goes from Rule A back to Rule B back to Rule A.
I fixed it by lock-on-active instead of no-loop.
However I was wondering if there was either a timeout feature or a maximum number of times you could set a rule to be executed to error out on infinite loops.
Any guidance would be appreciated.
Thanks,
SDG
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect(a)principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.
15 years, 10 months
Checking in one rule the "result" of another rule
by orchid
Hi All,
I have "rule1" and "rule2", very simple rules. I would like in "rule3" to
check one of the following:
"rule1" AND "rule2" (i.e. if both rule1 and rule2 were fired)
"rule1" OR "rule2" (rule1 or rule2 was fired)
How can I achieve this? Does the "extends" keyword might help here?
I achieved that buy defining a list, to which rule1 and rule2 in the RHS
inserted some value. In rule3 I checked the values of that list. I would
like to ask if there are some prettier solutions.
Thanks in advance.
Any help would be appreciated.
--
View this message in context: http://n3.nabble.com/Checking-in-one-rule-the-result-of-another-rule-tp17...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Re: [rules-users] newbie, Expressing a rule in different ways
by rouvas@di.uoa.gr
Wolfgang Laun wrote:
> 2010/1/31 <rouvas(a)di.uoa.gr>
>
>> Wolfang,
>>
>> thank you very much for your reply.
>>
>> Your assumptions are correct and your explanation makes sense.
>> Unfortunately, I cannot understand why this happens.
>>
>>
> It may very well be an implementation restriction; whether it can be
> removed easily I'm not prepared to say. (@Edson?)
Fair enough.
>
>
>> The IUEcop has the following structure (in rough terms)
>> IUEcop
>> +- (various objects as properties)
>> +- list of traderAuthorisation
>> +- list of warehouseAuthorisation
>> +- list of temporaryAuthorisation
>>
>>
>> A more general issue with my understanding has to do with handling of
>> deeply nested objects. In my case, the "traderAuthorisation" object has
>> itself another set of object properties and lists that I would like to
>> refer to in my rules. Are you aware of any relevant documentation?
>>
>
> Nested objects that are not facts but shared between fact objects should
> not
> cause any problems; especially the MVEL syntax is provided for easy
> access to properties of a property.
>
> If such an object is shared among several fact objects, you'll have a
> problem whenever such a shared object is updated by code on a RHS:
> To trigger reevaluation of rules, the engine would have to be
> notified about all objects referring to the shared object as being
> updated.
Although in my case the objects are not shared, I understand the issues
involved.
>
> Lists is adding another twist, even though the "from" CE appears
> to simplify handling of Iterable properties and works well enough.
> The recommended (see Drools Expert, section 4.8.2.8, Conditional
> Element "from") alternative is to add List elements as WM elements
> of their own,
I was hoping to avoid this.
This is how I was doing things in Prolog, but I was hoping that
object-orientation would help tackling this issue.
Anyway, thanks a lot for your help.
-Stathis
> even though this may require the addition of linking
> information to the list elements. (In your case: a TraderAuthorisation
> would have to contain a reference to the IUEcop object it belongs
> to.) You'll have to balance the additionally required coding effort
> for this against the greater complexity of rules using "from".
>
> -W
>
>
>> Thank you very much for your time,
>> -Stathis
>>
>>
>
15 years, 10 months
newbie, Expressing a rule in different ways
by rouvas@di.uoa.gr
Can you please explain why the second form of the same (as it seems to me)
rule does not work?
This works:
rule "takeTwo"
when
$c : CD713AType(
Body.incrementalUpdateOfEconomicOperators.traderAuthorisation.size !=
0 )
$t : TraderAuthorisationType ( $t.OperatorRole.size == 0) from
$c.Body.incrementalUpdateOfEconomicOperators.traderAuthorisation
then
stdout(drools.getRule().getName()+"
"+$c.getHeader().getMessageIdentifier());
end
and this fails to compile:
rule "take3"
when
$c : CD713AType( $i : this.Body.incrementalUpdateOfEconomicOperators )
$t : TraderAuthorisationType ( $t.OperatorRole.size !=0 ) from
$i.traderAuthorisation
then
stdout(drools.getRule().getName()+"
"+$c.getHeader().getMessageIdentifier());
end
with the message:
Unable to build expression for 'from' : Failed to compile: 1 compilation
error(s):
- (1,22) unqualified type in strict mode for: traderAuthorisation
'$i.traderAuthorisation' : [Rule name='take3']
Pretty new to Drools and try to figure out how things work.
In the second form of the rule I am trying to use the $i variable as a
shortcut for the "Body.incrementalUpdateOfEconomicOperators" locator.
"stdout" is just a function that print to System.out
Thank you for your time,
-Stathis
15 years, 10 months
Drools and Persistence How much Reliable and Secure
by KiranP
i m a Novice level user of drools and i want to use drools for our firms new
projects
so, i m evaluating the Drools 5.0 and 5.1 versions so that i can rely on
some thing very reliable and secure
i have worked out with the Drools5.1 variable persistence strategy and also
worked out some examples and i think it is also good to work with a
plugabble version of Persistence
So now my problem is what to use My own Persistence Mechanism in Drools5.0
or to use Drools5.1 with its provided plugabble Persistence Mechanism ???
one more thing can somebody tell me which books or online documents to refer
while using drools 5.1 ???
Thanks in advance......
yours always thankfullllll
KiranP
--
View this message in context: http://n3.nabble.com/Drools-and-Persistence-How-much-Reliable-and-Secure-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Are knowledgebases configurable?
by HonorGod
Hi,
I am working on a simple framework that does 4 things in sequence -
1 - Load Rules
2 - Load Data
3 - Apply Rules
4 - Persist Data
The framework allows to perform steps 3 and 4 multiple times that is
configurable via XML. My question - Is there a way that drools provides me
so that I can specify in configuration file that - load rules file 1 into
knowledgeBase 1 and load rules file 2 into knowledgeBase 2 and so on. I need
this because when I apply rules I wanted to specify which knowledge base to
use, configurable via xml again.
I hope my question is clear!
Thank You,
Jagadeesh.
--
View this message in context: http://n3.nabble.com/Are-knowledgebases-configurable-tp135809p135809.html
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Drools Execution Server and NoClassDefFound
by Régis Ramillien
Hello,
I have a problem using execution server. It sends a NoClassDefFoundError.
I search for hours, but find nothing...
Why I have done, in guvnor:
I have created :
-- a package "com.myorg.myapp"
---- a declarative model "Model1"
------ with a fact "Fact1"
-------- with a text field "field1"
-------- with an integer field "field2"
---- a Business Rule "rule1"
------ which test for the "field1" value, and set the "field2" to a dummy
value.
I then created a snapshot called 'release'
I created a myappAgent.properties with the following values:
name=mrgAgent
newInstance=true
url=
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/com....
poll=60
I put the file in drools-server classes directory
I then tried to call execution server using CURL:
curl --data "<knowledgebase-request><
inOutFacts><named-fact><id>Fact1</id><fact
class='com.myorg.myapp.Fact1'><field1>Any
response?</field1></fact></named-fact></inOutFacts></knowledgebase-request>"
http://localhost:8080/drools-server/knowledgebase/myappAgent
And the server (drools-server I assume, not guvnor ?), send me this
response:
...
ling this request.</u></p><p><b>exception</b>
<pre>javax.servlet.ServletException: Servlet execution threw an exception
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
</pre></p><p><b>root cause</b> <pre>java.lang.NoClassDefFoundError:
com/myorg/myapp/Fact1
ASMAccessorImpl_87013581264610722640.getValue(Unknown Source)
org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:66)
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:99)
org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
org.mvel2.MVEL.executeExpression(MVEL.java:978)
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:637)
org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:203)
org.drools.server.KnowledgeStatelessServlet.doService(KnowledgeStatelessServlet.java:152)
org.drools.server.KnowledgeStatelessServlet.doPost(KnowledgeStatelessServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
What have I done wrong ???
Please ,help me !!!
Regards,
Régis Ramillien
15 years, 11 months