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 100000) (coordinates ?gl)))
On Aug 6, 2007, at 5:22 PM, Neelakantan Kartha wrote:
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 instances of
the following template:
(deftemplate geographical-location
(slot latitude)
(slot longitude)
)
One can simulate this by adding a slot called id to geographical
location (to denote a unique-id for that location) and using id as
a value for the slot
coordinates, but that does not seem very clean. Is there another/
simpler way?
Best.
Kartha
--------------------------------------------------------------------
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 owner-jess-
[EMAIL PROTECTED]
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
--------------------------------------------------------------------