CLIPS Common Object Language COOL - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

CLIPS Common Object Language COOL

Description:

(defclass RHOMBUS (is-a PARALLELOGRAM KITE)) (defclass SQUARE (is-a RHOMBUS RECTANGLE)) 7. COOL Built-in Classes. OBJECT. USER. INITIAL-OBJECT. PRIMITIVE ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 15
Provided by: bobm8
Category:

less

Transcript and Presenter's Notes

Title: CLIPS Common Object Language COOL


1
CLIPS Common Object LanguageCOOL
  • Bob McKay
  • School of Computer Science and Engineering
  • College of Engineering
  • Seoul National University

2
Course Review
  • Knowledge Representation and Reasoning 9852
  • http//web.cse.snu.ac.kr/survey/

3
Outline
  • Higher Order Logics
  • Ontologies
  • Actions
  • Representing Belief, Knowledge,

4
CLIPS Object-Oriented Language (COOL)
  • A powerful object-oriented language
  • Built on top of the basic production-rule system
  • Relationship between COOL and CLIPS is similar to
    that between C and C

5
COOL Class Definitions
  • (defclass ltclassgt
  • (is-a ltdirect superclassesgt)
  • (role ltconcrete abstractgt)
  • (slot ltslot-namegt (ltslot facetsgt)
  • (default ltdefaultgt)))
  • Notes
  • There is only one inheritance relation (is-a)
  • Multiple inheritance is permitted

6
COOL Class Examples
  • (defclass QUADRILATERAL
  • (is-a Object))
  • (defclass KITE
  • (is-a QUADRILATERAL))
  • (defclass TRAPEZOID
  • (is-a QUADRILATERAL))
  • (defclass PARALLELOGRAM
  • (is-a TRAPEZOID))
  • (defclass ISOSCELES-TRAPEZOID
  • (is-a TRAPEZOID))
  • (defclass RECTANGLE
  • (is-a PARALLELOGRAM ISOSCELES-TRAPEZOID))
  • (defclass RHOMBUS
  • (is-a PARALLELOGRAM KITE))
  • (defclass SQUARE
  • (is-a RHOMBUS RECTANGLE))

7
COOL Built-in Classes
  • OBJECT
  • USER
  • INITIAL-OBJECT
  • PRIMITIVE
  • NUMBER
  • INTEGER
  • FLOAT
  • INSTANCE
  • INSTANCE-NAME
  • INSTANCE-ADDRESS
  • ADDRESS
  • FACT-ADDRESS
  • MULTIFIELD
  • LEXEME
  • SYMBOL
  • STRING

8
COOL Class Instances
  • Creation
  • An instance of a class is created with
    make-instance
  • (make-instance ltinstance-namegt of ltclassgt
    ltslot-overridegt)
  • (make-instance Dorky of DUCK (sound quack))
  • Deletion
  • (reset)
  • (unmake-instance ltinstance namegt)
  • send instance a delete message

9
COOL Slots
  • Slots are created along with classes
  • Their values are set
  • either at the time of creation of an instance
  • or at a later stage by the sending of a message
  • Except that values of slots with shared facet
    are shared by all instances of the class
  • Like static fields

10
COOL Slots
  • Facets
  • Facets are aspects of a slot, which determine the
    values it may have
  • Defaults
  • Defaults may be either
  • Static
  • the default is evaluated at the time the class is
    created
  • Dynamic
  • the default is evaluated each time an instance is
    created

11
COOL Slots
  • Cardinality
  • Cardinality may be
  • multiple - the facet can hold multiple values
  • Messages
  • Format
  • (send ltinstance namegt ltmessagegt)
  • (send Dorky delete)
  • (send Dorky (put-sound quack))
  • Correspond to method calls in Java

12
COOL Handlers
  • Handlers are the means by which objects respond
    to messages
  • Correspond to Java methods
  • (defmessage-handler
  • ltclassgt
  • ltmessagegt handler-type
  • (ltparametersgt)
  • (ltactionsgt))
  • (defmessage-handler NUMBER (?arg)
  • ( ?self ?arg))

13
COOL Handler Classes
  • around
  • set up environment for other handler
  • (executes partly before and partly after other
    handlers
  • Before
  • auxiliary work before primary
  • Primary
  • The main handler
  • After
  • clean-up work after primary

14
COOL Daemons
  • In CLIPS terminology, daemons are handlers which
    execute on the occurrence of some basic action
  • initialisation
  • deletion
  • get
  • put
  • Conceptually, they are automatically sent a
    message on occurrence of the relevant event
Write a Comment
User Comments (0)
About PowerShow.com