RE: JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates
The thing is that after this code: (deftemplate Person (declare (from-class Person))) (bind ?f (assert (Person (name Henrique) (age 38 There's no way to transfer those property values to a Person object; i.e., if you then said (modify ?f (OBJECT (new Person))) Then the Person's name and age would NOT be Henrique and 38; they'd be something else. The only way to get a shadow fact and a Java object synced up automatically is to let Jess copy the properties to the fact from the object. To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
RE: JESS: [EXTERNAL] Usage of abstract classes in rules
Typically slots come from JavaBeans properties, not fields – i.e., accessor methods like getEventID(). But if you specify “include-variables” when you create a deftemplate from a class, then public (and only public!) member fields will be used as well. See http://www.jessrules.com/jess/docs/71/memory.html#shadow_facts . From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Tom De Costere Sent: Tuesday, May 21, 2013 6:24 AM To: jess-users Subject: JESS: [EXTERNAL] Usage of abstract classes in rules Hello, I currently have some abstract classes which are then implemented in various other classes extending those abstract classes. Now I’ve been trying to get Jess to work with both the abstract class as the implementation class, but somehow Jess cannot reach to the fields/methods specified in the abstract classes? Is this normal functionality of Jess or must I make such a conversion object that contains both the fields from the abstract class as the fields from the implementation class? Example: My abstract class AbstractApplicationEvent contains following protected fields: - eventID - eventName - eventTimestamp My subclass ConnectionMadeEvent extending the abstract class above no extra fields, but can be extended in the future. Rule: (defrule connection_established (declare (salience 50)) ?f1 - (ConnectionMadeEvent (eventID ?id) (eventTimestamp ?eventTimestamp)) = (assert (Notification (icon ICON_CONNECTION_ACTIVE) (generationTime ?eventTimestamp) (event ?f1))) ) Error message: SEVERE: Error loading Ruleset from: rules/global_rules.clp Jess reported an error in routine Jesp.parsePattern. Message: No such slot eventTimestamp in template MAIN::ConnectionMadeEvent at token 'eventTimestamp'. Program text: ( defrule connection_established ( declare ( salience 50 ) ) ?f1 - ( ConnectionMadeEvent ( eventID ?id ) ( eventTimestamp at line 110 in file rules/global_rules.clp. ... Thanks in advance! Tom DC
Re: JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates
Got that, thanks a lot. Henrique On Thu, May 16, 2013 at 3:24 PM, Friedman-Hill, Ernest ejfr...@sandia.govwrote: The thing is that after this code: (deftemplate Person (declare (from-class Person))) (bind ?f (assert (Person (name Henrique) (age 38 There's no way to transfer those property values to a Person object; i.e., if you then said (modify ?f (OBJECT (new Person))) Then the Person's name and age would NOT be Henrique and 38; they'd be something else. The only way to get a shadow fact and a Java object synced up automatically is to let Jess copy the properties to the fact from the object. To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov. -- - - - - - - - - - - - - - Henrique Lopes Cardoso DEI/FEUP Rua Dr. Roberto Frias | 4200-465 Porto PORTUGAL VoIP: (+351) 220413355 Phone: (+351) 225081400 ext.1315...@fe.up.pt | www.fe.up.pt/~hlc - - - - - - - - - - - - -
JESS: [EXTERNAL] Semantic network implementations
Hello respected scientists, Is JESS the best environment to implement a semantic network? If it is indeed, is there an example I can follow? There isn't any in the JESS in Action book. Sincerely, -Ahmed