|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generic database interface used for implementing RDF Stores. Different database table layouts and different SQL dialects should all be supportable via this generic interface. In earlier versions of Jena the Driver was exposed to some applications - that is no longer the case, and no application should need to use these functions directly. Based in part on the Jena 1.0 implementation by der.
Nested Class Summary | |
static class |
IRDBDriver.GenSQLAnd
|
Method Summary | |
void |
abort()
Aborts the open transaction, then turns autocommit on. |
void |
begin()
Turns autocommit off, then opens a new transaction |
void |
cleanDB()
Remove all RDF information from a database. |
void |
close()
Close the databse connection. |
void |
commit()
Commits the open transaction, then turns autocommit on. |
List |
createSpecializedGraphs(DBPropGraph graphProperties)
Construct and return a list of specialized graphs. |
String |
createTable(int graphId,
boolean isReif)
Create a table for storing asserted or reified statements. |
void |
formatDB()
Deprecated. Since Jena 2.0 this call is no longer needed - formatting happens automatically as a side effect of creating Models - there should be no need for an application to interact directly with the driver. |
String |
genSQLFromList(int aliasCnt,
String table)
Generate an SQL string for a from list of a select stmt. |
String |
genSQLJoin(int lhsAlias,
char lhsCol,
int rhsAlias,
char rhsCol)
Generate an SQL string to joing two table columns. |
String |
genSQLQualConst(int alias,
char col,
Node lit)
Generate an SQL string to match a table column value to a constant. |
String |
genSQLQualGraphId(int alias,
int graphId)
Generate an SQL string to match a graph id. |
String |
genSQLQualParam(int alias,
char col)
Generate an SQL string to match a table column value to a parameter. |
String |
genSQLReifQualAnyObj(boolean objIsStmt)
Generate an SQL string for a reified statement to match on any subject, predicate or object column. |
String |
genSQLReifQualObj(char reifProp,
boolean hasObj)
Generate an SQL string for a reified statement to match on a property column. |
String |
genSQLReifQualStmt()
Generate an SQL string for a reified statement to match on the stmt URI. |
String |
genSQLResList(int[] resIndex,
VarIndex[] binding)
Generate an SQL string for a result list of a select stmt. |
String |
genSQLSelectStmt(String res,
String from,
String where)
Generate an SQL Select statement given the result list, the from list and the where clause; |
boolean |
getBatchEnabled()
Get the value of BatchEnabled |
int |
getCompressCacheSize()
Get the value of CompressCacheSize |
int |
getCompressURILength()
Get the value of CompressURILength |
IDBConnection |
getConnection()
Return the connection |
String |
getDatabaseType()
Return a string identifying underlying database type. |
DBPropGraph |
getDefaultModelProperties()
Obtain a default set of model properties. |
boolean |
getDoCompressURI()
Get the value of DoCompressURI |
boolean |
getDoDuplicateCheck()
Get the value of DoDuplicateCheck |
int |
getIndexKeyLength()
Get the value of IndexKeyLength |
int |
getInsertID(String tableName)
Return an auto-generated identifier for a table row. |
boolean |
getIsTransactionDb()
Get the value of IsTransactionDb |
int |
getLongObjectLength()
Get the value of LongObjectLength |
String |
getStoreWithModel()
Get the value of StoreWithModel |
SpecializedGraph |
getSystemSpecializedGraph()
Return the specialized graph containing system properties. |
String |
getTableNamePrefix()
Get the value of TableNamePrefix |
int |
graphIdAlloc(String graphName)
Allocate an identifier for a new graph. |
void |
graphIdDealloc(int graphId)
Deallocate an identifier for a new graph. |
boolean |
isDBFormatOK()
Test if the database has previously been formatted (there's no other way to easily tell, since getSpecializedGraph will always return something). |
String |
nodeToRDBString(Node node,
boolean addIfLong)
Convert a node to a string to be stored in a statement table. |
Node |
RDBStringToNode(String RDBString)
Convert an RDB string to the node that it encodes. |
List |
recreateSpecializedGraphs(DBPropGraph graphProperties)
Reconstruct and return a list of specialized graphs. |
void |
removeSpecializedGraphs(DBPropGraph graphProperties,
List specializedGraphs)
Remove the specialized graph, erasing all trace of a Graph. |
void |
setBatchEnabled(boolean bool)
Set the value of BatchEnabled |
void |
setCompressCacheSize(int count)
Set the value of CompressCacheSize. |
void |
setCompressURILength(int len)
Set the value of CompressURILength. |
void |
setConnection(IDBConnection dbcon)
Set the database connection |
void |
setDatabaseProperties(Graph databaseProperties)
Method setDatabaseProperties. |
void |
setDoCompressURI(boolean bool)
Set the value of DoCompressURI. |
void |
setDoDuplicateCheck(boolean bool)
Set the value of DoDuplicateCheck. |
void |
setIndexKeyLength(int len)
Set the value of IndexKeyLength. |
void |
setIsTransactionDb(boolean bool)
Set the value of IsTransactionDb. |
void |
setLongObjectLength(int len)
Set the value of LongObjectLength. |
void |
setStoreWithModel(String modelName)
Set the value of StoreWithModel. |
void |
setTableNamePrefix(String prefix)
Set the value of TableNamePrefix. |
boolean |
supportsJenaReification()
Deprecated. Since Jena 2.0 the reification API has changed. The new API is supported in all models, but the old Jena 1 API is no longer supported. This call will return false to indicate to old code that the old style of jena reification is not supported. |
boolean |
supportsMultipleModels()
Deprecated. Since Jena 2.0 all databases support multiple models. |
boolean |
transactionsSupported()
Returns true if the underlying database supports transactions. |
Method Detail |
public void setConnection(IDBConnection dbcon)
public IDBConnection getConnection()
public SpecializedGraph getSystemSpecializedGraph()
public List createSpecializedGraphs(DBPropGraph graphProperties)
graphProperties
- A set of customization properties for the graph.
public List recreateSpecializedGraphs(DBPropGraph graphProperties)
graphProperties
- A set of customization properties for the graph.
public void removeSpecializedGraphs(DBPropGraph graphProperties, List specializedGraphs)
graphProperties
- The properties for the graph to be removed.public boolean isDBFormatOK()
public void setDatabaseProperties(Graph databaseProperties)
databaseProperties
- is a Graph containing a full set of database propertiespublic DBPropGraph getDefaultModelProperties()
public String getDatabaseType()
public void cleanDB()
public void close() throws RDFRDBException
RDFDBException
- if there is an access problem
RDFRDBException
public void formatDB() throws RDFRDBException
RDFDBException
- if the is a problem opening the connection or an internal SQL error.
RDFRDBException
public String createTable(int graphId, boolean isReif)
graphId
- the graph which the table is created.isReif
- true if table stores reified statements.
public void abort() throws RDFRDBException
RDFRDBException
public void begin() throws RDFRDBException
RDFRDBException
public void commit() throws RDFRDBException
RDFRDBException
public boolean transactionsSupported()
public boolean supportsMultipleModels()
public boolean supportsJenaReification()
public int graphIdAlloc(String graphName)
graphName
- The name of a new graph.
public void graphIdDealloc(int graphId)
graphId
- The graph identifier.public int getInsertID(String tableName)
tableName
- The name of the table for the insert.
public String nodeToRDBString(Node node, boolean addIfLong)
addIfLong
- If the node is a long object and is not in the database, add it.
public Node RDBStringToNode(String RDBString)
public String genSQLReifQualStmt()
public String genSQLReifQualAnyObj(boolean objIsStmt)
objIsStmt
- If true, the object value is rdf:Statement so also match
on the hasType column.
public String genSQLReifQualObj(char reifProp, boolean hasObj)
reifProp
- The property column to match, one of S,P,O,T for subject,
predicate, object or type, respectively.hasObj
- If true, the object value is known so do equality match. Otherwise,
just check for non-null value.
public String genSQLQualConst(int alias, char col, Node lit)
alias
- The table alias for this match.col
- The column to match, one of S,P,O,N,T for subject,
predicate, object, statement or type, respectively.lit
- The literal value to match.
public String genSQLQualParam(int alias, char col)
alias
- The table alias for this match.col
- The column to match, one of S,P,O,N,T for subject,
predicate, object, statement or type, respectively.
public String genSQLQualGraphId(int alias, int graphId)
alias
- The table alias for this match.graphId
- The identifer of the graph to match.
public String genSQLJoin(int lhsAlias, char lhsCol, int rhsAlias, char rhsCol)
lhsAlias
- The left side table alias for the join.lhsCol
- The left side column to join, one of
S,P,O,N,T.rhsAlias
- The right side table alias to join.rhsCol
- The right side column to join.
public String genSQLResList(int[] resIndex, VarIndex[] binding)
binding
- Array of Var containing the result list bindings.
public String genSQLFromList(int aliasCnt, String table)
aliasCnt
- The number of table aliases in the from list.table
- The name of the table to be queried.
public String genSQLSelectStmt(String res, String from, String where)
res
- The result list as a string.from
- The from list as a string.where
- The where qualifier as a string.
public int getLongObjectLength()
public void setLongObjectLength(int len)
public int getIndexKeyLength()
public void setIndexKeyLength(int len)
public boolean getIsTransactionDb()
public void setIsTransactionDb(boolean bool)
bool
- public boolean getDoCompressURI()
public void setDoCompressURI(boolean bool)
bool
- public int getCompressURILength()
public void setCompressURILength(int len)
public boolean getDoDuplicateCheck()
public void setDoDuplicateCheck(boolean bool)
bool
- public String getTableNamePrefix()
public void setTableNamePrefix(String prefix)
public String getStoreWithModel()
public void setStoreWithModel(String modelName)
public int getCompressCacheSize()
public void setCompressCacheSize(int count)
public boolean getBatchEnabled()
public void setBatchEnabled(boolean bool)
bool
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |