Re: basic question
Paolo Amoroso <[email protected]> Thu, 12 Oct 2006 12:00:21 +0200
| Newsgroups | gmane.lisp.lisa.general |
|---|---|
| Organization | Paolo Amoroso - Milano, ITALY |
| Message-ID | <[email protected]> |
Kaveh Kardan <[email protected]> writes: > Do the "facts" of the system have to be CLOS classes or templates? Facts can be both CLOS instances and Lisa templates. I guess that templates are better for simple facts or "legacy" rules (e.g. when porting from CLIPS/JESS), and CLOS instances for more complex cases. > Is it possible to have LISA do inference over facts expressed as > thunks or arbitrary lisp expressions? Not directly, but you could created CLOS classes or Lisa templates with slots containing the required thunks, and use test patterns for matching if necessary. > For example, I have a movie scene, and I am developing a system for > automatically placing the camera to best shoot the scene. I would > like to be able to express rules such as the following: > > (defrule rule-1 (:cf 0.8) > (is-first-shot-of *scene*) > => > (make-establishing-shot *scene*)) What is is-first-shot-of? A function? If so, you could use something like (untested, no pun intended): (defrule rule-1 (:cf 0.8) (test (is-first-shot-of *scene*)) => (make-establishing-shot *scene*)) > Also, how would one best express things such as the following as a rule? > > (let ((actor-1 (current-subject *scene*)) > (actor-2 (non-current-subject *scene*))) > (if (> (viewer-identification-with actor-1) > (viewer-identification-with actor-2)) > (make-closeup-shot actor-1) > (make-over-the-shoulder-shot actor-1))) You may express the LET bindings with object/template matching, using variables and tests if necessary. > pointers to articles or texts with a practical bent would be > appreciated. See: LISA and rule-based programming in Common Lisp http://www.paoloamoroso.it/log/050827.html Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642