4Suite™ API Documentation

# ► Module Ft.Rdf.Drivers.Postgres

A persistent RDF model driver using the PygreSQL adapter to PostgreSQL
See http://www.postgresql.org/
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: DbAdapter |  |  |  | Functions: BuildObjectsFromSubAndPreds, BuildSubjectsFromPredAndObjs, BuildSubjectsFromPredsAndObj, CheckVersion, CreateDb, DestroyDb, ExistsDb, GetDb, InitializeModule, SplitDbConnectString |  |  |  | Fields: CREATE_BOUND_TABLE, CREATE_STATEMENT_TABLE, INDICES, OBJECT_TYPE_LITERAL, OBJECT_TYPE_RESOURCE, VERSION, bits, complete, contains, key, parts, remove, where

## Classes

class DbAdapter(Ft.Rdf.Drivers.SQL.SqlAdapter)

### Methods

__init__(self, connString, modelName='default', db=None)
begin(self)
commit(self)
rollback(self)

### Methods inherited from class Ft.Rdf.Drivers.SQL.SqlAdapter

add, bind, complete, contains, has_key, isResource, keys, lookup, objectsFromSubAndPreds, objectsFromSubsAndPred, objectsFromSubsAndPredNonDistinct, remove, removePattern, resources, size, subjectsFromPredAndObjs, subjectsFromPredsAndObj, unbind

## Functions

BuildObjectsFromSubAndPreds(subject, predicates, modelName, scope=None)
BuildSubjectsFromPredAndObjs(predicate, objects, modelName, scope=None)
BuildSubjectsFromPredsAndObj(predicates, object, modelName, scope=None)
CheckVersion(db, connString, modelName)
CreateDb(connString, modelName='default')
DestroyDb(connString, modelName='default')
ExistsDb(connString, modelName='default')
GetDb(dbName, modelName='default')
InitializeModule()
Post-import hook to initialize module's runtime variables that are not required at import time, but will be needed before the module-level functions are called.
SplitDbConnectString(connString)

## Fields

CREATE_BOUND_TABLE = '\nCREATE TABLE ftrdf_%s_bound (\n name text,\n object varchar,\n domain text)\n'
CREATE_STATEMENT_TABLE = '\nCREATE TABLE ftrdf_%s_statement (\n subject ...\n domain text,\n otype text)\n'
INDICES = {'source': ('ftrdf_%s_statement', ['domain']), 'sp': ('ftrdf_%s_statement', ['subject', 'predicate'])}
OBJECT_TYPE_LITERAL = 'L'
OBJECT_TYPE_RESOURCE = 'R'
VERSION = '0.2'
bits = 31
complete = "SELECT subject, predicate, object, statementUri,...(statementUri)s' AND domain%(scopeOp)s'%(scope)s'"
contains = "SELECT COUNT(subject) FROM ftrdf_%(modelName)s_s...(statementUri)s' AND domain%(scopeOp)s'%(scope)s'"
key = (True, True, True, True, 1)
parts = ["subject%(subjectOp)s'%(subject)s'", "predicate%(predicateOp)s'%(predicate)s'", "object%(objectOp)s'%(object)s'", "statementUri%(statementUriOp)s'%(statementUri)s'", "domain%(scopeOp)s'%(scope)s'"]
remove = "DELETE FROM ftrdf_%(modelName)s_statement WHERE...(statementUri)s' AND domain%(scopeOp)s'%(scope)s'"
where = "subject%(subjectOp)s'%(subject)s' AND predicate%...(statementUri)s' AND domain%(scopeOp)s'%(scope)s'"