I thought wrapping a method in a eval statement is effectively allowing you to use methods
directly, it is syntactic sugar to say this is a method call, evaluate it and then use the
result in the rete graph.
From what I understand the problem with methods is drools has to
assume that the method always returns the same result given the same set of inputs and has
no side effects as it is non-deterministic how many (or few) times the method is called
and if the return value changes on different calls then it can really screw things up.
When writing beans getters normally follow this rule by convention and necessity, however
this is much less likely for arbitrary methods hence why it is good (IMHO) to force the
user to consider what they are doing explicitly.
Thomas
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-
bounces(a)lists.jboss.org] On Behalf Of Arjun Dhar
Sent: 20 April 2011 05:29
To: rules-users(a)lists.jboss.org
Subject: [rules-users] First Order Logic - METHODS in Drools
According to First order Logic, (from a rule perspective), one can
represent
their statements using:
PREDICATES, METHODS, CONNECTORS (including existential quantifiers)
..while PREDICATES can be synonymous with Object and Object
expressions; the
only way of using methods has been via "eval" (AFAIK, as per my
outdated
knowledge); and this is discouraged for the fact that evals perhaps
dont fit
in the RETE-OO scheme of things.
Please note: By methods I dont bean Bean getter/setters; but work horse
service layer methods.
..however, to be true to FOL, using methods directly should be
supported.
Q1) If it is, can one show or state an example?
Q2) If not, for METHODS that return a specific type of Object, cant
they be
useful in RETE-OO evaluation?
Q3) I've used "from" for DAO's , conceptually does "from"
address this
fully? In FOL (imo) PREDICATES & METHODS can be exchanged freely, not
sure
if "from" gives that freedom.
thanks
--
View this message in context:
http://drools.46999.n3.nabble.com/First-
Order-Logic-METHODS-in-Drools-tp2841531p2841531.html
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
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************