Artificial Intelligence
Artificial Intelligence
Information

KnowledgeBase class


      Represents the knowledge base that contains a set of rules (RulesBase class) and a set of facts (FactsBase class).


Namespace : ielib
Assembly : ielib.dll
   C#
   public class KnowledgeBase

Constructors

KnowledgeBase():Initializes a new instance of the class KnowledgeBase.

KnowledgeBase(int iCapacity): Initializes a new instance of the class KnowledgeBase with the initialization of the specified capacity.

KnowledgeBase(KnowledgeBase aKBase): Initializes a new instance of the KnowledgeBase class from another object of the same class.

KnowledgeBase(string aXmlFileName): Initializes a new instance of the KnowledgeBase class from an XML file.


Properties

BaseName : Gets or sets the name of the knowledge base.

FactCount : Indicates the number of facts in the knowledge base.

FileName : Gets the name of XML file.

IsEmpty : Indicates whether the knowledge base is empty.

Item[int] : Gets a Fact class object at the index specified (from version 1.2.0.0).

Item[string] : Gets an object of the class Fact has a specified name.

PackageCount : indicates the number of packets in the knowledge base (from version 1.2.0.0).

RuleCount : Indicates the number of rules in the knowledge base.

Methods

Add(Fact f) : Adds a fact in the knowledge base.

Add(Rule r) : Adds a rule to the knowledge base.

AddPackage(string aPackageName) : Adds a new package by specifying its name (from version 1.2.0.0).

AddPackage(Package p) : Adds an object to the Package class (from version 1.2.0.0).

Affect(string aFactName, object aValue) : Assigns a value to a fact specified by its name.

Clear() : Removes all the elements of the base.

CopyFrom(KnowledgeBase aKBase) : Copy the rules and the fact from another knowledge base.

FirstFact() : Returns the first object of the Fact class.

FirstLeaf() : Returns the first object of the Fact class which is the leaf of the tree of the knowledge base.

FristRule() : Returns the first object of the Rule class.

ResetMemory() : Resets the memory of the knowledge base.

GetFactByName(string aName) : Returns an object of the class Fact specified by its name.

GetFactById(int Id) : Returns an object of the class Fact specified by its identifier.

GetPackageAt(int) : Gets an object of the class Package at the index specified (from version 1.2.0.0).

GetPackageById(int) : Gets an object of the class Package specified by its ID (from version 1.2.0.0).

GetRuleAt(int) : Gets a class Rule object at the specified index (from version 1.2.0.0).

GetRuleById(int Id) : Returns an object of the class Rule specified by its identifier.

LoadFrom(string aXmlFileName) : Restores the knowledge base from an XML file.

NextFact() : Returns the next object of the class Fact.

NextLeaf() : Returns the next object of the Fact class which is the leaf of the tree of the knowledge base.

NextRule() : Returns the next object of the class Rule.

RemoveFactById(int Id) : Removes a fact in the knowledge base by its identifier.

RemoveFactByName(string aFactName) : Removes a fact in the knowledge base by its name.

RemovePackage(int Id) : Removes a package in the knowledge base by its identifier (from version 1.2.0.0).

RemoveRuleById(int Id) : Deletes a rule in the knowledge base by its identifier.

Save() : Saves the knowledge base in the XML file current (see FileName property).

SaveAt(string aXmlFileName) : Saves the knowledge base in a specified XML file.


Events

ConclusionDoneEvent : Occurs when a rule may or may not conclude that a particular fact.

ContradictoryEvent : Occurs when a conclusion causes the contradiction.

BeforeAffectValueEvent : Occurs when a value will be assigned to a fact.

BeforeChangeStatusEvent : Occurs when the status of a fact will be changed.

BeforeChangeValueEvent : Occurs when the value of a fact will be changed.

StatusChangedEvent : Occurs when the status of a fact has changed.

StatusRuleDeductibleEvent : Occurs when the status of a rule becomes deductible or non-deductible.

StatusRuleSatisfiedEvent : Occurs when a rule is satisfied, or is not satisfied.

ValueAffectedEvent : Occurs when a value has been assigned to a fact.

ValueChangedEvent : Occurs when the value of a fact has been changed.