Re: JESS: How to use templates inside facts

2008-09-30 Thread Gary Hallmark
Production rules typically use "slotted terms" which in Jess must be declared using deftemplate (or you can use a java bean) then you can assert such facts using (assert (link (x1 ?value-of-x1) (y1 ?value-of-y1) (x2 ?value-of-x1) (y2 ?value-of-y2)) and similarly for use as a pattern in a rul

Re: JESS: How to use templates inside facts

2008-09-30 Thread Wolfgang Laun
The decision between using a "hard" (fact) reference and a key has arguments for either side. I'm not going to try to list them all ;-) - Hard references are readily available, but building structures is more complicated. - If you don't have a primary key, you'll have to invent an artificial one.

Re: JESS: How to use templates inside facts

2008-09-29 Thread Hal Hildebrand
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

Re: JESS: How to use templates inside facts

2008-09-29 Thread levent kent
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 i

Re: JESS: How to use templates inside facts

2008-09-29 Thread Gary Hallmark
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 asser

RE: JESS: How to use templates inside facts

2008-09-29 Thread Wolfgang Laun
ke these: (bind ?n_1_1 (assert (gnode (x 1)(y 1 (bind ?n_2_2 (assert (gnode (x 2)(y 2 (bind ?l_1_1_2_2 (assert (link (start ?n_1_1)(end ?n_2_2 HTH -W -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Levent Kent Sent: Sonntag, 28. September 2008 22

Re: JESS: How to use templates inside facts

2008-09-29 Thread Ernest Friedman-Hill
On Sep 28, 2008, at 4:57 PM, 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. Well, the short answer is that the syntax is bad. If the Jess parser sees a pair of parentheses, it will as

Re: JESS: How to use templates inside facts

2008-09-29 Thread Hal Hildebrand
You'll have to use something like: (deftemplate link (slot x1) (slot y1) (slot x2) (slot y2) ) On Sep 28, 2008, at 1:57 PM, 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. (d

JESS: How to use templates inside facts

2008-09-28 Thread Levent Kent
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 tr