|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.hp.hpl.mesa.rdf.jena.rdb.DriverGenericGeneric
Base database driver for implementing ModelRDB and StoreRDB. Different drivers are needed for different databases and different layout schemes.
This driver 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.
Field Summary | |
static java.lang.String |
ANON_NAMESPACE
Namesapce used to flag anonymous resources |
Constructor Summary | |
DriverGenericGeneric()
Create a bare instance of the driver. |
Method Summary | |
void |
addStatement(Statement s,
ModelRDB m)
Register a statement in the database. |
IDBID |
allocateModelID(java.lang.String modelName)
Allocate a new databaseID for a new model in the same database. |
void |
attachStore(StoreRDB store)
Register a store as a user of this driver. |
void |
cleanDB()
Remove all RDF information from a database. |
void |
close()
Close the databse connection |
IConstraints |
createConstraints(ModelRDB model)
Create a constraint object appropriate for this type of database layout |
void |
deleteStatement(Resource subject,
Property predicate,
RDFNode object,
ModelRDB m)
Delete the statements in the model which match the given subject, predicate object. |
void |
detachStore(StoreRDB store)
Notify that a store is no longer using this driver. |
void |
formatDB()
Initialise a database ready to store RDF tables. |
java.sql.Connection |
getConnection()
Return the jdbc connection to the database, opening it if necessary |
Literal |
getLiteral(IDBID id)
Fetch a literal just knowing its literal rdb-id. |
IDBID |
getLiteralID(Literal l)
Return the database ID for the literal, if it exists |
IDBID |
getModelID(java.lang.String modelName)
Return the databaseID for an existing named model within the database. |
java.lang.String |
getNamespace(IDBID nsid)
Return the namespace string corresponding to a given namespace id. |
Property |
getProperty(IDBID id,
ModelRDB m)
Fetch a property just knowing its resource rdb-id. |
Property |
getProperty(java.lang.String uri,
ModelRDB m)
Fetch a property, knowing its uri. |
Resource |
getResource(IDBID id,
ModelRDB m)
Fetch a resource just knowing its resource rdb-id. |
Resource |
getResource(java.lang.String uri,
ModelRDB m)
Fetch a resource, knowing its uri. |
IDBID |
getResourceID(Resource resource)
Lookup the unique ID for a resource. |
SQLCache |
getSQLCache()
Return the SQLCache used for database commands. |
void |
hintPropertyTable(Property p)
Hint to the store that the given property could be stored as an attribute table. |
boolean |
isDBFormatOK()
Check that the database has a legal set of RDF tables. |
boolean |
isStatementPresent(Resource subject,
Property predicate,
RDFNode object,
ModelRDB m)
Check if a statement is in the database. |
java.util.Iterator |
listModels()
List the names of all models in this database |
ResultSetIterator |
listNamespaces(ModelRDB m)
List all namespaces referenced in the model |
ResultSetIterator |
listStatements(IConstraints constraints,
ModelRDB m)
List all the statements in the given moddel which make the given set of constraints (a constraint set can be obtained using createConstraints(com.hp.hpl.mesa.rdf.jena.rdb.ModelRDB) ). |
ResultSetIterator |
listStatements(Resource subject,
Property predicate,
RDFNode object,
ModelRDB m)
List all the statements in the model which match the given subject, predicate object - each of which can be null (meaning wildcard). |
ResultSetIterator |
listSubjects(ModelRDB m)
List all the subject resources in the model |
void |
loadDatabaseDriver()
Force a load of the jdbc driver. |
void |
loadProperties(java.util.Properties props)
Load a set of configuration parameters into the driver. |
Resource |
makeResource(IDBID id,
java.lang.String localname,
IDBID nsid,
ModelRDB m)
Re-create a resource from its local name and namespace identifier |
void |
saveProperties()
Store the configuration parameters onto the database layout table in the attached database |
void |
setConnection(IDBConnection dbcon)
Link an existing instance of the driver to a specific jdbc connection |
boolean |
supportsMultipleModels()
Returns true of the database layout supports multiple RDF models in the same database. |
java.lang.String |
toString()
Printable name for the driver configuration |
IDBID |
wrapDBID(java.lang.Object id)
Convert the raw SQL object used to store a database identifier into a java object which meets the IDBID interface |
java.lang.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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String ANON_NAMESPACE
Constructor Detail |
public DriverGenericGeneric()
Method Detail |
public void setConnection(IDBConnection dbcon) throws RDFRDBException
setConnection
in interface IRDBDriver
public void close() throws RDFRDBException
close
in interface IRDBDriver
RDFRDBException
- if there is an access problempublic java.sql.Connection getConnection() throws RDFRDBException
getConnection
in interface IRDBDriver
public SQLCache getSQLCache()
getSQLCache
in interface IRDBDriver
public boolean isDBFormatOK() throws RDFRDBException
isDBFormatOK
in interface IRDBDriver
RDFRDBException
- typtically due to internal programming errors, might trap
and change to logging operations in the future.public void formatDB() throws RDFRDBException
formatDB
in interface IRDBDriver
RDFRDBException
- typtically due to internal programming errors, might trap
and change to logging operations in the future.public void cleanDB()
cleanDB
in interface IRDBDriver
public void loadProperties(java.util.Properties props)
loadProperties
in interface IRDBDriver
public void saveProperties() throws java.sql.SQLException
public java.lang.String toString()
toString
in class java.lang.Object
public void attachStore(StoreRDB store)
attachStore
in interface IRDBDriver
public void detachStore(StoreRDB store)
detachStore
in interface IRDBDriver
public void addStatement(Statement s, ModelRDB m) throws RDFException
addStatement
in interface IRDBDriver
subjId
- database index of the subject entrypredId
- database index of the predicate entryobjId
- database index of the object entryisLiteral
- if the object is a literal rather than a resourcepublic ResultSetIterator listSubjects(ModelRDB m) throws RDFRDBException
listSubjects
in interface IRDBDriver
m
- the model whose subjects are to be listedpublic ResultSetIterator listNamespaces(ModelRDB m) throws RDFRDBException
listNamespaces
in interface IRDBDriver
public ResultSetIterator listStatements(Resource subject, Property predicate, RDFNode object, ModelRDB m) throws RDFException
listStatements
in interface IRDBDriver
public boolean isStatementPresent(Resource subject, Property predicate, RDFNode object, ModelRDB m) throws RDFException
isStatementPresent
in interface IRDBDriver
public ResultSetIterator listStatements(IConstraints constraints, ModelRDB m) throws RDFException
createConstraints(com.hp.hpl.mesa.rdf.jena.rdb.ModelRDB)
).listStatements
in interface IRDBDriver
public IConstraints createConstraints(ModelRDB model)
createConstraints
in interface IRDBDriver
public void deleteStatement(Resource subject, Property predicate, RDFNode object, ModelRDB m) throws RDFException
deleteStatement
in interface IRDBDriver
public Resource getResource(java.lang.String uri, ModelRDB m) throws RDFException
getResource
in interface IRDBDriver
public Property getProperty(java.lang.String uri, ModelRDB m) throws RDFException
getProperty
in interface IRDBDriver
public boolean supportsMultipleModels()
supportsMultipleModels
in interface IRDBDriver
public IDBID allocateModelID(java.lang.String modelName) throws RDFRDBException
allocateModelID
in interface IRDBDriver
public IDBID getModelID(java.lang.String modelName) throws RDFRDBException
getModelID
in interface IRDBDriver
public java.util.Iterator listModels() throws RDFRDBException
listModels
in interface IRDBDriver
public java.lang.String getNamespace(IDBID nsid) throws RDFRDBException
getNamespace
in interface IRDBDriver
public Literal getLiteral(IDBID id) throws RDFException
getLiteral
in interface IRDBDriver
public IDBID getLiteralID(Literal l) throws RDFRDBException
getLiteralID
in interface IRDBDriver
public IDBID getResourceID(Resource resource) throws RDFException
getResourceID
in interface IRDBDriver
public Resource getResource(IDBID id, ModelRDB m) throws RDFException
getResource
in interface IRDBDriver
public Property getProperty(IDBID id, ModelRDB m) throws RDFException
getProperty
in interface IRDBDriver
public IDBID wrapDBID(java.lang.Object id) throws RDFRDBException
wrapDBID
in interface IRDBDriver
public java.lang.Object wrapFlag(boolean flag)
public Resource makeResource(IDBID id, java.lang.String localname, IDBID nsid, ModelRDB m) throws RDFException
makeResource
in interface IRDBDriver
public void loadDatabaseDriver() throws RDFRDBException
RDFRDBException
- if the driver fails to loadpublic void hintPropertyTable(Property p) throws RDFException
hintPropertyTable
in interface IRDBDriver
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |