jason.bb
Class AgentJDBCPersistentBB

Package class diagram package AgentJDBCPersistentBB
java.lang.Object
  extended by jason.bb.ChainBBAdapter
      extended by jason.bb.JDBCPersistentBB
          extended by jason.bb.AgentJDBCPersistentBB
All Implemented Interfaces:
BeliefBase, java.lang.Cloneable, java.lang.Iterable<Literal>

public class AgentJDBCPersistentBB
extends JDBCPersistentBB

Implementation of BB that stores some beliefs in a relational data base. For all created table, an additional column (called j_agent) is created and populated with the name of the agent that uses this customisation.


Field Summary
 
Fields inherited from class jason.bb.JDBCPersistentBB
agentName, belsDB, conn, extraCols, timestampFunctor, url
 
Fields inherited from class jason.bb.ChainBBAdapter
nextBB
 
Fields inherited from interface jason.bb.BeliefBase
APercept, ASelf, TPercept, TSelf
 
Constructor Summary
AgentJDBCPersistentBB()
           
 
Method Summary
protected  java.lang.String getAgWhere()
           
protected  java.lang.String getCountQuery(PredicateIndicator pi)
          returns a SQL command to count the number of instances of a predicate
protected  java.lang.String getCreateTable(java.lang.String table, int arity, Structure columns)
          returns the SQL command to create a new table
protected  java.lang.String getDeleteAll(PredicateIndicator pi)
          returns a SQL command to delete all entries for a predicate
protected  java.lang.String getInsert(Literal l)
          returns the SQL command to insert l into the DB
protected  java.lang.String getSelectAll(PredicateIndicator pi)
          returns the SQL command the selects all literals of type pi
protected  java.lang.String getWhere(Literal l)
          returns the where clausule for a select for literal l
 
Methods inherited from class jason.bb.JDBCPersistentBB
abolish, add, contains, getCandidateBeliefs, getSelect, getTableName, getTableName, init, isCreatedByJason, isDB, iterator, remove, resultSetToLiteral, size, stop, structure2timestamp, test, timestamp2structure
 
Methods inherited from class jason.bb.ChainBBAdapter
add, clone, getAll, getAsDOM, getCandidateBeliefs, getLastBB, getNextAdapter, getPercepts, getRelevant, setNext, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentJDBCPersistentBB

public AgentJDBCPersistentBB()
Method Detail

getCreateTable

protected java.lang.String getCreateTable(java.lang.String table,
                                          int arity,
                                          Structure columns)
                                   throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns the SQL command to create a new table

Overrides:
getCreateTable in class JDBCPersistentBB
Throws:
java.sql.SQLException

getAgWhere

protected java.lang.String getAgWhere()

getDeleteAll

protected java.lang.String getDeleteAll(PredicateIndicator pi)
                                 throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns a SQL command to delete all entries for a predicate

Overrides:
getDeleteAll in class JDBCPersistentBB
Throws:
java.sql.SQLException

getCountQuery

protected java.lang.String getCountQuery(PredicateIndicator pi)
                                  throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns a SQL command to count the number of instances of a predicate

Overrides:
getCountQuery in class JDBCPersistentBB
Throws:
java.sql.SQLException

getSelectAll

protected java.lang.String getSelectAll(PredicateIndicator pi)
                                 throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns the SQL command the selects all literals of type pi

Overrides:
getSelectAll in class JDBCPersistentBB
Throws:
java.sql.SQLException

getWhere

protected java.lang.String getWhere(Literal l)
                             throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns the where clausule for a select for literal l

Overrides:
getWhere in class JDBCPersistentBB
Throws:
java.sql.SQLException

getInsert

protected java.lang.String getInsert(Literal l)
                              throws java.sql.SQLException
Description copied from class: JDBCPersistentBB
returns the SQL command to insert l into the DB

Overrides:
getInsert in class JDBCPersistentBB
Throws:
java.sql.SQLException