Artificial Intelligence
Artificial Intelligence
Information

KnowledgeBase.Add(Fact) method


      Adds a fact in the knowledge base.


Namespace : ielib
Assembly : ielib.dll

public bool Add(Fact f)

Parameters

Type: ielib.Fact.

f: Represents a specified class Fact object.

Return value

Type : System.Boolean.

true If the object is accepted and added in the database, otherwise false.

      Note : It cannot add to the knowledge base 2 objects of the Fact class that has the same name. And cannot add a value null

Example :


KnowledgeBase kb = new KnowledgeBase(500);
Fact f1 = new Fact ("many monuments", Fact.DataType.Bool, null);
Fact f2 = new Fact ("many monuments", Fact.DataType.Symbol, null);
bool b = kb.Add(f1);// The variable b is equal true

b = kb.Add(f2) ; // The variable b is equal false
if (!b)
      MessageBox.Show("The object is already in the knowleddge base.");