Below are two rules used to record the occurrence of sequences 4 and 5 as they appear in data sets: facts which are removed and added in groups as appropriate to needs. (The system is not yet working, but is tantalizingly close - as is 2007.)
As it happens, tidy5 fires in the first data set and tidy4 fires after it in the second. ;;;;;;;;;;;;;;;;;;;;;;;;; (defrule tidy4 (declare (salience -25)) (frame (frameNumber ?framenumber)) ?done <- (finishPat (patternID 4)(patComplete yes)) ?previous1 <- (patPos (parentPattern 4)(position 1)(memberID ?m1)(tool_classificationID ?t1)) ?previous2 <- (patPos (parentPattern 4)(position 2)(memberID ?m2)(tool_classificationID ?t2)) => (bind ?pat (assert (patInstance (factID nil)(patternID 4)))) (bind ?fid (?pat getFactId))(modify ?pat (factID ?fid)) (retract ?previous1 ?previous2) (retract ?done) (printout t "tidy pattern 4 match " crlf)) (defrule tidy5 (declare (salience -25)) (frame (frameNumber ?framenumber)) ?done <- (finishPat (patternID 5)(patComplete yes)) ?previous1 <- (patPos (parentPattern 5)(position 1)(memberID ?m1)(tool_classificationID ?t1)) ?previous2 <- (patPos (parentPattern 5)(position 2)(memberID ?m2)(tool_classificationID ?t2)) => (bind ?pat (assert (patInstance (factID nil)(patternID 5)))) (bind ?fid (?pat getFactId)) (modify ?pat (factID ?fid)) (retract ?previous1 ?previous2) (retract ?done) (printout t "tidy pattern 5 match " crlf)) FIRE 48 MAIN::tidy5 f-75, f-131, f-127, f-129 ==> f-134 (MAIN::patInstance (factID nil) (patternID 5)) ==> Activation: MAIN::pattern_11_1 : f-75, f-134, f-67 <== Activation: MAIN::pattern_11_1 : f-75, f-134, f-67 <=> f-134 (MAIN::patInstance (factID 134) (patternID 5)) ==> Activation: MAIN::pattern_11_1 : f-75, f-134, f-67 <== f-127 (MAIN::patPos (tool_classificationID 556) (memberID 30) (parentPattern 5) (position 1) (frame 1)) <== f-129 (MAIN::patPos (tool_classificationID 2162) (memberID 33) (parentPattern 5) (position 2) (frame 1)) <== f-131 (MAIN::finishPat (patternID 5) (patComplete yes)) tidy pattern 5 match ;;----------------- [old data has been removed and new data added, with considerable activation and firing ]---------------------------- FIRE 49 MAIN::tidy4 f-137, f-198, f-132, f-196 ==> f-200 (MAIN::patInstance (factID nil) (patternID 4)) An error occurred at line 1which looks like( run ) Message: '134' is an integer, not a Java object java.lang.NullPointerException ;;;;;;;;;;;;;;;;;;;; What appears to be happening is that the old (patInstance (factID nil)(patternID 5)) which was asserted is still in existence.... as ?pat with a value of 134 and when I try to assert it a second time I am asserting an int rather than the object representing the variable (is it a ValueVector??) Is this so ? If not, what can you tell me ? In either case, any suggested solutions? Rob Robert Kildare PhD candidate School of Computing University of Tasmania -------------------------------------------------------------------- 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] --------------------------------------------------------------------
