nars.language
Class Statement

java.lang.Object
  extended by nars.language.Term
      extended by nars.language.CompoundTerm
          extended by nars.language.Statement
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Term>
Direct Known Subclasses:
Equivalence, Implication, Inheritance, Instance, InstanceProperty, Property, Similarity

public abstract class Statement
extends CompoundTerm

A statement is a compound term, consisting of a subject, a predicate, and a relation symbol in between. It can be of either first-order or higher-order.


Field Summary
 
Fields inherited from class nars.language.CompoundTerm
complexity, components, openVariables
 
Fields inherited from class nars.language.Term
name
 
Constructor Summary
protected Statement()
          Default constructor
protected Statement(java.lang.String n, java.util.ArrayList<Term> arg)
          Constructor with partial values, called by make
protected Statement(java.lang.String n, java.util.ArrayList<Term> cs, java.util.ArrayList<Variable> open, short i)
          Constructor with full values, called by clone
 
Method Summary
 Term getPredicate()
          Return the second component of the statement
 Term getSubject()
          Return the first component of the statement
 boolean invalid()
          Check the validity of a potential Statement.
static boolean invalidStatement(Term subject, Term predicate)
          Check the validity of a potential Statement.
static boolean isRelation(java.lang.String s0)
          Check Statement relation symbol, called in StringPaser
static Statement make(Statement statement, Term subj, Term pred)
          Make a Statement from given components, called by the rules
static Statement make(Statement statement, Term subj, Term pred, TemporalValue t)
          Make a Statement from given components and temporal information, called by the rules
static Statement make(java.lang.String relation, Term subject, Term predicate)
          Make a Statement from String, called by StringParser
protected  java.lang.String makeName()
          Override the default in making the name of the current term from existing fields
protected static java.lang.String makeStatementName(Term subject, java.lang.String relation, Term predicate)
          Default method to make the name of an image term from given fields
static Statement makeSym(Statement statement, Term subj, Term pred, TemporalValue t)
          Make a symmetric Statement from given components and temporal information, called by the rules
 
Methods inherited from class nars.language.CompoundTerm
addComponents, argumentsToList, clone, cloneComponents, cloneList, componentAt, containAllComponents, containComponent, getComplexity, getComponents, getConstantName, getOpenVariables, isCommutative, isConstant, isOperator, make, make, makeCompoundName, makeImageName, makeSetName, operator, prepareComponentLinks, reduceComponents, renameVariables, renameVariables, replaceComponent, replaceComponent, size, substituteComponent
 
Methods inherited from class nars.language.Term
compareTo, equals, getName, getOrder, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Statement

protected Statement()
Default constructor


Statement

protected Statement(java.lang.String n,
                    java.util.ArrayList<Term> arg)
Constructor with partial values, called by make

Parameters:
n - The name of the term
arg - The component list of the term

Statement

protected Statement(java.lang.String n,
                    java.util.ArrayList<Term> cs,
                    java.util.ArrayList<Variable> open,
                    short i)
Constructor with full values, called by clone

Parameters:
n - The name of the term
cs - Component list
open - Open variable list
i - Syntactic complexity of the compound
Method Detail

make

public static Statement make(java.lang.String relation,
                             Term subject,
                             Term predicate)
Make a Statement from String, called by StringParser

Parameters:
relation - The relation String
subject - The first component
predicate - The second component
Returns:
The Statement built

make

public static Statement make(Statement statement,
                             Term subj,
                             Term pred)
Make a Statement from given components, called by the rules

Parameters:
subj - The first component
pred - The second component
statement - A sample statement providing the class type
Returns:
The Statement built

make

public static Statement make(Statement statement,
                             Term subj,
                             Term pred,
                             TemporalValue t)
Make a Statement from given components and temporal information, called by the rules

Parameters:
statement - A sample statement providing the class type
subj - The first component
pred - The second component
t - The temporal order of the statement
Returns:
The Statement built

makeSym

public static Statement makeSym(Statement statement,
                                Term subj,
                                Term pred,
                                TemporalValue t)
Make a symmetric Statement from given components and temporal information, called by the rules

Parameters:
statement - A sample asymmetric statement providing the class type
subj - The first component
pred - The second component
t - The temporal order of the statement
Returns:
The Statement built

isRelation

public static boolean isRelation(java.lang.String s0)
Check Statement relation symbol, called in StringPaser

Parameters:
s0 - The String to be checked
Returns:
if the given String is a relation symbol

makeName

protected java.lang.String makeName()
Override the default in making the name of the current term from existing fields

Overrides:
makeName in class CompoundTerm
Returns:
the name of the term

makeStatementName

protected static java.lang.String makeStatementName(Term subject,
                                                    java.lang.String relation,
                                                    Term predicate)
Default method to make the name of an image term from given fields

Parameters:
subject - The first component
predicate - The second component
relation - The relation operator
Returns:
The name of the term

invalidStatement

public static boolean invalidStatement(Term subject,
                                       Term predicate)
Check the validity of a potential Statement. [To be refined]

Minimum requirement: the two terms cannot be the same, or containing each other as component

Parameters:
subject - The first component
predicate - The second component
Returns:
Whether The Statement is invalid

invalid

public boolean invalid()
Check the validity of a potential Statement. [To be refined]

Minimum requirement: the two terms cannot be the same, or containing each other as component

Returns:
Whether The Statement is invalid

getSubject

public Term getSubject()
Return the first component of the statement

Returns:
The first component

getPredicate

public Term getPredicate()
Return the second component of the statement

Returns:
The second component