Database description files structure and syntax

All input files for this project are located at framework/src/expertsystemfw/KnowledgeBase/Files/. In this folder are some examples of that files. You could use them as template for developing.

Folk knowledge base

This files define knowledge base based on first-order logic. Definition of knowledge base are based on Backus-Naur form.

Backus-Naur form:

KB ::== SORTSDEC DECLAR FORMULAS
DECLAR ::== (PREDDEC)*
SORTSDEC ::==
( SORTNAME "=" "{" (CONSTANTNAME ("," CONSTANTNAME)*)? "}" "\n" )*
PREDDEC ::==
"type" "(" PREDICATENAME ("(" SORTNAME ("," SORTNAME)* ")")? ")" "\n"
FORMULAS ::== ( "\n" FORMULA)*
FORMULA ::== ATOM | "forall" VARIABLENAME ":" "(" FORMULA ")" |
"exists" VARIABLENAME ":" "(" FORMULA ")" |
"(" FORMULA ")" | FORMULA "&&" FORMULA |
FORMULA "||" FORMULA | "!" FORMULA | "+" | "-"
ATOM ::== PREDICATENAME ("(" TERM ("," TERM)* ")")?
TERM ::== VARIABLENAME | CONSTANTNAME
  • Alfanumeric values starting with symbol ,,KB”
    • SORTNAME - name of group of constants
    • PREDICATE - name of predicate
    • CONSTNAME - name of constant
    • VARIABLENAME - name of variable

Example:

problem={gpuPowerCableDefect, monitorPowerSourceProblem, badDualMonitorSettings, videoCableNotProperlyPlugged, gpuNotSeatedWellOrDefective, ramNotSeatedWellOrDefective, damagedMonitorCable, defectiveMonitor, defectiveFan, gpuDefective}

type (system_powers_up(Problem))
type (live_screen(Problem))
type (monitor_LED_on(Problem))
type (NO_POWER_displayed(Problem))
type (NO_SIGNAL_displayed(Problem))
type (dual_monitors_HDTV(Problem))
type (hearing_a_string_of_beeps(Problem))
type (video_cable_secure(Problem))
type (GPU_seated_tested(Problem))
type (cable_damaged_or_bent_pins(Problem))
type (monitor_tested(Problem))
type (noisy_fan(Problem))
type (works_only_with_new_GPU(Problem))

forall Problem: (system_powers_up(Problem))

system_powers_up(monitorPowerSourceProblem)

live_screen(gpuPowerCableDefect)
NO_POWER_displayed(gpuPowerCableDefect)

monitor_LED_on(badDualMonitorSettings)
dual_monitors_HDTV(badDualMonitorSettings)

live_screen(videoCableNotProperlyPlugged)
monitor_LED_on(videoCableNotProperlyPlugged)
NO_SIGNAL_displayed(videoCableNotProperlyPlugged)

monitor_LED_on(gpuNotSeatedWellOrDefective)
hearing_a_string_of_beeps(gpuNotSeatedWellOrDefective)

Rules knowledge base

Knowledge base defined by rules IF <conclusion> THEN <formula> . In the rules could be used logical operators && and ||. With those easy rules could be defined whole behaviour of Knowledge base.

Example:

IF gpuPowerCableDefect THEN system_powers_up && NO_POWER_displayed && live_screen
IF monitorPowerSourceProblem THEN system_powers_up

Semantic network knowledge base

Semantic network knowledge base are file, that create semantic network based on rules. As the results of the expert system (conclusions) can be taken, the nodes that have the input level of the vertex 0 (not entered in the back edge), ie the node is the source. Each relation is define by one line in file. Syntax of the lines is:

node_from, relation, node_to

Delimiter could be comma or semicolon. White space will be ignored. Lines starting with # will be ignored. Relation must be name based on enumeration at: expertsystemfw.KnowledgeBase.SemanticNetwork.Relation. Between two nodes could be only one edge.

Example:

gpuPowerCableDefect, has_property, system_powers_up
gpuPowerCableDefect, has_property, live_screen
gpuPowerCableDefect, has_property, NO_POWER_displayed

Uncertainty

Uncertainty format must be specified by user. This format should be very simple, you just need specify certainty for conclusions and predicates. For example one part of file should look like example.

Example:

monitor_tested, gpuDefective, 0.8
live_screen, defectiveFan, 0.76
live_screen, damagedMonitorCable, 0.91