;; -*-Mode: Lisp-*- 
;; $Id: rules.lsp,v 1.2 2001/04/02 20:38:57 moltmans Exp $
;; rules.lsp -- 
;; Author: Michael Oltmans <moltmans@ai.mit.edu> 
;; Created: <Wed Jan 24 18:21:04 2001> 
;; Time-stamp: <2001-01-24 21:23:49 moltmans> 

;; things that need to be asserted:
;;   attachments of constraints
;;   attachments of arrows


; motion causes motion rule
; (rule ((:IN (moves ?b1 ?id1) :VAR ?q1)
;        (:IN (canonical ?id1 ?m1) :VAR ?q2)
;        (:IN (arrow ?a1) :VAR ?q3)
;        (:IN (arrow-referent ?a1 ?b1) :VAR ?q4)
;        (:IN (moves ?b2 ?id2) :TEST (and (not (= ?b1 ?b2))
; 					(check-distance ?a1 ?b2)
; 					(check-direction ?m1 ?m2))
; 	    :VAR ?q5)
;        (:IN (canonical ?id2 ?m2) :TEST (not (= ?m1 ?m2)) :VAR ?q6)
;        (:IN (temporaly-close ?m1 ?m2)) :VAR ?q7)
;       (rassert! (causes ?m1 ?m2)
; 		(:MOTION-CAUSES-MOTION ?q1 ?q2 ?q3 ?q4 ?q5 ?q6 ?q7)))

(rule ((:IN (arrow-referent ?a1 ?b1) :VAR ?q1))
      (assert! `(moves ,?b1 ,(new-event-id)) (:ARROW-GESTURE ?q1)))

(rule ((:IN (body ?b) :VAR ?q1)
       (:IN (moves-sentence ?sent) :TEST (= ?b (get-subject ?sent)) :VAR ?q2))
      (assert! `(moves ,?b ,(new-event-id)) `(:MOVES-UTTERANCE ,?q1 ,?q2)))

; merge equivalent motion events
(rule ((:IN (moves ?b1 ?id1) :VAR ?q1)
       (:IN (moves ?b2 ?id2) :TEST (and (not (= ?id1 ?id2))
					(= ?b1 ?b2)) :VAR ?q2)
       (:IN (temporaly-close ?id1 ?id2)))
      (rassert! (same-event ?id1 ?id2) (:MERGE-MOTIONS ?q1 ?q2)))



      
      
      