53
COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 [email protected]

COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 [email protected]

Embed Size (px)

Citation preview

Page 1: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

1

Detailed Introduction toAionDS

Odin Taylor0191 515 3207

[email protected]

Page 2: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

2

What is AionDS ? Powerful KBS Development Tool

Supports modularised KBs FC / BC and mixed chaining rule bases

Hybrid system allowing stand alone Object Orientated development or in conjunction with rule based systems

Allows interfacing to other programs databases user programs - neural network code, Visual Basic, etc Web

Page 3: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

3

Main Components of AionDS

ClassesData definitionsMethods to act on data

StatesCohesive group of rulesHigh level control (inference)Control over inference process FC/BC/Mixed

VocabulariesGlobal variables, constants, data definitions, noise

words and reusable code

Page 4: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

4

Terminology & Symbols

Main State Sub State

Rules Class

Instance Slot

Method Function

Globals Global Parameter

Results

Page 5: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

5

Some Useful Keys F1 - Help for Active Window F3 - Open Selected Object F4 - Open Property Dialogue F7 - Save Changes to Current Object F8 - Save Changes to Current Object and close if OK F9 - Open Choice Dialogue F10 - Move Focus to menu Bar

Page 6: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

6

Classes

Classes Slots - data definitionsMethods - Procedures or Behavior that the individual

classes or instances know how to perform

Instancesspecific occurrence of a class

– static– dynamic

Page 7: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

7

Classes & Instances

Example of Class with Instances

Class - Bank Account

Owner

Print Balance

Deposit Money

BalanceInstance 1- Bank Account

Owner Mr Smith

Balance £150

Instance 2- Bank Account

Owner Ms Jones

Balance £2,300

Page 8: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

8

Slots

A slot defines an attribute (data item) of a class

Slots represent descriptive data about various aspects of the class

Each slot has a unique name and defines one significant feature of the class

Page 9: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

9

Slots

Each slot defines what kind of data values an instance of the class can contain - they do not contain actual values until instances are created.

Slot has only one data type and can contain only a certain, precisely defined kind of data

Page 10: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

10

Slot Data TypesSimple

– integer 1205 +33691 -7898– real 98.6 +2567.876 -000.02– boolean TRUE FALSE UNKNOWN– string ‘red’ ‘John Doe’ ‘0191

5153207’– time 04:30:01 4:30:01 4:30 PM– date 21/JUN/90 06-21-89

June 21, 1989

Compound – AionDS has data types for slots that can hold multiple values

» Integer_set set of integer values» real_set set of real values» string_set set of string values» integer_list list of integer values» real_list list of real values» string_list list of string values

Page 11: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

11

Lists and Sets

Listsordered sequence of values which all have the

same data typeMultiple elements in a list can have the same

value because they occupy different positions in the list

Use list data type when the order of data elements is important or when you have duplicate entries

Page 12: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

12

Lists and Sets

Setscollection of values which all have the same data

typeValues in the set MUST be unique since AionDS

does not store them in a particular sequenceUse a set data type when the order of data

elements is not important

Page 13: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

13

Other Slot Properties

Slots have the following basic properties Name Base Type Facts

– Manipulate and control the value that is stored in the slot Default

– assigns a value to a slot when it has exhausted all other means of assigning a value

Prompt– text that is displayed to a user when the inference engine requires a value

Sourcing– during inference, determines how AionDS uses system and user sources to

determine a value for a slot Value can change

– determines whether you can modify the value of a slot after the value is initially assigned

Page 14: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

14

Slot Sourcing

When a slot becomes a goal, its value, if it has one is used.

If the slot has no value then the inference engine is called to try and resolve the value for the slot

The slots Sourcing property tells the inference engine where to look for the value

Page 15: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

15

Slot Sourcing

Sourcing sequence is partly predetermined by the inference engine and is partly definable by the developer

The inference engine stops when a value is determined for the slot

Page 16: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

16

Slot Sourcing

Page 17: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

17

Slot Sourcing sequence 1 look at the slot facts. If the facts property constrains the value in

the slot but does not assign a value the inference engine continues to source

2 If the slot has no value once the facts are executed, the inference engine performs the following steps specified in the slots sourcing property System

tells the inference engine to use system sources only (rules and/or processes)

User inference engine asks user to resolve the slot

System,User (default sourcing sequence) look first at the system sources then ask user

User, System ask the user then look at the system sources

no value if no sourcing property is specified then the inference engine will use only

the Facts and Default properties to resolve the slot

Page 18: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

18

Sourcing Sequence Cont.

3 If the slot still has no value after user/system sourcing then the inference engine executes the default property

4 If the slot still has no value after default then the inference engine uses Unknown as the slot value

Page 19: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

19

Slot Events

Demons Useful to have a mechanism for taking some

action automatically whenever a slot’s value is sourced or modified

AionDS has built in methods called Demons Demons are event driven methods that are

trigged when an event occursWhenModifiedWhenSourced

Page 20: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

20

Demons

WhenModifiedexecutes whenever a slot value is changed

Page 21: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

21

Demons

WhenSourcedExecutes whenever a slot’s value is sourced

Page 22: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

22

Demons

Particularly useful for maintaining internal consistency among slots within a single instance

Can be thought of like the automatic update when you change values in a spreadsheet

Page 23: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

23

Methods

Procedures that operate on the data defined within a class

Defines some behavior for an individual instance or for the whole class

Methods characteristically perform data manipulation, file I/O, screens, reports and calculations

Page 24: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

24

Methods

Two main types of methods

Instance Methods

Class Methods

Page 25: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

25

Instance Methods Defined in the parent class and invoked upon an instance.

Typically a method is defined once in a class and then used by many instances of the class

Page 26: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

26

Instance Methods

When to use Instance Methods to perform any sort of operation that

requires procedural programming related to a single instance

most likely to be used for the following purposes

– To perform I/O operations– To perform special calculations in an instance– To maintain internal consistency between the

instance’s slot values

Page 27: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

27

Class Methods Define and invoke methods that operate on more than one instance of

a class or on the class itself, rather than on a single instance of a class Defined in a class and can be invoked in that same class or one of its

subclasses

Page 28: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

28

Class Methods

When to use Class Methods To create a new instance of the class To manipulate slot values for more than one

instance of the class To reference/reason over multiple instances

of the class

Page 29: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

29

Structures to Support Methods

MessagesDefinable on-screen text

ReportsCan be sent to the printer or written to a file

GraphsDisplay Business graphics

FunctionsPerform some specific function

Processes invoke, send and retrieve data from external

s/ware

Page 30: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

30

Invoking Methods

Send a Message to a class or instance

When class or instance receives the message, it looks up the method whose name is included in the message

That method is now invoked

Page 31: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

31

Invoking Methods

Invoking instance methodssend(methodname to instance) instance.methodname

Invoking class methodssend(methodname to class(classname))class(classname).methodname

Page 32: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

32

States Agenda - high level instructions that direct the

inference engine Rules - make decisions about the data

Page 33: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

33

The Main State Highest control level (starting point for system) Used to invoke other States by calling them in its

Agenda

Page 34: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

34

Rules Agenda statements give the high-level

instructions for inference Rules process the bulk of the information

Rules that are relevant to solving the same problem or achieving the same goal are normally grouped together in a single state

Typical rule consists of two partsPremiseAction

Page 35: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

35

Agendas for High Level Control

States have two componentsAgenda & Rules

Agendas typically contain statements to perform the following kind of functions

Call other states Invoke Methods on Classes or Instances Initiate forward or backward chaining using the

rules in a state Initiate database accessDisplay user friendly menus and messagesQuery the user for some information

Page 36: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

36

Agenda Statements

Written in the AionDS Knowledge Definition Language (KDL)

Inference engine tries to execute the statements in the order that they are specified

Page 37: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

37

Agenda Statements - examples

state– Invokes all the children states of the current state

in any orderstate(state)

– Invokes the state statesend(method to instance) or instance.method

– Calls the method method for instancesend(method to class(class)) or class(class).method

– Calls the method method for class class forwardchain

– Initiates forward chaining using the rules in the current state

Page 38: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

38

Agenda Statementsslot(instance.slot)

– Initiates backward chaining using the rules in the current state with the value of slot in instance as the goal

if condition then action(s) end– Executes the statements in actions if the

condition is true - used only for high level control

Comments within KDL– delimited by /* text */

» /* Open the Application Window */

Page 39: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

39

Invoking and controlling States

When AionDS application is started it automatically executes the agenda of the main state.

Inference engine does not invoke other states in the knowledge base until it is directed to by a state command

Page 40: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

40

Invoking and Controlling States

A state can cause other states to execute by including state commands in its agenda

The invoking state decides what states to invoke and the order in which to invoke them

Refrigerator diagnosis applicationMain state invokes the DiagnoseProblem state

then the RecommendAction state

Page 41: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

41

The refrigerator diagnosis application

Page 42: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

42

Hierarchical States option of using the state command without specifying a

particular state to invoke this allows the inference engine to process the child

states in any order that it chooses

Page 43: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

43

Invoking and Controlling States

These parent agendas exert more explicit control over the order in which the child states execute and/or whether they execute or not

Page 44: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

44

Invoking and Controlling States

Complex applications with multiple states require control logic to ensure that each state executes only when it is appropriate to do so

Two basic alternatives 1) The agenda of each state contains conditionals

that decide whether or not to activate that state’s rules/agenda

2) The agenda of a state that is invoking additional states contains conditionals that govern whether or not to enter those states

Page 45: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

45

Invoking and Controlling States

Page 46: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

46

Invoking and Controlling States

Page 47: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

47

States Summary States

States represent the high level (agenda) and low level control (rules) components of your application knowledge

Agendas The agenda of a state defines its control instructions

and are written in the AionDS KDL language

Main State Every application contains the entry state Main and

controls how the application runs at the highest level

Page 48: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

48

States Summary continued

Additional States Beside main state, additional states should be

created for any or all of the following reasonsTo represent the modules of the problemTo represent the major tasks within the problemTo organise rule-based inferencingTo isolate non-inferencing operations such as I/O

Page 49: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

49

States Summary continued

State Hierarchies States can be defined independently or organised

into hierarchies. Hierarchies are useful for organising rules into logical groups for procedural control and for easier developer understanding

Invoking States Use the KDL command state to invoke a state. You

can invoke a state from another state or from other parts of the application, such as a rule

Page 50: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

50

States Summary continued

Controlling State Execution Agendas of states should be defined so that flow of

control is explicit as possible. Knowledge can be defined in agendas to prevent

improper execution of the state.

Benefits of Using States Clearly define the control logic of your application

(inference) Organise the knowledge of your application (rules) The inferencing process can be adapted for each

state e.g. set to FC/BC or Mixed

Page 51: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

51

Vocabularies

Collection of global knowledge Content of vocabularies could be

ConstantsData DefinitionsReusable codeNoise words (enum)

Page 52: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

52

Summary In this lecture we have looked at operational

details behind Aion DS We have seen

how classes work how instances can have different types of value how instances can be sourced in a variety of ways how slots have different data types two complex data types ‘lists’ and ‘sets’

Page 53: COM362 Knowledge Engineering Detail Intro to AionDS 1 Detailed Introduction to AionDS Odin Taylor 0191 515 3207 odin.taylor@sunderland.ac.uk

COM362 Knowledge EngineeringDetail Intro to AionDS

53

Summary continued We have looked at the advantages of ‘states’

as a method of organising knowledge We have looked at

the ‘Main’ state how agendas proved high level control how agendas can be used to structure large

knowledge bases to aid efficiency and maintenance and

how the inference process can be controlled