4Suite™ API Documentation

# ► Module Ft.Rdf.Drivers.MySQL

A persistent RDF model driver using MySQL with InnoDB
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: DbAdapter |  |  |  | Functions: BuildNonDistinctObjectsFromSubsAndPred, BuildObjectsFromSubAndPreds, BuildObjectsFromSubsAndPred, 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

BuildNonDistinctObjectsFromSubsAndPred(subjects, predicate, modelName, scope=None)
BuildObjectsFromSubAndPreds(subject, predicates, modelName, scope=None)
BuildObjectsFromSubsAndPred(subjects, predicate, 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 text,\n domain text) TYPE=InnoDB\n'
CREATE_STATEMENT_TABLE = '\nCREATE TABLE ftrdf_%s_statement (\n subject ... INDEX %s_stmt_d_index (domain(10))) TYPE=InnoDB'
INDICES = {'source': ('ftrdf_%s_statement', ['domain']), 'spo': ('ftrdf_%s_statement', ['subject', 'predicate', 'object'])}
OBJECT_TYPE_LITERAL = 'L'
OBJECT_TYPE_RESOURCE = 'R'
VERSION = '0.1'
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'"