JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates
"Henrique Lopes Cardoso" <[email protected]> Fri, 10 May 2013 09:54:19 +0100
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <CALLS5+Be1x6iaQ-=GSFfwo=iCJPX3LSB4GO0y9NRGUOfVCtebg@mail.gmail.com> |
--047d7b471d9c00137e04dc59509b Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-1 Hi, I am concerned with the at least two different ways in which you can add, to working memory, facts that are instances of from-class deftemplates. Lets say I have: (deftemplate FC (declare (from-class FC))) I can add a shadow fact like this: (bind ?fc (new FC)) (add ?fc) This is the general approach described in Section 5.3.2 of the Jess manual. But I can also simply go like: (assert (FC)) I guess in this case I do not get a shadow fact, since the OBJECT slot is nil. So, my question is: if my facts are not supposed to be changed from Java code, is there any difference in using each of these approaches? Section 5.3 from the Jess manual does not even mention that instances of from-class deftemplates can be created using the second approach above. Thanks! Henrique --047d7b471d9c00137e04dc59509b Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <div>Hi,</div><div><br></div><div>I am concerned with the at least two diff= erent ways in which you can add, to working memory, facts that are instance= s of from-class deftemplates.</div><div>Lets say I have:</div><div><div> <br></div><div>(deftemplate FC (declare (from-class FC)))</div></div><div><= br></div><div>I can add a shadow fact like this:</div><div><br></div><div>(= bind ?fc (new FC))</div><div>(add ?fc)</div><div><br></div><div>This is the= general approach described in Section 5.3.2 of the Jess manual.</div> <div>But I can also simply go like:</div><div><br></div><div>(assert (FC))<= /div><div><br></div><div>I guess in this case I do not get a shadow fact, s= ince the OBJECT slot is nil.</div><div><br></div><div>So, my question is: i= f my facts are not supposed to be changed from Java code, is there any diff= erence in using each of these approaches?</div> <div>Section 5.3 from the Jess manual does not even mention that instances = of from-class deftemplates can be created using the second approach above.<= /div><div><br></div><div>Thanks!</div><div><br></div><div>Henrique</div> <div><br></div> --047d7b471d9c00137e04dc59509b--