I have a course assessment to create a simple Knowledge-Based System in CLIPS. I have created an ontology via Protege, exported the Classes and Instances to a .clp
format and everything loads. I have an idea of what rules and templates to use, but I don't know how to access the pre-generated instances & classes from the files. I don't think it would be appropriate to hardcode them again since I have them ready for use.
Here's a chunk of my Classes
file and Instances
file respectively:
Classes:
; 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))
Instances:
; 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))
The hierarchy goes three levels deep and everything loads, I just don't know how to use the generated data.
P.S. The actual files are far longer and I don't think it would be necessary to post them.