0
我正試圖在Clips編程語言中實現一個基本的專家系統。我有他們各自父母的兒童知識基礎。我想制定一個規則,以便如果兩個孩子有同一個父母,那麼它就會斷言他們是兄弟姐妹。剪輯家庭專家系統
(deftemplate person "family tree"
(slot name)
(slot father)
(slot mother))
(assert
(person
(name "William")
(father "John")
(mother "Megan")))
(assert
(person (name "David")
(father "John")
(mother "Megan")))
(defrule sibling
(person
(name ?name1)
(father ?x)
(mother ?x))
(person
(name ?name2)
(father ?y)
(mother ?y)))
,當我定義規則,我得到一個語法錯誤:
Syntax Error: Check appropriate syntax for defrule.
謝謝你的工作,但我不得不把主要::在我的兄弟標題前。但是現在,當我在'assert'中調用規則時,我總是收到錯誤。我試過語法'(assert MAIN :: sibling(person(name「First_Person」))(person(name「Second_Person」)))''''assert(MAIN :: sibling(person(「David」))(人(「威廉」))))'我也試過沒有主要::任何建議? – cdruckemiller
請編輯你的問題,指定你得到的錯誤。另外編寫deftemplates,事實和規則分隔每個語句與一個新行,這有助於可讀性很多。 – noxdafox
對不起,我不得不接受答案。規則實際上沒有通過。我現在收到語法錯誤。我編輯了問題以顯示我的代碼和錯誤。 – cdruckemiller