Exception executing eval predicate in a Split node (RuleFlow)
by Sangrish
hey guys
I am getting the exception :
-----------------------------
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( mhc!=MIN_INT.intValue() )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
....................
-------------------------------
while executing the predicate : Author1( eval(
mhc!=MIN_INT.intValue() ) )
in the condition part of a Split node in a ruleflow
where, Author1 is a class defined as:
------------------------------
package com.sample;
public class Author1 {
public int mhc = -1;
public Author1()
{}
public int getMhc() { return mhc; }
public void setMhc(int y) { mhc = y; };
}
----------------------------
and MIN_INT is a global Integer (duly set and imported as global through the
Split node constraint editor)
I have not been able to understand the reason for it. Please enlighten me.
Secondly, I am not able to have the concerned condition without "eval"
predicate which I heard is not good performance wise. I think that without
"eval" the Right Hand Side of a condition cannot have a non-constant. More
enlightenment!!! :)
I am using Drools Eclipse Plugin : 4.0.7
Thanks
Siddharth
--
View this message in context: http://www.nabble.com/Exception-executing-eval-predicate-in-a-Split-node-...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Exception executing eval predicate in a Split node (RuleFlow)
by Sangrish
hello
I am getting the exception :
-----------------------------
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( mhc!=MIN_INT.intValue() )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
....................
-------------------------------
while executing the predicate : Author1( eval(
mhc!=MIN_INT.intValue() ) )
in the condition part of a Split node in a ruleflow
where, Author1 is a class defined as:
------------------------------
package com.sample;
public class Author1 {
public int mhc = -1;
public Author1()
{}
public int getMhc() { return mhc; }
public void setMhc(int y) { mhc = y; };
}
----------------------------
and MIN_INT is a global Integer (duly set and imported as global through the
Split node constraint editor)
I have not been able to understand the reason for it. Please enlighten me.
Secondly, I am not able to have the concerned condition without "eval"
predicate which I heard is not good performance wise. I think that without
"eval" the Right Hand Side of a condition cannot have a non-constant. More
enlightenment!!! :)
I am using Drools Eclipse Plugin : 4.0.7
Thanks
Siddharth
--
View this message in context: http://www.nabble.com/Exception-executing-eval-predicate-in-a-Split-node-...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
first steps with drools.....first errors
by Nicola Benaglia
Hi,
I am moving my first steps with Drools 4.0.7.
In my case I have an exam result to valuate.
I can pass an ExamDetailas fact containing (value, authLimit, lawLimit)
where authLimit may or may not be present.
How can I force to valuate a rule only if a property exists?
Here an example:
rule "Rule n.1"
dialect "mvel"
no-loop true
salience 10
when
exists ExamDetail(authLimit);
$examDetail : ExamDetail( $value: value < authLimit);
then
System.out.println( "1 Exam passed!" + $value);
end
rule "Rule n.2"
dialect "mvel"
no-loop true
salience 10
when
not exists ExamDetail(authLimit);
ExamDetail( $value: value < lawLimit);
then
System.out.println( "2 Exam passed! + $value);
end
With these 2 rules I expected to cover my 2 cases:
1) When I have authLimit --> rule #1
2) When authLimit is absent --> rule #2
But I get this error (when I don't have authlimit):
Exception in thread "main" org.drools.rule.InvalidRulePackage: [14,21]:
unknown:14:21 Unexpected token 'authLimit'[25,6]: unknown:25:6
Unexpected token 'exists'[25,24]: unknown:25:24 Unexpected token 'authLimit'
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at eu.tecnoprogetti.rules.seam.ExamCheck.main(ExamCheck.java:23)
Any suggestions?
Thank you for your time.
Nico
17 years, 3 months
UseCase: Drools in Engineering
by Michael Zimmermann
HI Edson,
while discussing custom operators in drools trunk, you pocked me
repeatedly to write something about how we use drools in a research
project in the field of engineering. Here you go... may be it is also
helpful or at least interesting for the other readers on this list :-)
The Scope: Naval Engineering,
In naval engineering vessels consists of thousands of parts (read: way
more than an aircraft has today). Focusing on the steel structure, most
of these parts are 2-dimensional plates of a certain size, thickness,
grade and contour. For most fields of applications detailed regulations
from classification societies etc. exist.
Currently, the design of such objects is done using specialized CAD
systems. Here the following issues are present in all cad systems and
the design process today:
- design time is 6 - 18 months (and not 10 - 15 years as for an
air plane)
- this means concurrent design, i. e. different people are working on
parts or features that are closely related (strength, fatigue, cost,
functional aspects or just being in the same room) on different levels
of granularity (changing the hull 6 weeks before building happens!)
- and no connection between design intent (specification on paper),
design conditions (regulations, by the customer, results of
calculations) and design solution chosen.
Result:
- We just have the geometrical data, nothing more in the CAD-model
- No automatic checks if a certain component is changed; no automatic
tests if a chosen design solutions really satisfies the conditions at
lowest cost today
- Therefore, changes (which you can't avoid) are cost intensive and
error prone. Also, no one really knows why a certain solutions was chosen
Enter Logic & Drools
The objective of our research is to make the design process context
aware. Example: If I design a "door" in a watertight "wall" the cad
system should check whether the selected door is a watertight model.
So, using one of the most popular commercial cad systems for naval
engineering the approach is to define the standards (currently
paper-based) electronically using DROOLS. Also, context-information
like watertight, stress level=x ... is added to the model and reused in
the design process. For standard design tasks (in a part of the field of
detailed steel structural design) we use drools to completely automate
the design process, i. e.
- find a design problem in the model
- select a suitable solution adhering to all known boundary conditions
- design the solution
- and assign a assurance level for the solution (how good is it?)
Lessons Learnt from an Engineering POV
1) Extracting the knowledge is hard
2) Formulating it logically sound even harder (even official regulations
are vague on a regular basis)
3) Defining the context a solution is valid for is even more difficult.
4) Current CAD systems in naval engineering are not really capable to
store meta information and to interface with other applications.
Lessons Learnt from a Drools POV
1) Drools is quite a nice system :-)
2) With DSL even engineers can use it (once they are trained how to
"Think Rules". And that is next to impossible)
3) What's missing is some solution to easily define classes, class
hierarchies and (!) instance data. We use OWL for now. eCore might be
usable yet is terrible from a UI usability perspective
4) Not drools is the problem but getting the data in and out!
4a) The Smooks binding could be a godsend for this
4b) Fact templates sound really promising if you think dynamically
generated classes via web services...
What's missing in Drools?
- An OWL/RDF binding would be really great (we use OWL to define, edit,
store our standards. But encountered the clash of open world logic (DL)
and closed world logic (CS) more than once.) I know there is quite a
large interest for such a solution in the Ontology user base.
- Better support for constraint programming (what we do here and there)
for simple primitive cases (read: selection processes) would help.
Drools solver is overkill; drools rules can not handle this if you think
optional constraints. The custom operator "== (open world style)" we
talked about helps, though.
Well, it has gotten longer than I expected yet only skimmed the surface
of our approach, I think. Hopefully not to long :-)
cu, Michael
17 years, 3 months
Drools Research Network
by Mark Proctor
I'm trying to get together a single source of knowledge on all the
drools related research going on and various institutes involved. I've
setup a wiki page to capture this information, if you are able to add to
it please do. It contains a list of the projects, as well as the
universities and mentors associated with Drools research.
http://wiki.jboss.org/wiki/DroolsInAcademia
The wiki page can be edited by anyone who has registered and logged in,
the registration link should be on the top of the page.
Mark
17 years, 3 months
Drools & "Query by Example"?
by Michael Zimmermann
Hi there,
I am not really sure what is the best approach to model this the drools
way... So, what is the best approach using drools to find all objects of
a known type that fulfil certain criterias? Caveat: The number of
criterias is flexible and not known?
I know, that such a selection process can be defined as simple case of
constraint programming. Afaik this could be a problem for any rulebased
system. Yet we do not want to introduce another compontent as this leads
to dependency and communication issues.
Example:
Assume a class book with properties "author", "year", "id" and
"publisher". As our problem is more complex I want to test book
instances for the properties "author", "year" etc. in individual rules.
Now, given a list of books in the working memory I want to get answer to
the following questions:
- List all books with author="myName", id="123"
- List all book with publisher="Frank"
Due to the closed world assumption in Java and hence Drools, what is not
possible is:
rule "MyRule"
when
book(year==myYear, author==myAuthor ...)
then
....
This works only if all properties myYear, myAuthor ... are present. If
one is undefined, the rule does not match.
The System:
The system uses drools quite successfully for many tasks. All data
objects are persisted using db4o.
Currently, I can think of two different approaches:
1)
- Start with all objects in the working memory
- For each condition, if present, flag all objects, that do not
fulfil this condition, as invalid
- Afterwards, list / process all objects that are not marked as invalid
2)
- Start with no object in the working memory
- Construct a blank object of the type analyzed
- If a certain condition is present, add this conidtion to
the object
- Query the object database in db4o and add all valid matching
object to the working memory. (db4o supports QueryByExample)
The double negotiation in the first approach is hard to understand and
difficult to maintain. The second approach works reasonably well yet
moves some of the main application logic to another component.
So, any clues, pointers or ideas how to solve this problem in a better way?
cu, Michael
17 years, 3 months
Adding a custom operator to drools?
by Michael Zimmermann
Hi there,
you might see this as a follow up to a discussion named "Query by
Example" a couple of days ago, see here:
http://lists.jboss.org/pipermail/rules-users/2008-September/006520.html
Question to the devs:
Having looked through the code, adding support for a custom operator
requires
- changing the DRL.g
- regenerating the DRLLexer and DRLParser classes from this grammar
- changing the XyzEvaluator and related classes in
org.drools.base.evaluators.
If I skip MVEL, the BRMS and other places like decision tables for now,
is this all to expand the DRL syntax? Or are any further steps required
to connect the grammar with the "java logic"?
Thanks!
Michael
17 years, 3 months