Thank you Bob for your quick and useful answer! It was simpler than I
was trying (without success).
I have another related question, I hope not to abuse ;). How can we
modify the print function for printing names sorted alphabetically? In
the Jess in Action book an example rule called
As a Jess 7.0p1 query:
(defquery unique-first-name
A query for unique first names among person facts
?person - (person (firstName ?firstName))
(not (and ?earlier-person - (person (firstName ?firstName))
(test ( ?earlier-person ?person)
(deffunction
Thanks for that Wolfgang. Actually we do already have a workaround -
somewhat similar to what you describe below. However I just wanted to
point out what is happening in the jess code in the m_deftemplates
TreeMap when you redefine an extended deftemplate.
Regards,
- Howard
-Original
Two solutions.
(A) You define a query:
(defquery personQuery
(person (firstName ?fn)(lastName ?ln)(age ?age)))
The Jess function values-of runs the query and processes the result,
collecting the values of the result component with the name given as the
function argument name into the list
I can't reproduce anything like this; can you show me a stack trace
(run jess.Main with -stacktrace to see a full error trace).
On Aug 2, 2007, at 6:12 PM, Skeptic 2000 wrote:
When I add a shadow fact with a property having a null value, I get
an exception (in updateMultiSlot IRRC).
JFL
Instead of imnmediately printing the results below, add them to a
java.util.List, and sort the list; then you can print them in order.
So, for example
(import java.util.*)
(deffunction print-unique-first-names ()
print unique first names from person facts
(bind ?results (run-query*
Hi and thanks a lot for helping, the details are here :
That's the ShadowFact :
public class Test {
private Integer a = null;
private Integer b = 4;
public Test() {
}
public int getA() {
return a;
}
public int getB() {
return b;
}
}
That's the .CLP file :
(defclass Test
Look closely at your stack trace: it says Message: Called method
threw an exception. If you called getCause() on the JessException,
it would return a NullPointerException, and if you looked at that
NPE's stack trace, you'd see it was thrown by the getA() method of
your Test class. Here are
Well, I'm really sorry...JFL
From: [EMAIL PROTECTED] Subject: Re: JESS: dealing with shadow facts having
null properties Date: Fri, 3 Aug 2007 15:23:03 -0400 To:
jess-users@sandia.gov Look closely at your stack trace: it says Message:
Called method threw an exception. If you called