Title: MultiSlots
If I understand you correctly, this seems to work:
 
(deftemplate test-fact (slot A)(slot B))
(deftemplate test-fact-collection (slot A)(multislot p))
 
(deffacts start
  (test-fact (A a)(B b))
  (test-fact (A a)(B e))
  (test-fact (A h)(B i))
  (test-fact (A h)(B l))
  (test-fact (A o)(B p)))
 
(reset)
 
(defrule create-fact-collection
  ?fact <- (test-fact (A ?a))
  (not (test-fact-collection (A ?a)))
=>
  (printout t "test-fact found A:" ?a crlf)
  (assert (test-fact-collection (A ?a)(p (create$ ?fact))))
)
 
(defrule collect-facts
  ?fact <- (test-fact (A ?a))
  ?coll <- (test-fact-collection (A ?a)(p $?p&:(not (member$ ?fact ?p))))
=>
  (printout t "Adding fact" crlf)
  (modify ?coll (p (create$ ?p ?fact)))
)
 
-Mitch
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Mehta, Chirag (IT)
Sent: Wednesday, August 11, 2004 6:34 AM
To: [EMAIL PROTECTED]
Subject: JESS: MultiSlots

Hi,

I have something I wish to do and I was wondering if it would be better to do it in Java or Jess. My app is a java application with Jess as a library.

If I have a set of facts:

Fact no         Slotname. Value
1.              A. a                    B. b            C.c             D.d
2.              A. a                    B. e            C.f             D.g    
3.              A. h                    B. i            C.j             D.k            
4.              A. h                    B. l            C.m             D.n    
5.              A. o                    B.p             C.q             D.r

Now, what I wish to do is create new facts which would format the above like so:

Fact no.                                Multislot
11.             A.a                     pointer to 1, 2
12.             A.h                     pointer to 3, 4

Is this possible?

What would be an efficient way? I would have to access slots in the facts in the multislots.

Chirag


NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.

Reply via email to