I treat facts like I would rows in a relational database, with templates as tables, and slots acting as keys to other facts. So, a slot, or combination of slots, contain the key which identifies the fact in question. The question, then is how far you normalize your domain.

For me, this makes things very, very simple and quite natural - but then, I work for a relational database vendor so perhaps we're just wired that way...

On Sep 29, 2008, at 3:19 PM, levent kent wrote:

Hmm, thanks.It was very explanatory that Jess does not work like prolog.
So, now I would ask what do Jess-people do, when they have to define
nodes with 2 coordinates or an employee with id,name,surname,wage?

It would be very confusing to flatten all the data. I guess there should be a way to do it. Should we use java classes for that purpose or are there different ways to do it?

Thanks for all replies, all were very understandable for me :)

On Mon, Sep 29, 2008 at 9:14 PM, Gary Hallmark <[EMAIL PROTECTED] > wrote: Jess and most other production rule languages do not have Herbrand terms that prolog-like languages use to model tree-structured facts. In your case you can simply flatten your data model to a single fact with 2 x and 2 y coordinates, as Hal suggests. In more complex cases you may want to assert several linked facts -- but your rules may need several patterns and tests to put th pieces back together again.


Levent Kent wrote:
Hi,

I am a new user fo Jess and try to get some understanding for the engine.
I cant understand why the code below does not work.

(deffacts graph-links3
   (link3 (gnode3 0 0) (gnode3 2 1))
   )

Here, I am trying to describe links of nodes with 2 coordinates.
How should I do that?

I also tried this version:
(deftemplate gnode (slot x) (slot y))
(deftemplate link (slot start) (slot end))

(deffacts graph-links
   (link (start (gnode (x 0) (y 0))) (end (gnode (x 2) (y 1))))
   (link (start (gnode (x 2) (y 1))) (end (gnode (x 1) (y 2))))
  (link (start (gnode (x 2) (y 1))) (end (gnode (x 2) (y 0))))
   (link (start (gnode (x 2) (y 0))) (end (gnode (x 1) (y 1))))
   (link (start (gnode (x 1) (y 1))) (end (gnode (x 0) (y 2))))
  (link (start (gnode (x 0) (y 2))) (end (gnode (x 2) (y 3))))
  (link (start (gnode (x 1) (y 2))) (end (gnode (x 1) (y 3))))
   )

I am always geetıng the error message:
Jess reported an error in routine Funcall.execute
   while executing (gnode3 0 0)
   while executing assert from deffacts MAIN::graph-links3
   while executing (reset).
 Message: Undefined function gnode3.

or

Jess reported an error in routine Funcall.execute
   while executing (gnode (x 0) (y 0))
   while executing assert from deffacts MAIN::graph-links
   while executing (reset).
 Message: Undefined function gnode.

Some little help would save me from confusion.

I hope this message will be accepted by the mailing list, because I am not
sure if my messages are delivered successfully.

Thanks,

Levent



--------------------------------------------------------------------
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] .
--------------------------------------------------------------------




--
Levent Kent

Reply via email to