Knowledge Model Basics Challenges in knowledge modeling Basic
Knowledge Model Basics Challenges in knowledge modeling Basic knowledge-modeling constructs Comparison to general software analysis Knowledge-modelling basics
Knowledge model n n specialized tool for specification of knowledgeintensive tasks abstracts from communication aspects real-world oriented reuse is central theme Knowledge-modelling basics 2
Relation to other models task selected in feasibility study and further detailed in Task and Agent Models organization model task model agent model communication model knowledgeintensive task design model knowledge model Knowledge-modelling basics requirements specification for interaction functions requirements specification for reasoning functions 3
The term “knowledge” n n n “information about information” example: sub-class hierarchy of object types no hard borderline between information and knowledge ä n knowledge is “just“ semantically rich information target: “knowledge-intensive” systems ä ä large bulk of meaningful information is present scope is broader than traditional KBS Knowledge-modelling basics 4
Challenges in specifying knowledge Knowledge-modelling basics 5
Structuring a knowledge base Knowledge-modelling basics 6
Knowledge categories n Task knowledge ä ä n Domain knowledge ä ä n goal-oriented functional decomposition relevant domain knowledge and information static Inference knowledge ä basic reasoning steps that can be made in the domain knowledge and are applied by tasks Knowledge-modelling basics 7
Knowledge model overview Knowledge-modelling basics 8
Example domain: car diagnosis Knowledge-modelling basics 9
Domain knowledge n domain schema ä ä ä n schematic description of knowledge and information types comparable to data model defined through domain constructs knowledge base ä ä ä set of knowledge instances comparable to database content but; static nature Knowledge-modelling basics 10
Constructs for domain schema n Concept ä n Relation ä n cf. association Attribute ä n cf. object class (without operations) primitive value Rule type ä introduces expressions => no SE equivalent Knowledge-modelling basics 11
Concept & attribute n n “Concept” describes a set of objects or instances multiple concept hierarchies ä n n along distinct dimensions can have any number of attributes Am attribute refers to a values are atomic and are defined through a value type attribute may not refer to another concept ä use relation construct Knowledge-modelling basics 12
Example: car concepts Knowledge-modelling basics 13
Example: apple concept Knowledge-modelling basics 14
Example: car subtypes Knowledge-modelling basics 15
Example: house sub-types Knowledge-modelling basics 16
Relation n n typically between concepts, any arity cardinality specification special construct for binary relations can have subtypes as well as attributes reification of a relation is allowed ä ä ä relation functions as a concept cf. Association class in UML a form of higher order relations Knowledge-modelling basics 17
Example: car relation Knowledge-modelling basics 18
N-ary relation Knowledge-modelling basics 19
Modelling rules n n n “rules” are a common form for symbolic knowledge do not need to be formal knowledge analysis is focused on finding rules with a common structure ä a rule as an instance of a rule type Knowledge-modelling basics 20
Rule type n models a relation between expressions about feature values (e. g. attribute values) gas-dial. value = zero -> fuel-tank. status = empty n n models set of real-world “rules” with a similar structure dependency is usually not strictly logical (= implication) ä specify connection symbol Knowledge-modelling basics 21
Example rule type Knowledge-modelling basics 22
Rule type structure n n <antecedent> <connection-symbol> <consequent> example rule: fuel-supply. status = blocked CAUSES gas-in-engine. status = false; n flexible use for almost any type of dependency ä multiple types for antecedent and consequent Knowledge-modelling basics 23
Rule types for car diagnosis Knowledge-modelling basics 24
Knowledge base n n = conceptual knowledge-base partition contains instances of knowledge types rule-type instances = “rules” structure: ä ä n USES: <types used> from <schema> EXPRESSIONS: <instances> instance representation: ä intuitive natural language – connection symbol ä formal expression language (appendix of book) Knowledge-modelling basics 25
Example knowledge base KNOWLEDGE-BASE car-network; USES: state-dependency FROM car-diagnosis-schema, manifestation-rule FROM car-diagnosis-schema; EXPRESSIONS: /* state dependencies */ fuse. status = blown CAUSES power. status = off; battery. status = low CAUSES power. status = off; …. /* manifestation rules */ fuse. status = blown HAS-MANIFESTATION fuse-inspection. value = broken; battery. status = low HAS-MANIFESTATION battery-dial. value = zero; …. . END KNOWLEDGE-BASE car-network; Knowledge-modelling basics 26
Inference knowledge n n describes the lowest level of functional decomposition basic information-processing units: ä ä n inference => reasoning transfer function => communication with other agents why special status? ä ä indirectly related to domain knowledge enables reuse of inference Knowledge-modelling basics 27
Example inference: cover Knowledge-modelling basics 28
Inference n n fully described through a declarative specification of properties of its I/O internal process of the inference is a black box ä n I/O described using “role names” ä n not of interest for knowledge modeling. functional names, not part of the domain knowledge schema / data model guideline to stop decomposition: explanation Knowledge-modelling basics 29
Knowledge role n n n Functional name for data/knowledge elements Name captures the “role” of the element in the reasoning process Explicit mapping onto domain types Dynamic role: variant input/output Static role: invariant input ä cf. a knowledge basel Knowledge-modelling basics 30
Example inference INFERENCE cover; ROLES: INPUT: complaint; OUTPUT: hypothesis; STATIC: causal-model; SPECIFICATION: "Each time this inference is invoked, it generates a candidate solution that could have caused the complaint. The output thus should be an initial state in the state dependency network which causally ``covers'' the input complaint. "; END INFERENCE cover; Knowledge-modelling basics 31
Example dynamic knowledge roles KNOWLEDGE-ROLE complaint; TYPE: DYNAMIC; DOMAIN-MAPPING: visible-state; END KNOWLEDGE-ROLE complaint; KNOWLEDGE-ROLE hypothesis; TYPE: DYNAMIC; DOMAIN-MAPPING: invisible-state; END KNOWLEDGE-ROLE hypothesis; Knowledge-modelling basics 32
Example static knowledge role KNOWLEDGE-ROLE causal-model; TYPE: STATIC; DOMAIN-MAPPING: state-dependency FROM car-network; END KNOWLEDGE-ROLE causal-model; Knowledge-modelling basics 33
Transfer functions n n transfers an information item between the reasoning agent and another agent from the knowledge-model point of view black box: only its name and I/O detailed specification of transfer functions is part of communication model standard names Knowledge-modelling basics 34
Types of transfer functions Knowledge-modelling basics 35
Inference structure n n n combined set of inferences specifies the basic inference capability of the target system graphical representation: inference structure provides constraints for control flow Knowledge-modelling basics 36
Example: car inferences Knowledge-modelling basics 37
Using inference structures n n Important communication vehicle during development process Often provisional inference structures Can be difficult to understand because of “vague” (non domain-specific terms) Often useful to annotate with domain-specific examples Knowledge-modelling basics 38
Annotated inference structure Knowledge-modelling basics 39
Reusing inferences n Standard set of inferences? ! ä n n difficult subject See catalog in Ch. 13 Use as much as possible standard names Knowledge-modelling basics 40
Task knowledge n describes goals ä ä ä n n assess a mortgage application in order to minimize the risk of losing money find the cause of a malfunction of a photocopier in order to restore service. design an elevator for a new building. describes strategies that can be employed for realizing goals. typically described in a hierarchical fashion: Knowledge-modelling basics 41
Task decomposition for car diagnosis task method diagnosis through generate-and-test decomposition obtain cover predict compare transfer function inferences Knowledge-modelling basics 42
Task n n Description of the input/output Main distinction with traditional functions is that the data manipulated by the task are (also) described in a domain-independent way. ä example, the output of a medical diagnosis task would not be a “disease” but an abstract name such as “fault category” Knowledge-modelling basics 43
Example task TASK car-fault-category; GOAL: "Find a likely cause for the complaint of the user"; ROLES: INPUT: complaint: "Complaint about the behavior of the car"; OUTPUT: fault-category: "A hypothesis explained by the evidence"; evidence: "Set of observations obtained during the diagnostic process"; SPEC: "Find an initial state that explains the complaint and is consistent with the evidence obtained"; END TASK car-diagnosis; Knowledge-modelling basics 44
Task method n n n describes how a task is realized through a decomposition into sub-functions: another task, inference, transfer function core part of a method: “control structure” ä n describes ordering of sub-functions small program, captured reasoning strategy additional task roles ä to store intermediate reasoning results Knowledge-modelling basics 45
Example task method TASK-METHOD diagnosis-through-generate-and-test; DECOMPOSITION: INFERENCES: cover, predict, compare; TRANSFER-FUNCTIONS: obtain; ROLES: INTERMEDIATE: expected-finding: "The finding predicted, in case the hypothesis is true"; actual-finding: "The finding actually observed"; Knowledge-modelling basics 46
Example method control CONTROL-STRUCTURE: REPEAT cover(complaint -> hypothesis); predict(hypothesis -> expected-finding); obtain(expected-finding -> actual-finding); evidence : = evidence ADD actual-finding; compare(expected-finding + actual-finding -> result); UNTIL "result = equal or no more solutions of over"; END REPEAT IF result == equal THEN fault-category : = hypothesis; ELSE "no solution found"; END IF Knowledge-modelling basics 47
UML activity diagram for method control Knowledge-modelling basics 48
Control structure elements n “procedure” calls: ä n role operations ä n tasks, transfer functions, inferences assign, add/append, delete/subtract, retrieve, . . control primitives ä repeat-until, while-do, foreach-do, if-then-else Knowledge-modelling basics 49
Control structures (cont. ) Conditions: n logical expressions about roles: ä n until differential = empty two special conditions ä has-solution – invocation of inference that can fail ä new solution – invocation of inference that can succeed multiple times, e. g. the cover inference in the car-diagnosis model Knowledge-modelling basics 50
Inference or task? n n n “If the internal behavior of a function are important for explaining the behavior of the system as a whole, then one needs to define this function as a task” During development: provisional inference structures Function = task or inference (or transfer function) Knowledge-modelling basics 51
Knowledge model vs. SE analysis model n “Data model” contains “data about data” ä n Functions are described data-model independent ä n enables reuse of reasoning functions Emphasis on “internal control” ä n = knowledge strategy of reasoning process Knowledge model abstracts from communication aspects Knowledge-modelling basics 52
The data-function debate Knowledge-modelling basics 53
- Slides: 53