;; $Id: match.clp,v 1.12 2002/09/06 05:09:49 mdean Exp $ (defrule symmetry (match ?a ?b) (not (match ?b ?a)) => (assert (match ?b ?a))) ;; airfare, car, hotel, some parking (defrule trip-amex ;; XXX? - (type ?expense parking hotel) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?expense file:trip.daml#file:/daml/expenses/trip-ont.daml#Expense) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?amex file:amex.daml#file:/daml/expenses/amex-ont.daml#Transaction) (file:/daml/expenses/trip-ont.daml#amount ?expense ?amount) (file:/daml/expenses/amex-ont.daml#amount ?amex ?amount) ; XXX - sign (file:/daml/expenses/trip-ont.daml#date ?expense ?date1) (file:/daml/expenses/amex-ont.daml#date ?amex ?date2) (test (ISODateCompare ?date1 ?date2 30)) (not (match ?amex ?)) (not (match ?expense ?)) => (printout t "trip-amex " ?amount " " ?date1 " " ?date2 crlf) ; XXX (assert (match ?expense ?amex))) ;; telephone, Internet, cell phone (defrule eecr-check (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?eecr file:eecr.daml#file:/daml/expenses/eecr-ont.daml#Item) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?check file:check.daml#file:/daml/expenses/check-ont.daml#Transaction) (file:/daml/expenses/eecr-ont.daml#amount ?eecr ?amount) (file:/daml/expenses/check-ont.daml#amount ?check ?amount) (file:/daml/expenses/eecr-ont.daml#date ?eecr ?date1) (file:/daml/expenses/check-ont.daml#date ?check ?date2) (test (ISODateCompare ?date1 ?date2 30)) (not (match ?eecr ?)) (not (match ?check ?)) => (printout t "eecr-check " ?amount " " ?date1 " " ?date2 crlf) ; XXX (assert (match ?eecr ?check))) ;; DirecPC (defrule eecr-amex (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?eecr file:eecr.daml#file:/daml/expenses/eecr-ont.daml#Item) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?amex file:amex.daml#file:/daml/expenses/amex-ont.daml#Transaction) (file:/daml/expenses/eecr-ont.daml#amount ?eecr ?amount) (file:/daml/expenses/amex-ont.daml#amount ?amex ?amount) (file:/daml/expenses/eecr-ont.daml#date ?eecr ?date1) (file:/daml/expenses/amex-ont.daml#date ?amex ?date2) (test (ISODateCompare ?date1 ?date2 15)) (not (match ?eecr ?)) (not (match ?amex ?)) => (printout t "eecr-amex " ?amount " " ?date1 " " ?date2 crlf) ; XXX (assert (match ?eecr ?amex))) (defrule eecr-payment (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?expense file:eecr.daml#file:/daml/expenses/eecr-ont.daml#EmployeeExpenseForm) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?checking file:check.daml#file:/daml/expenses/check-ont.daml#Transaction) (file:/daml/expenses/eecr-ont.daml#total ?expense ?total) (file:/daml/expenses/check-ont.daml#amount ?checking ?total) (file:/daml/expenses/eecr-ont.daml#submissionDate ?expense ?date1) (file:/daml/expenses/check-ont.daml#date ?checking ?date2) (test (ISODateCompare ?date1 ?date2 90)) (not (match ?expense ?)) (not (match ?checking ?)) => (printout t "eecr-payment " ?total " " ?date1 crlf) ; XXX (assert (match ?expense ?checking))) (defrule trip-payment (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?trip file:trip.daml#file:/daml/expenses/trip-ont.daml#Trip) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?checking file:check.daml#file:/daml/expenses/check-ont.daml#Transaction) (file:/daml/expenses/trip-ont.daml#total ?trip ?total) (file:/daml/expenses/check-ont.daml#amount ?checking ?total) (file:/daml/expenses/trip-ont.daml#end ?trip ?date1) (file:/daml/expenses/check-ont.daml#date ?checking ?date2) (test (ISODateCompare ?date1 ?date2 90)) (not (match ?trip ?)) (not (match ?checking ?)) => (printout t "trip-payment " ?total " " ?date1 " " ?date2 crlf) ; XXX (assert (match ?trip ?checking))) ;; Payment Received - Thank You (defrule amex-payment (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?amex file:amex.daml#file:/daml/expenses/amex-ont.daml#Transaction) (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?checking file:check.daml#file:/daml/expenses/check-ont.daml#Transaction) (file:/daml/expenses/amex-ont.daml#amount ?amex ?total) (file:/daml/expenses/check-ont.daml#amount ?checking ?total) (file:/daml/expenses/amex-ont.daml#date ?amex ?date1) (file:/daml/expenses/check-ont.daml#date ?checking ?date2) (test (ISODateCompare ?date1 ?date2 30)) (not (match ?amex ?)) (not (match ?checking ?)) => (printout t "amex-payment " ?total " " ?date1 " " ?date2 crlf) ; XXX (assert (match ?amex ?checking)))