📄 nematode.clp
字号:
(retract ?f1 ?f2)
(assert (nematode Meloidodera))
(assert (id-criteria "1. esophagus three-part, metacorpus small."
"2. female-body pear-shape, soft."
"3. vulva-position middle of body."))
)
(defrule esophagus-glands-intestine-1
?f1 <- (female-body-shape cylindrical)
(not (esophagus-glands ?any))
=>
(retract ?f1)
(printout t "Where are the esophagus glands ?" crlf
"1. enclosed in basal bulb " crlf
"2. overlapping anterior end of interior." crlf )
(assert (esophagus-glands =(read)))
)
(defrule esophagus-glands-intestine-2
?eso <- (esophagus-glands 1)
=>
(retract ?eso)
(assert (esophagus-glands enclosed-in-basal-bulb))
)
(defrule esophagus-glands-intestine-3
?eso <- (esophagus-glands 2)
=>
(retract ?eso)
(assert (esophagus-glands overlaps-intestine))
)
(defrule tail-shape-ovary
(esophagus-glands enclosed-in-basal-bulb)
(not (tail-shape ?any))
=>
(printout t "Is the female tail blunt, rounded amd has two ovaries : "
" (yes /no)" crlf)
(assert (tail-round ovary-two =(read)))
)
(defrule tail-ovary-2
?tail <- (tail-round ovary-two yes)
=>
(retract ?tail)
(assert (tail-shape blunt-round yes))
(assert (two-ovary yes))
)
(defrule tail-ovary-3
?tail <- (tail-round ovary-two no)
=>
(retract ?tail)
(assert (tail-shape blunt-round no))
(assert (two-ovary no))
)
(defrule Tylenchorhynchus
?f1 <- (esophagus-glands enclosed-in-basal-bulb)
?f2 <- (tail-shape blunt-round yes)
?f3 <- (two-ovary yes)
=>
(retract ?f1 ?f2 ?f3)
(assert (nematode Tylenchorhynchus))
(assert (id-criteria "1. esophagus 3-part, metacorpus < 3/4 body width, glands enclosed in
basal-bulb."
"2. tail-shape blunt, rounded."
"3. ovary two."))
)
(defrule Ditylenchus-Paratylenchus
(esophagus-glands enclosed-in-basal-bulb)
(tail-shape blunt-round no)
(two-ovary no)
(not (stylet-long ?any))
=>
(printout t "Is the stylet long (15 micron - 36 u) : (yes / no) ?" crlf)
(assert (stylet-long =(read)))
)
(defrule Ditylenchus
?f1 <- (esophagus-glands enclosed-in-basal-bulb)
?f2 <- (tail-shape blunt-round no)
?f3 <- (two-ovary no)
?f4 <- (stylet-long no)
=>
(retract ?f1 ?f2 ?f3 ?f4)
(assert (nematode Ditylenchus))
(assert (id-criteria "1. esophagus 3-part, glands enclosed in basal-bulb."
"2. tail-shape conoid with mucro."
"3. ovary one, outstretched"))
)
(defrule check_Paratylenchus
(esophagus-glands enclosed-in-basal-bulb)
(tail-shape blunt-round no)
(two-ovary no)
(stylet-long yes)
(not (body-length-small ?any))
=>
(printout t "Is the size of the nematode < 0.5 mm : (yes /no) ?" crlf)
(assert (body-length-small =(read)))
)
(defrule Paratylenchus
?f1 <- (esophagus-glands enclosed-in-basal-bulb)
?f2 <- (tail-shape blunt-round no)
?f3 <- (two-ovary no)
?f4 <- (stylet-long yes)
?f5 <- (body-length-small yes)
=>
(retract ?f1 ?f2 ?f3 ?f4 ?f5)
(assert (nematode Paratylenchus))
(assert (id-criteria "1. esophagus three-part, metacorpus < 3/4 body width
stylet 15 - 36 micron."
"2. tail-shape tapering, round at end."
"3. ovary one, body length < 0.5 mm"))
)
(defrule specimen-spiral
(esophagus-glands overlaps-intestine)
(not (specimen-spiral ?any))
=>
(printout t "Is the specimen lying in a spiral : (yes /no) ?" crlf)
(assert (specimen-spiral =(read)))
)
(defrule Helicotylenchus
?f1 <- (esophagus-glands overlaps-intestine)
?f2 <- (specimen-spiral yes)
=>
(retract ?f1 ?f2)
(assert (nematode Helicotylenchus))
(assert (id-criteria "1. esophagus three-part, metacorpus < 3/4 body width."
"2. esophagus glands overlaps intestine."
"3. specimen lying in a spiral."))
)
(defrule direction-overlaps
?f1 <- (esophagus-glands overlaps-intestine)
?f2 <- (specimen-spiral no)
(not (esophagus-glands-overlap-intestine ?any))
=>
(retract ?f1 ?f2)
(printout t "Where is the overlap ? (dorsally /ventrally) ? " crlf)
(assert (esophagus-glands-overlap-intestine =(read)))
)
(defrule Radopholus-Hoplolaimus
(esophagus-glands-overlap-intestine dorsally)
(not (female-head ?any))
=>
(printout t "Is the female head :" crlf
"1. low, rounded or flatted " crlf
"2. offset, caplike, divided into minute blocks by " crlf
" longitudinal and lateral striations." crlf
" 1 or 2 ?" crlf)
(assert (female-head =(read)))
)
(defrule head-shape-1
?head <- (female-head 1)
=>
(retract ?head)
(assert (female-head flat))
)
(defrule head-shape-2
?head <- (female-head 2)
=>
(retract ?head)
(assert (female-head box-grid))
)
(defrule check_Radopholus-1
(female-head flat)
(esophagus-glands-overlap-intestine dorsally)
=>
(printout t "How many ovaries : 2 or 1 ?" crlf)
(assert (ovary =(read)))
)
(defrule check_Radopholus-2
?f1 <- (female-head flat)
?f2 <- (esophagus-glands-overlap-intestine dorsally)
?f3 <- (ovary 2)
=>
(retract ?f1 ?f2 ?f3)
(assert (nematode Radopholus))
(assert (id-criteria "1. esophagus three-part, metacorpus < 3/4 body width
glands overlaps intestine dorsally."
"2. female-head low, rounded or flat."
"3. ovary two."))
)
(defrule not-included-1
?f1 <- (female-head flat)
?f2 <- (esophagus-glands-overlap-intestine dorsally)
?f3 <- (ovary 1)
=>
(retract ?f1 ?f2 ?f3)
(assert (nematode "not included"))
(assert (id-criteria "1. esophagus three-part,glands overlaps intestine dorsally."
"2. female-head low, rounded or flat."
"3. ovary 1."))
)
(defrule Tylenchulus-Rotylenchulus
(female-body-shape elongate-saccate-or-kidney-shape-with-tail)
(not (ovary ?any))
=>
(printout t "How many overies ? 1 or 2 ? " crlf)
(assert (ovary =(read)))
)
(defrule Tylenchulus
?f1 <- (female-body-shape elongate-saccate-or-kidney-shape-with-tail)
?f2 <- (ovary 1)
=>
(retract ?f1 ?f2)
(assert (nematode Tylenchulus))
(assert (id-criteria "1. esophagus three-part, metacorpus < 3/4 body width."
"2. female-body-shape kidney-shape with tail."
"3. ovary one."))
)
(defrule Rotylenchulus
?f1 <- (female-body-shape elongate-saccate-or-kidney-shape-with-tail)
?f2 <- (ovary 2)
=>
(retract ?f1 ?f2)
(assert (nematode Rotylenchulus))
(assert (id-criteria "1. esophagus three-part, metacorpus < 3/4 body width."
"2. female-body elongate-saccate with tail."
"3. ovary two."))
)
(defrule Pratylenchus_Hirshmanniella
(esophagus-glands-overlap-intestine ventrally)
(not (ovary ?any))
=>
(printout t "How many ovaries : 1 or 2 ? " crlf)
(assert (ovary =(read)))
)
(defrule Pratylenchus
?f1 <- (esophagus-glands-overlap-intestine ventrally)
?f2 <- (ovary 1)
=>
(retract ?f1 ?f2)
(assert (nematode Pratylenchus))
(assert (id-criteria "1. esophagus glands overlap intestine ventrally."
"2. ovary 1."
"3. head-shape low and flat."))
)
(defrule Hirshmanniella
?f1 <- (esophagus-glands-overlap-intestine ventrally)
?f2 <- (ovary 2)
=>
(retract ?f1 ?f2)
(assert (nematode Hirshmanniella))
(assert (id-criteria "1. esophagus glands overlap intestine ventrally."
"2. ovary 2."
"3. head-shape low and flat."))
)
(defrule check-Hoplolaiamus_1
(esophagus-glands-overlap-intestine dorsally)
(female-head box-grid)
(not (spear-knob-with-projections ?any))
=>
(printout t "Does its spear have knobs with prominent anterior projections ?"
" (yes /no )" crlf)
(assert (spear-knob-with-projections =(read)))
)
(defrule not-included-2
?f1 <- (esophagus-glands-overlap-intestine dorsally)
?f2 <- (female-head box-grid)
?f3 <- (spear-knob-with-projections no)
=>
(retract ?f1 ?f2 ?f3)
(assert (nematode "not included"))
(assert (id-criteria "1.esophagus 3-part."
"2. esophagus glands overlap intestine dorsally."
"3. spear knob without anterior projections."))
)
(defrule Hoplolaimus
?f1 <- (esophagus-glands-overlap-intestine dorsally)
?f2 <- (female-head box-grid)
?f3 <- (spear-knob-with-projections yes)
=>
(retract ?f1 ?f2 ?f3)
(assert (nematode Hoplolaimus))
(assert (id-criteria "1. esophagus glands overlap intestine dorsally."
"2. female-head offset, caplike, divided into blocks
by striations."
"3. spear knobs with anterior projections."))
)
;;;
;;; Phase control rules
;;;
(defrule print-nematode
(declare (salience -20))
?nema <- (nematode ?genus)
=>
(retract ?nema)
(assert (nema ?genus))
(printout t "Identification : ")
(printout t "Genus " ?genus crlf crlf)
)
(defrule print-characteristics
(declare (salience -30))
?id <- (id-criteria ?fact1 ?fact2 ?fact3)
=>
(retract ?id)
(printout t "Characteristics: " ?fact1 crlf
" " ?fact2 crlf
" " ?fact3 crlf crlf
"continue id : (yes/no) ?" crlf)
(assert (find-another =(read)))
)
(defrule print-db-query
?f1 <- (find-another no)
(nema ?genus)
=>
(retract ?f1)
(printout t "Print out nematode identified so far : (yes/no) ?" crlf)
(assert (print =(read)))
)
(defrule print-final-db-yes
(declare (salience 10))
?print <- (print yes)
?nema <- (nema ?genus)
=>
(retract ?nema)
(assert (nema-id ?genus))
(printout t " Genus " ?genus crlf)
)
(defrule print-final-db-no
(declare (salience 10))
?print <- (print no)
?nema <- (nema ?genus)
=>
(retract ?nema)
(assert (nema-id ?genus))
)
(defrule query-modification
?f1 <- (print ?any)
(nema-id ?genus)
=>
(retract ?f1)
(printout t "Is there any data manipulation you want to do : "
"(add/delete/search/no) ?" crlf)
(assert (add-delete-search =(read)))
)
(defrule add-to-list
?f1 <- (add-delete-search add)
=>
(retract ?f1)
(printout t "Which nematode -- input genus name ? " crlf)
(bind ?nema (read))
(assert (nema-id ?nema))
(printout t "Genus " ?nema " is added to the list." crlf
"More to modify -- (add/delete/search/no) ? " crlf)
(assert (add-delete-search =(read)))
)
(defrule delete-from-list-1
?f1 <- (add-delete-search delete)
=>
(retract ?f1)
(printout t "Which nematode -- input genus name ? " crlf)
(assert (delete =(read)))
)
(defrule delete-from-list-2
?f1 <- (delete ?nema)
?f2 <- (nema-id ?nematode)
(test (eq ?nema ?nematode))
=>
(retract ?f1 ?f2)
(printout t "Genus " ?nematode " is deleted from the list." crlf
"More to modify -- (add/delete/search/no) ? " crlf)
(assert (add-delete-search =(read)))
)
(defrule search-database
?f1 <- (add-delete-search search)
=>
(retract ?f1)
(printout t "which nematode : input genus name ?" crlf)
(assert (search =(read)))
)
(defrule data-found
(declare (salience 10))
?search <- (search ?nema)
(nema-id ?nematode)
(test (eq ?nema ?nematode))
=>
(printout t "Genus " ?nema " is in the identified list." crlf)
(retract ?search)
(printout t "More to modify -- (add/delete/search/no) ? " crlf)
(assert (add-delete-search =(read)))
)
(defrule data-not-found
?search <- (search ?nema)
=>
(printout t "Genus " ?nema " is not found in the identified list." crlf)
(retract ?search)
(printout t "More to modify -- (add/delete/search/no) ? " crlf)
(assert (add-delete-search =(read)))
)
(defrule print-list-again-query
?f1 <- (add-delete-search no)
=>
(retract ?f1)
(printout t "Print final list : (yes/no) ?" crlf)
(assert (print-again =(read)))
)
(defrule print-final-list
(declare (salience 10))
(print-again yes)
?nema <- (nema-id ?genus)
=>
(retract ?nema)
(assert (nemaid ?genus))
(printout t " Genus " ?genus crlf)
)
;(defrule exit-program
;(declare (salience -100))
;($?)
; =>
; (printout t "Bye !" crlf)
; )
(deffacts genus-included
(genus Aphlenchoides)
(genus Aphelenchus)
(genus Criconemoides)
(genus Criconema)
(genus Ditylenchus)
(genus Helicotylenchus)
(genus Hemicriconemoides)
(genus Heterodera)
(genus Hirschmanniella)
(genus Longidorus)
(genus Meloidogyne)
(genus Meloidodera)
(genus Paratylenchus)
(genus Pratylenchus)
(genus Radopholus)
(genus Rotylenchulus)
(genus Trichodorus)
(genus Tylenchorhynchus)
(genus Tylenchulus)
(genus Xiphinema)
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -