Re: JESS: Constraining values of a slot

2007-08-08 Thread Wolfgang Laun
To at least *detect* bad slot values consider setting up suitable rules that throw an exception, or whatever. The task of generating these straightforward rules can be automated with a userfunction. You might then, for instance, write (deftemplate SrcTemp (slot destFact)) (deftemplate

JESS: Constraining values of a slot

2007-08-06 Thread Neelakantan Kartha
Is there a way in Jess to constrain the values of a slot of a template to be instances of another template? For instance, consider the following template for a city: (deftemplate city (slot county) (slot population) (slot coordinates)) We would like the values of the slot location to be

Re: JESS: Constraining values of a slot

2007-08-06 Thread Ernest Friedman-Hill
You can't *constrain* the type, but you can hold facts in the slots of other facts. Just use the fact object (fact-id) itself: (bind ?gl (assert (geographical-location (latitude 20) (longitude 40 (assert (city (county Middlesex) (population 10) (coordinates ?gl))) On Aug 6, 2007, at