This is a frequently-requested feature, but I'm sorry, it just doesn't
work this way, at least not right now. You can store the Person's name
in the slot, of course, but there's no way to link a slot to another
deftemplate. Deftempates are not a good data-structure representation
language.
Because of the way the Rete algorithm works, facts are transient
things. Whenever any of the values of a specific Person's slots
changes, the fact representing that Person is retracted and a new one
asserted. If Jess somehow allowed the kind of linking you're
interested in (and believe me, lots of other people are interested as
well) what would then happen to the Organization fact? Somehow it
would need to be updated. How would Jess know to update it? It would
have to keep a table listing every fact that referred to another
fact. Keeping this table updated could be a significant computational
burden.
There are some other issues as well: when the Organization fact is
updated, it will have to be retracted and reasserted too (this is how
the Rete algorithm works, remember. ) A Person might sensibly want to
refer to its own Organization fact as well - but now we've got an
infinte loop.
Now, one thing you can do in an actual system is use Java Beans and
defclasses instead of Deftemplates. Then the 'employs' slot could
directly hold a reference to a Person Bean, which would not change
when the Person's slots changed. If the goal is, however, just to
define the ontology, then this doesn't help.
I think Maren Zubizarreta wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I_m definning an ontology using Jess, and I don_t know how to express
> complex slots:
> Example:
>
> (deftemplate Person
> (slot name (type STRING)))
>
> (deftemplate Organization
> (slot name (type STRING))
> (slot location(type STRING))
> (slot employs --->Person )
>
> I want the slot "employs" being of type "Person",and so when setting
> a fact for Organization I want to set the slot "employs" to a Person's
> "name".
>
> Does anybody knows if it's possible to make such structures in Jess?
> Thank you very much in advance for your help.
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------