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

Reply via email to