|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.db.impl.PSet_TripleStore_RDB
Handles Physical storage for implementing SpecializedGraphs. Different PSet classes are needed for different databases and different layout schemes.
This class is a base implemention from which database-specific drivers can inherit. It is not generic in the sense that it will work on any minimal SQL store and so should be treated as if it were an abstract class.
The SQL statements which implement each of the functions are
loaded in a separate file etc/[layout]_[database].sql from the classpath.
See SQLCache documentation
for more information on the
format of this file.
Based on Driver* classes by Dave Reynolds.
Field Summary | |
protected boolean |
CACHE_PREPARED_STATEMENTS
Set to true to enable cache of pre-prepared statements |
protected static int |
DEFAULT_CACHE
default size for literal and resource caches |
protected String |
ID_SQL_TYPE
The SQL type to use for storing ids (compatible with wrapDBID) |
protected ICache |
literalCache
Cache of literals |
protected static org.apache.log4j.Logger |
logger
|
protected IRDBDriver |
m_driver
The IRDBDriver for the database. |
protected SQLCache |
m_sql
The table of sql driver statements |
String |
m_tblName
Holds name of AssertedStatement table (defaults to JENA_SYS_AssStatements). |
protected ICache |
resourceCache
Cache of resources |
protected boolean |
SKIP_DUPLICATE_CHECK
Set to true if the insert operations already check for duplications |
Constructor Summary | |
PSet_TripleStore_RDB()
Constructor. |
Method Summary | |
void |
cleanDB()
Remove all RDF information about this pset from a database. |
void |
close()
Close this PSet |
void |
deleteTriple(Triple t,
IDBID graphID)
Attempt to remove a statement from an Asserted_Statement table, if it is present. |
void |
deleteTriple(Triple t,
IDBID graphID,
boolean isBatch,
Hashtable batchedPreparedStatements)
Attempt to remove a statement from an Asserted_Statement table, if it is present. |
void |
deleteTripleAR(Triple t,
IDBID graphID,
Node reifNode,
boolean isBatch,
Hashtable batchedPreparedStatements)
Attempt to remove a statement from an Asserted_Statement table, if it is present. |
void |
deleteTripleList(List triples,
IDBID my_GID)
Attempt to remove a list of triples from the specialized graph. |
IRDBDriver |
driver()
|
Triple |
extractTripleFromRowData(String subj,
String pred,
String obj)
Convert the current row of a result set from a ResultSet to a Triple. |
ExtendedIterator |
find(TripleMatch t,
IDBID graphID)
|
Node_Literal |
getLiteralFromCache(IDBID id)
Fetch a literal from the cache just knowing its literal rdb-id. |
PreparedStatement |
getPreparedStatement(String op,
String tableName,
boolean isBatch,
Hashtable batchedPreparedStatements)
Given an operation name, a table name, whether or not this operation is part of a batched update, and a table of batched prepared statements, find or create an appropriate PreparedStatement. |
SQLCache |
getSQLCache()
|
String |
getTblName()
Accessor for m_tblName. |
void |
removeStatementsFromDB(IDBID graphID)
|
int |
rowCount(String tName)
Compute the number of rows in a table. |
void |
setCachePreparedStatements(boolean value)
|
void |
setDriver(IRDBDriver driver)
Link an existing instance of the IPSet to a specific driver |
void |
setSkipDuplicateCheck(boolean value)
|
void |
setSQLCache(SQLCache cache)
|
void |
setSQLType(String value)
|
void |
setTblName(String tblName)
Sets m_tblName variable. |
boolean |
statementTableContains(IDBID graphID,
Triple t)
Tests if a triple is contained in the specialized graph. |
void |
storeTriple(Triple t,
IDBID graphID)
Attempt to store a statement into an Asserted_Statement table. |
void |
storeTriple(Triple t,
IDBID graphID,
boolean isBatch,
Hashtable batchedPreparedStatements)
Attempt to store a statement into an Asserted_Statement table. |
void |
storeTripleAR(Triple t,
IDBID graphID,
Node reifNode,
boolean hasType,
boolean isBatch,
Hashtable batchedPreparedStatements)
Attempt to store a statement into an Asserted_Statement table. |
void |
storeTripleList(List triples,
IDBID my_GID)
Attempt to add a list of triples to the specialized graph. |
String |
toString()
Printable name for the driver configuration |
int |
tripleCount()
Compute the number of unique triples added to the Specialized Graph. |
IDBID |
wrapDBID(Object id)
Convert the raw SQL object used to store a database identifier into a java object which meets the IDBID interface. |
Object |
wrapFlag(boolean flag)
Wrap up a boolean flag as a object which the jdbc driver can assert into a boolean/short column. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public String m_tblName
protected String ID_SQL_TYPE
protected boolean SKIP_DUPLICATE_CHECK
protected boolean CACHE_PREPARED_STATEMENTS
protected SQLCache m_sql
protected static final int DEFAULT_CACHE
protected ICache literalCache
protected ICache resourceCache
protected IRDBDriver m_driver
protected static org.apache.log4j.Logger logger
Constructor Detail |
public PSet_TripleStore_RDB()
Method Detail |
public void setDriver(IRDBDriver driver) throws RDFRDBException
setDriver
in interface IPSet
RDFRDBException
public void setSQLType(String value)
setSQLType
in interface IPSet
public void setSkipDuplicateCheck(boolean value)
setSkipDuplicateCheck
in interface IPSet
public void setSQLCache(SQLCache cache)
setSQLCache
in interface IPSet
public SQLCache getSQLCache()
getSQLCache
in interface IPSet
public void setCachePreparedStatements(boolean value)
setCachePreparedStatements
in interface IPSet
public void setTblName(String tblName)
setTblName
in interface IPSet
tblName
- the name of the Statement Tablepublic String getTblName()
getTblName
in interface IPSet
public void close()
close
in interface IPSet
public IRDBDriver driver()
driver
in interface IPSet
public void cleanDB()
cleanDB
in interface IPSet
public String toString()
public Node_Literal getLiteralFromCache(IDBID id)
public IDBID wrapDBID(Object id) throws RDFRDBException
RDFRDBException
public int rowCount(String tName)
rowCount
in interface IPSet
public Triple extractTripleFromRowData(String subj, String pred, String obj)
extractTripleFromRowData
in interface IPSet
public Object wrapFlag(boolean flag)
public void deleteTriple(Triple t, IDBID graphID)
deleteTriple
in interface IPSet
graphID
- is the ID of the graphpublic void deleteTriple(Triple t, IDBID graphID, boolean isBatch, Hashtable batchedPreparedStatements)
graphID
- is the ID of the graphpublic void deleteTripleAR(Triple t, IDBID graphID, Node reifNode, boolean isBatch, Hashtable batchedPreparedStatements)
graphID
- is the ID of the graphpublic void storeTriple(Triple t, IDBID graphID)
storeTriple
in interface IPSet
graphID
- is the ID of the graphpublic PreparedStatement getPreparedStatement(String op, String tableName, boolean isBatch, Hashtable batchedPreparedStatements) throws SQLException
op
- tableName
- isBatch
- batchedPreparedStatements
-
SQLException
public void storeTriple(Triple t, IDBID graphID, boolean isBatch, Hashtable batchedPreparedStatements)
graphID
- is the ID of the graphisBatch
- is true if this request is part of a batch operation.public void storeTripleAR(Triple t, IDBID graphID, Node reifNode, boolean hasType, boolean isBatch, Hashtable batchedPreparedStatements)
hasType
- is true if the hasType flag should be set for a reified stmtgraphID
- is the ID of the graphisBatch
- is true if this request is part of a batch operation.public void storeTripleList(List triples, IDBID my_GID)
storeTripleList
in interface IPSet
triples
- List of triples to be added. This is modified by the call.my_GID
- ID of the graph.public void deleteTripleList(List triples, IDBID my_GID)
deleteTripleList
in interface IPSet
triples
- List of triples to be added. This is modified by the call.my_GID
- ID of the graph.public int tripleCount()
tripleCount
in interface IPSet
public boolean statementTableContains(IDBID graphID, Triple t)
statementTableContains
in interface IPSet
t
- is the triple to be testedgraphID
- is the id of the graph.
public ExtendedIterator find(TripleMatch t, IDBID graphID)
find
in interface IPSet
public void removeStatementsFromDB(IDBID graphID)
removeStatementsFromDB
in interface IPSet
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |