我有一个课程评估,用于在CLIPS中创建一个简单的基于知识的系统。我已经通过Protege创建了一个本体,将类和实例导出为.clp
格式并且所有内容都加载了。我知道要使用哪些规则和模板,但我不知道如何访问预先生成的实例&来自文件的类。我不认为再次对它们进行硬编码是合适的,因为我已准备好使用它们了。
这里分别是我的Classes
文件和Instances
文件的一大块:
类:
; Tue Feb 03 14:37:58 EET 2015
;
;+ (version "3.5")
;+ (build "Build 663")
(defclass %3ACLIPS_TOP_LEVEL_SLOT_CLASS "Fake class to save top-level slot information"
(is-a USER)
(role abstract)
(single-slot title
(type STRING)
;+ (cardinality 1 1)
(create-accessor read-write))
(single-slot purchased_by
(type INSTANCE)
;+ (allowed-classes Customer)
;+ (cardinality 0 1)
(create-accessor read-write))
(multislot number_of_pages
(type INTEGER)
(range 0 3000)
(create-accessor read-write))
(single-slot type
(type SYMBOL)
(allowed-values Fiction Non-Fiction)
;+ (cardinality 0 1)
(create-accessor read-write))
(single-slot filmed
(type SYMBOL)
(allowed-values Yes No)
;+ (cardinality 0 1)
(create-accessor read-write))
(single-slot name_
(type STRING)
;+ (cardinality 1 1)
(create-accessor read-write))
(single-slot publishing_year
(type INTEGER)
(range 1440 2015)
;+ (cardinality 0 1)
(create-accessor read-write))
实例:
; Tue Feb 03 14:37:58 EET 2015
;
;+ (version "3.5")
;+ (build "Build 663")
(definstances myInstances
([Bookstore_Class0] of Horror
(author "Stephen King")
(filmed Yes)
(number_of_pages 497)
(publishing_year 1977)
(title "The Shining")
(type Fiction))
([Bookstore_Class10000] of Drama
(author "Vladimir Nabokov")
(filmed Yes)
(number_of_pages 300)
(publishing_year 1955)
(title "Lolita")
(type Fiction))
([Bookstore_Class10001] of Drama
(author "Gabriel Garcia Marquez")
(filmed No)
(number_of_pages 432)
(publishing_year 1970)
(title "One Hundred Years of Solitude")
(type Fiction))
([Bookstore_Class10002] of Horror
(author "Stephen King")
(filmed No)
(number_of_pages 531)
(publishing_year 2013)
(title "Doctor Sleep")
(type Fiction))
层次结构深入三层,一切都加载,我只是不知道如何使用生成的数据。
P.S。实际文件要长得多,我认为没有必要发布它们。