Class DbStore

Description

DbStore is a persistent store of RDF data using relational database technology.

DbStore uses ADOdb Library for PHP V3.60 (http://php.weblogs.com/ADODB), which allows to connect to multiple databases in a portable manner. This class also provides methods for creating tables for MsAccess, MySQL, and MS SQL Server. If you want to use other databases, you will have to create tables by yourself according to the abstract database schema described in the API documentation.

  • access: public
  • author: Radoslaw Oldakowski <radol@gmx.de>
  • author: Daniel Westphal (http://www.d-westphal.de)
  • version: $Id: DbStore.html,v 1.15 2006/06/26 12:34:20 tgauss Exp $

Located in /model/DbStore.php (line 25)

Object
   |
   --DbStore
Variable Summary
object ADOConnection $dbConn
Method Summary
DbStore DbStore ([string $dbDriver = ADODB_DB_DRIVER], [string $host = ADODB_DB_HOST], [string $dbName = ADODB_DB_NAME], [string $user = ADODB_DB_USER], [string $password = ADODB_DB_PASSWORD])
void close ()
void createTables (string $databaseType)
boolean datasetExists (mixed $datasetName)
object DatasetDb getDatasetDb (mixed $datasetName)
object DbModel getModel (string $modelURI)
object NamedGraphMem getNamedGraphDb (mixed $modelURI, mixed $graphName)
object DatasetDB &getNewDatasetDb (mixed $datasetName)
object DbModel getNewModel (string $modelURI, [string $baseURI = NULL])
object namedGraphDb getNewNamedGraphDb (mixed $modelURI, mixed $graphName, [mixed $baseURI = NULL])
void isSetup ([string $databaseType = "MySQL"])
array listModels ()
boolean modelExists (string $modelURI)
boolean putModel (object Model &$model, [string $modelURI = NULL])
boolean removeNamedGraphDb (mixed $modelURI)
void _isSetup_MSSQL ()
void _isSetup_MySql ()
Variables
object ADOConnection $dbConn (line 33)

Database connection object

  • access: private
Methods
Constructor DbStore (line 47)

Constructor: Set the database connection with the given parameters.

  • access: public
DbStore DbStore ([string $dbDriver = ADODB_DB_DRIVER], [string $host = ADODB_DB_HOST], [string $dbName = ADODB_DB_NAME], [string $user = ADODB_DB_USER], [string $password = ADODB_DB_PASSWORD])
  • string $dbDriver
  • string $host
  • string $dbName
  • string $user
  • string $password
close (line 235)

Close the DbStore.

!!! Warning: If you close the DbStore all active instances of DbModel from this !!! DbStore will lose their database connection !!!

  • access: public
void close ()
createTables (line 80)

Create tables and indexes for the given database type.

Currently supported: MsAccess and MySQL. If you want to use other databases, you will have to create tables by yourself according to the abstract <a href="database_schema.html">database schema</a> described in the API documentation.

  • access: public
  • throws: PhpError
void createTables (string $databaseType)
  • string $databaseType
datasetExists (line 574)

Check if the Dataset with the given $datasetName is already stored in the database

  • access: public
  • throws: SqlError
boolean datasetExists (mixed $datasetName)
getDatasetDb (line 597)

Create a new instance of DatasetDb with the given $datasetName and load the corresponding values from the database.

Return FALSE if the DbModel does not exist.

  • access: public
object DatasetDb getDatasetDb (mixed $datasetName)
getModel (line 156)

Create a new instance of DbModel with the given $modelURI and load the corresponding values of modelID and baseURI from the database.

Return FALSE if the DbModel does not exist.

  • access: public
object DbModel getModel (string $modelURI)
  • string $modelURI
getNamedGraphDb (line 620)

Create a new instance of namedGraphDb with the given $modelURI and graphName and load the corresponding values of modelID and baseURI from the database.

Return FALSE if the DbModel does not exist.

  • access: public
object NamedGraphMem getNamedGraphDb (mixed $modelURI, mixed $graphName)
getNewDatasetDb (line 542)

Create a new instance of DatasetDb with the given $datasetName and insert the DatasetDb variables into the database.

Return FALSE if there is already a model with the given URI.

  • access: public
  • throws: SqlError
object DatasetDB &getNewDatasetDb (mixed $datasetName)
getNewModel (line 182)

Create a new instance of DbModel with the given $modelURI and insert the DbModel variables into the database.

Return FALSE if there is already a model with the given URI.

  • access: public
  • throws: SqlError
object DbModel getNewModel (string $modelURI, [string $baseURI = NULL])
  • string $modelURI
  • string $baseURI
getNewNamedGraphDb (line 649)

Create a new instance of namedGraphDb with the given $modelURI and graphName and insert the DbModel variables into the database (not the graphName. This is only stored persistently, when added to dataset).

Return FALSE if there is already a model with the given URI.

  • access: public
  • throws: SqlError
object namedGraphDb getNewNamedGraphDb (mixed $modelURI, mixed $graphName, [mixed $baseURI = NULL])
isSetup (line 455)

Checks if tables are setup for RAP

  • access: public
  • throws: SqlError
void isSetup ([string $databaseType = "MySQL"])
  • string $databaseType
listModels (line 103)

List all DbModels stored in the database.

  • access: public
  • throws: SqlError
array listModels ()
modelExists (line 133)

Check if the DbModel with the given modelURI is already stored in the database

  • access: public
  • throws: SqlError
boolean modelExists (string $modelURI)
  • string $modelURI
putModel (line 211)

Store a MemModel or another DbModel from a different DbStore in the database.

Return FALSE if there is already a model with modelURI matching the modelURI of the given model.

  • access: public
boolean putModel (object Model &$model, [string $modelURI = NULL])
removeNamedGraphDb (line 677)

Removes the graph with all statements from the database.

Warning: A single namedGraph can be added to several datasets. So it'll be removed from all datasets.

  • access: public
  • throws: SqlError
boolean removeNamedGraphDb (mixed $modelURI)
_createTables_MsAccess (line 280)

Create tables and indexes for MsAccess database

  • access: private
  • throws: SqlError
void _createTables_MsAccess ()
_createTables_mssql (line 400)

Create tables and indexes for MSSQL database

  • access: private
  • throws: SqlError
void _createTables_mssql ()
_createTables_MySql (line 343)

Create tables and indexes for MySQL database

  • access: private
  • throws: SqlError
void _createTables_MySql ()
_createUniqueDatasetID (line 267)

Create a unique ID for the dataset to be insert into the datasets table.

This method was implemented because some databases do not support auto-increment.

  • access: private
integer _createUniqueDatasetID ()
_createUniqueModelID (line 254)

Create a unique ID for the DbModel to be insert into the models table.

This method was implemented because some databases do not support auto-increment.

  • access: private
integer _createUniqueModelID ()
_isSetup_MsAccess (line 501)

Checks if tables are setup for RAP (MsAccess)

  • access: private
  • throws: SqlError
void _isSetup_MsAccess ()
_isSetup_MSSQL (line 519)

Checks if tables are setup for RAP (MSSQL)

  • access: private
  • throws: SqlError
void _isSetup_MSSQL ()
_isSetup_MySql (line 475)

Checks if tables are setup for RAP (MySql)

  • access: private
  • throws: SqlError
void _isSetup_MySql ()

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Mon, 26 Jun 2006 14:25:25 +0200 by phpDocumentor 1.3.0RC6