The abstract knowledge source (AbstractKS
class) is the base class for all knowledge sources in the blackboard system. The corresponding file AbstractKS.m
is located in the src/blackboard_core
directory as opposed to all implementations of actual knowledge sources that are located in the directory src/knowledge_sources
. The listing below shows the parts most relevant to development of new knowledge sources:
class AbstractKS
properties
blackboard;
blackboardSystem;
invocationMaxFrequency_Hz;
trigger;
events
KsFiredEvent
methods (Abstract)
canExecute()
execute()
methods
focus()
unfocus()
There are different aspects of functionality in this interface.
- Data access
Knowledge sources have a handle to the
blackboard
. Through this handle, data can be placed on and retrieved from the blackboard.- System setup
Through the handle
blackboardSystem
, knowledge sources get access to the methods for adding and removing other knowledge sources, and also access to theBlackboardMonitor
.- Execution properties
The property
invocationMaxFrequency_Hz
specifies how often this knowledge source is allowed to be executed. The methodsfocus
andunfocus
give access to the attentional priority of the knowledge source, which influences its relative importance when competing for computing resources with other knowledge sources. See Sectionsec-scheduler
for a description of scheduling.- Execution conditional
The abstract method
canExecute
must be implemented by the inheriting knowledge source. It is called by the scheduler when the knowledge source is next in the schedule before actually executing. If this method returns false, execution will not be performed. The second output argument of this method indicates whether the knowledge source should remain in the agenda or be removed.- Execution
The main functionality of any knowledge source is implemented in the method
execute
. A knowledge source gets executed by the scheduler if its maximum invocation frequency would not be exceeded and itscanExecute
method returns true. In this method, a knowledge source gets access to itstrigger
, a structure that contains information about the triggering event, the triggering source, and an argument the trigger source placed for usage by sinks.- Events
Knowledge sources can define their own individual events. However, each class already inherits a standard event from
AbstractKS
,KsFiredEvent
. Events can be triggered by knowledge sources viaobj.notify(eventname, attachedData)
.