jdrew.oo.bu.builtins
Class AssertBuiltin

java.lang.Object
  extended by jdrew.oo.bu.builtins.BUBuiltin
      extended by jdrew.oo.bu.builtins.AssertBuiltin

public class AssertBuiltin
extends BUBuiltin

The class implements a "builtin" for asserting a new clause into the running knowledge base. While this would not normally be considered a built-in relation it is implement as such to provide for easy implementation.

This built-in extends the jdrew.oo.bu.builtins.BUBuiltin Class, instead of implementing the jdrew.oo.builtins.Builtin Interface as it requires access to data structures that are not available to it when implementing a regular built-in and also it does not work across both bottom-up and top-down, but is instead specific to bottom-up.

Title: OO jDREW

Description: Reasoning Engine for the Semantic Web - Supporting OO RuleML 0.88

Copyright: Copyright (c) 2005


Constructor Summary
AssertBuiltin(ForwardReasoner fr)
          Constructs a new object to implement the assert built-in relation.
 
Method Summary
 java.util.Vector buildResult(DefiniteClause dc, int term)
          This method performs the actions necessary to implement the assert built-in relation.
 int getSymbol()
          Access the symbol code for the assert built-in relation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertBuiltin

public AssertBuiltin(ForwardReasoner fr)
Constructs a new object to implement the assert built-in relation. This constructor must be passed a reference to the ForwardReasoner object that the built-in will be registered in.

Parameters:
fr - ForwardReasoner - The forward reasoner engine that will register this built-in relationship.
Method Detail

getSymbol

public int getSymbol()
Access the symbol code for the assert built-in relation.

Overrides:
getSymbol in class BUBuiltin
Returns:
int The symbol code for the assert built-in relation.

buildResult

public java.util.Vector buildResult(DefiniteClause dc,
                                    int term)
This method performs the actions necessary to implement the assert built-in relation. This will assert the clause that is the parameter to the assert into the running knowledge base and cause the goal to succeed.

Overrides:
buildResult in class BUBuiltin
Parameters:
dc - DefiniteClause The clause that contains the call to the assert built-in relation.
term - int An index into the atoms (array) of the clause (0 is the head, i = 1..n is the ith atom of the body of the clause) to the atom that is the call to the assert built-in relation.
Returns:
DefiniteClause A clause that will successfully unify with the call to the built-in if it should succeed. null or a fact that will not unify (null is preferred as it is more efficient) should be returned if the call to built-in relation should not succeed.