我试图通过以下 JessTab 规则找到家庭本体中断言的人的平均年龄:
(defrule print_people_total_age
(object (https://wiki.csc.calpoly.edu/OntologyTutorial/family_example.owl#age ?a1))
=>
(bind ?s 0)
(bind ?num 0)
(foreach ?a (create$ ?a1) (+ ?s ?a) (++ ?num) (printout t "Total age " ?s " and average age is " (/ ?s ?num) " of persons" crlf)))
该规则编译得很好,但是当激活错误时:
Jess reported an error in routine +
while executing (+ ?s ?a)
while executing (foreach ?a (create$ ?a1) (+ ?s ?a) (++ ?num) (printout t "Total age " ?s " and average age is " (/ ?s ?num) " of persons" crlf))
while executing defrule MAIN::print_people_total_ageSSS
while executing (run).
Message: Not a number: "~@http://www.w3.org/2001/XMLSchema#integer 20".
我哪里错了?