org.semanticweb.kaon2.api.rules
Interface Literal


public interface Literal

Represents a literal in the rule. A literal consists of a predicate, a pattern representing the variable names or contstants and a flag determining whether the literal is negated.


Method Summary
 java.lang.Object accept(KAON2Visitor visitor)
          Accepts a visitor for this object.
 boolean containsVariable(Variable variable)
          Returns true if this literal contains supplied variable.
 Term getArgument(int argumentIndex)
          Returns the argument at given position.
 Constant getArgumentConstant(int argumentIndex)
          Returns the constant of the given argument.
 Term[] getArguments()
          Returns the array of argument terms.
 Variable getArgumentVariable(int argumentIndex)
          Returns the variable at given position.
 int getArity()
          Returns the arity of the literal.
 Predicate getPredicate()
          Returns the predicate of this literal.
 boolean isArgumentBoundToConstant(int argumentIndex)
          Reutrns true if given argument is bound to a constant.
 boolean isArgumentBoundToVariable(int argumentIndex)
          Reutrns true if given argument is bound to a variable.
 boolean isPositive()
          Returns true if this literal is positive (with respect to non-monotonic negation).
 void toString(java.lang.StringBuffer buffer, Namespaces namespaces)
          Writes this entity to the supplied sting buffer.
 

Method Detail

isPositive

boolean isPositive()
Returns true if this literal is positive (with respect to non-monotonic negation).

Returns:
true is this literal is positive

getPredicate

Predicate getPredicate()
Returns the predicate of this literal.

Returns:
the predicate

getArguments

Term[] getArguments()
Returns the array of argument terms. This object is not owned by the literal (i.e. it can be changed without affecthing this literal).

Returns:
the argument terms

getArity

int getArity()
Returns the arity of the literal.

Returns:
the arity of the literal

isArgumentBoundToVariable

boolean isArgumentBoundToVariable(int argumentIndex)
Reutrns true if given argument is bound to a variable.

Parameters:
argumentIndex - the index of the argument
Returns:
true if the argument is bound to a variable

isArgumentBoundToConstant

boolean isArgumentBoundToConstant(int argumentIndex)
Reutrns true if given argument is bound to a constant.

Parameters:
argumentIndex - the index of the argument
Returns:
true if the argument is bound to a constant

getArgument

Term getArgument(int argumentIndex)
Returns the argument at given position.

Parameters:
argumentIndex - the index of the argument
Returns:
the term at given position

getArgumentVariable

Variable getArgumentVariable(int argumentIndex)
Returns the variable at given position.

Parameters:
argumentIndex - the index of the argument
Returns:
the variable at given position (or null if given position is not bound to a variable)

getArgumentConstant

Constant getArgumentConstant(int argumentIndex)
Returns the constant of the given argument.

Parameters:
argumentIndex - the index of the argument
Returns:
the constant (of null if the argument is not bound to a constant)

containsVariable

boolean containsVariable(Variable variable)
Returns true if this literal contains supplied variable.

Parameters:
variable - the variable
Returns:
true if this literal contains supplied variable

toString

void toString(java.lang.StringBuffer buffer,
              Namespaces namespaces)
Writes this entity to the supplied sting buffer.

Parameters:
buffer - the buffer
namespaces - the namespaces object

accept

java.lang.Object accept(KAON2Visitor visitor)
Accepts a visitor for this object.

Parameters:
visitor - the visitor for this object
Returns:
the return value of the visitor (can be null)