"Maren Zubizarreta" <[EMAIL PROTECTED]> wrote:
0,0,057L;115L;172L;230L;288L;345L;403L;460L;518L;576L;633L;691L;748L;806L;863L;921L;979L;1036L;1094L;1151L> I�m definning an ontology using Jess, and I don�t know how to express
0,0,028L;56L;84L;112L;140L;168L;196L;224L;252L;280L;308L;336L> 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.

The usual approach is to think of deftemplates as defining a relational
schema, as in a relational database. I'm not a JESS user (yet) primarily
because I dislike Java as a programming language. I use an ObjectiveC
bridge to CLIPS that works a lot like JESS does wrt introspecting
objects and asserting them as facts. (If/When we ever move to Java -
we'd switch our rule logic to Jess).

Anyhow, it helps to think like a relational database designer.
Using objects, your template might look something like:
0,0,057L;115L;172L;230L;288L;345L;403L;460L;518L;576L;633L;691L;748L;806L;863L;921L;979L;1036L;1094L;1151L

(deftemplate Person
(field self)
(field name)
(field organization)) ; relates to an Organization

(deftemplate Organization
(field self)
(field name)
(field location))

0,0,057L;115L;172L;230L;288L;345L;403L;460L;518L;576L;633L;691L;748L;806L;863L;921L;979L;1036L;1094L;1151LYou then write rules that look like relational database queries.
For instance, to get a Person's Organization you might do something like....
0,0,057L;115L;172L;230L;288L;345L;403L;460L;518L;576L;633L;691L;748L;806L;863L;921L;979L;1036L;1094L;1151L
(defrule person-organization
(Person (organization ?org) ....)
(Organization (self ?org) .....)
=>
...)

It sounds like JESS has a way to store a Java object reference in a field,
which does roughly the same thing as the self field I put into every object.

Hope this helps.
0,0,028L;56L;84L;112L;140L;168L;196L;224L;252L;280L;308L;336L
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
eTranslate, Inc. The Power of Language
Todd Blanchard main +1.415.970.7119
Chief Technology Architect fax +1.415.371.0008
http://www.etranslate.com/
500 Treat Street, Suite 100, San Francisco, California 94110, U.S.A.

Reply via email to