I think Littell, Todd R ERDC-CERL-IL wrote: > > I came up with: (eq (call ?fact getName) "MAIN::house") but I suspect > there is a much > more intuitive way than this.?
Not really. Just as in Java, it's better not to lose the type information in the first place. If you cast something to Object, then you have to unse the inelegant "instanceof" operator to figure out what it really is and get the information back. > For example, suppose I simply have a fact set like: > > (deffacts myfacts > (house 34 "abc" 1995) > (house (builtin 1993) (roofAge 19) (company "def") (ac "yes")) > (house "ghi")) You can't. A particular template is either ordered or unordered. You can can't have both. > > What are the basic methods for exploring the structure of a returned fact? Remember that a fact is an instance of the Java class jess.Fact. Given a jess.Fact, you can call getDeftemplate() on it, and then ask that jess.Deftemplate for the number of slots and their names. Once you know the name of a slot of interest, you can call getSlotValue() on the Fact to get its value. But in practice, you'll find that doing anything like this is only very rarely necessary -- about as often as using the java.lang.reflect package is in Java programming. I'd go so far as to say that if you need to do anything like this, especially as a newbie, then you're doing something wrong. Procedural manipulation of facts is not something that you should regularly need to do; facts should mostly be things you match on the LHS of rules, and that's all. --------------------------------------------------------- Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------