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.

You can activate debug mode by defining ADODB_DEBUG_MODE to "1".

  • author: Radoslaw Oldakowski <radol@gmx.de>
  • author: Daniel Westphal (http://www.d-westphal.de)
  • version: $Id: DbStore.html 443 2007-06-01 16:25:38Z cax $
  • access: public

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

Object
   |
   --DbStore
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 ($datasetName $datasetName)
object DatasetDb &getDatasetDb ($datasetId $datasetName)
object DbModel getModel (string $modelURI)
object NamedGraphMem getNamedGraphDb ($modelURI $modelURI, $graphName $graphName)
object DatasetDB &getNewDatasetDb ($datasetName $datasetName)
object DbModel getNewModel (string $modelURI, [string $baseURI = NULL])
object namedGraphDb getNewNamedGraphDb ($modelURI $modelURI, $graphName $graphName, [$baseURI $baseURI = NULL])
void isSetup ([string $databaseType = "MySQL"])
array listModels ()
boolean modelExists (string $modelURI)
boolean putModel (object Model &$model, [string $modelURI = NULL])
boolean removeNamedGraphDb ($modelURI $modelURI)
Methods
Constructor DbStore (line 51)

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 247)

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 87)

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.

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

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

  • throws: SqlError
  • access: public
boolean datasetExists ($datasetName $datasetName)
  • $datasetName $datasetName: string
getDatasetDb (line 614)

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 ($datasetId $datasetName)
  • $datasetId $datasetName: string
getModel (line 167)

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 635)

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 ($modelURI $modelURI, $graphName $graphName)
  • $modelURI $modelURI: string
  • $graphName $graphName: string
getNewDatasetDb (line 559)

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.

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

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.

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

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.

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

Checks if tables are setup for RAP

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

List all DbModels stored in the database.

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

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

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

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 693)

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.

  • throws: SqlError
  • access: public
boolean removeNamedGraphDb ($modelURI $modelURI)
  • $modelURI $modelURI: string

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Fri, 1 Jun 2007 16:48:52 +0200 by phpDocumentor 1.3.2