com.hp.hpl.mesa.rdf.jena.rdb
Interface IRDBDriver

All Known Implementing Classes:
DriverGenericGeneric, DriverGenericGenericProc, DriverGenericMMGeneric, DriverGenericMMHash, DriverGenericProc, DriverOracleMMGeneric, DriverGenericMMGenericProc, DriverInterbaseMMHash, DriverInterbaseHash

public interface IRDBDriver

Generic database interface used for implementing RDF Stores. Different database table layouts and different SQL dialects should all be supportable via this generic interface. Each driver instance can support multiple stores so long as "supportsMultipleModels" is true.

Version:
$Revision: 1.3 $ on $Date: 2002/03/01 14:25:13 $
Author:
Dave Reynolds

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 lliteral rdb-id
 IDBID getLiteralID(Literal l)
          Return the database ID for the literal
 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 loadProperties(java.util.Properties props)
          Load a set of configuration parameters into the driver.
 Resource makeResource(IDBID id, java.lang.String localname, IDBID nsidw, ModelRDB m)
          Re-create a resource from its local name and namespace identifier
 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.
 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
 

Method Detail

setConnection

public void setConnection(IDBConnection dbcon)
                   throws RDFRDBException
Link an existing instance of the driver to a specific jdbc connection

getConnection

public java.sql.Connection getConnection()
                                  throws RDFRDBException
Return the jdbc connection to the database, opening it if necessary

close

public void close()
           throws RDFRDBException
Close the databse connection
Throws:
RDFRDBException - if there is an access problem

isDBFormatOK

public boolean isDBFormatOK()
                     throws RDFRDBException
Check that the database has a legal set of RDF tables.
Returns:
true if the database seems to be legally formated.
Throws:
RDFRDBException - if the is a problem opening the connection or an internal SQL error.

formatDB

public void formatDB()
              throws RDFRDBException
Initialise a database ready to store RDF tables. Currently the table format depends on the RDBSpec type. In future it may become an explicit part of operations like this.
Throws:
RDFRDBException - if the is a problem opening the connection or an internal SQL error.

cleanDB

public void cleanDB()
Remove all RDF information from a database.

allocateModelID

public IDBID allocateModelID(java.lang.String modelName)
                      throws RDFRDBException
Allocate a new databaseID for a new model in the same database. Throws RDFRDBException if the driver does not support multiple models per db.

getModelID

public IDBID getModelID(java.lang.String modelName)
                 throws RDFRDBException
Return the databaseID for an existing named model within the database. Throws RDFRDBException if the driver does not support multiple models per db.

listModels

public java.util.Iterator listModels()
                              throws RDFRDBException
List the names of all models in this database

loadProperties

public void loadProperties(java.util.Properties props)
Load a set of configuration parameters into the driver.

attachStore

public void attachStore(StoreRDB store)
Register a store as a user of this driver. One driver can support multiple store instances.

detachStore

public void detachStore(StoreRDB store)
Notify that a store is no longer using this driver.

addStatement

public void addStatement(Statement s,
                         ModelRDB m)
                  throws RDFException
Register a statement in the database.

deleteStatement

public void deleteStatement(Resource subject,
                            Property predicate,
                            RDFNode object,
                            ModelRDB m)
                     throws RDFException
Delete the statements in the model which match the given subject, predicate object.

listSubjects

public ResultSetIterator listSubjects(ModelRDB m)
                               throws RDFRDBException
List all the subject resources in the model
Returns:
iterator over Resource objects

listNamespaces

public ResultSetIterator listNamespaces(ModelRDB m)
                                 throws RDFRDBException
List all namespaces referenced in the model
Returns:
iterator over Strings

listStatements

public ResultSetIterator listStatements(Resource subject,
                                        Property predicate,
                                        RDFNode object,
                                        ModelRDB m)
                                 throws RDFException
List all the statements in the model which match the given subject, predicate object - each of which can be null (meaning wildcard).

isStatementPresent

public boolean isStatementPresent(Resource subject,
                                  Property predicate,
                                  RDFNode object,
                                  ModelRDB m)
                           throws RDFException
Check if a statement is in the database.

listStatements

public ResultSetIterator listStatements(IConstraints constraints,
                                        ModelRDB m)
                                 throws RDFException
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)).

createConstraints

public IConstraints createConstraints(ModelRDB model)
Create a constraint object appropriate for this type of database layout

supportsMultipleModels

public boolean supportsMultipleModels()
Returns true of the database layout supports multiple RDF models in the same database.

makeResource

public Resource makeResource(IDBID id,
                             java.lang.String localname,
                             IDBID nsidw,
                             ModelRDB m)
                      throws RDFException
Re-create a resource from its local name and namespace identifier

wrapDBID

public IDBID wrapDBID(java.lang.Object id)
               throws RDFException
Convert the raw SQL object used to store a database identifier into a java object which meets the IDBID interface

getResource

public Resource getResource(IDBID id,
                            ModelRDB m)
                     throws RDFException
Fetch a resource just knowing its resource rdb-id.

getProperty

public Property getProperty(IDBID id,
                            ModelRDB m)
                     throws RDFException
Fetch a property just knowing its resource rdb-id.

getLiteral

public Literal getLiteral(IDBID id)
                   throws RDFException
Fetch a literal just knowing its lliteral rdb-id

getLiteralID

public IDBID getLiteralID(Literal l)
                   throws RDFRDBException
Return the database ID for the literal

getResourceID

public IDBID getResourceID(Resource resource)
                    throws RDFException
Lookup the unique ID for a resource.

getNamespace

public java.lang.String getNamespace(IDBID nsid)
                              throws RDFRDBException
Return the namespace string corresponding to a given namespace id

getSQLCache

public SQLCache getSQLCache()
Return the SQLCache used for database commands.

getResource

public Resource getResource(java.lang.String uri,
                            ModelRDB m)
                     throws RDFException
Fetch a resource, knowing its uri. If the resource does not yet exist in the database it is added

getProperty

public Property getProperty(java.lang.String uri,
                            ModelRDB m)
                     throws RDFException
Fetch a property, knowing its uri. If the property does not yet exist in the database it is added

hintPropertyTable

public void hintPropertyTable(Property p)
                       throws RDFException
Hint to the store that the given property could be stored as an attribute table.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.