4Suite API Documentation

Module Ft.Rdf.Drivers.MetaKit

A persistent RDF model driver using MetaKit database files
MetaKit is an efficient embedded database library with a small footprint.
See http://www.equi4.com/metakit/

This driver originally donated by Alexander Smishlajev:
http://lists.fourthought.com/pipermail/4suite-dev/2002-August/000621.html
with copyright transferred to Fourthought.

Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Functions:
Globals:

Classes

class DbAdapter

Methods

__init__(self, name, modelName='default')
add(self, statements)
begin(self)
bind(self, object, name, scope)
commit(self)
complete(self, subject, predicate, object, statementUri, scope, flags)
contains(self, subject, predicate, object, statementUri, scope, flags)
has_key(self, name, scope)
isResource(self, res)
keys(self, scope)
lookup(self, name, scope)
mk_bound_view(self)
return the MetaKit view containing RDF bindings
mk_get_objects(self, view, indices)
return disctinct (object, otype) pairs from listed rows
Parameters:
    view - RDF Model (MetaKit view)
    indices - list of row indexes
Return value:
    list of unique (object, otype) pairs
mk_get_subjects(self, view, indices)
return disctinct subjects from listed rows
Parameters:
    view - RDF Model (MetaKit view)
    indices - list of row indexes
Return value:
    list of unique subjects
mk_select(self, statement, flags)
complete the statement; return MetaKit view
parameters:
    statement - 5-element sequence
        (subject, predicate, object, statementUri, scope)
    flags - dictionary with following recognized keys:
        "subjectFlags", "predicateFlags", "objectFlags",
        "statementUriFlags", "scopeFlags".
        dictionary values are any combination
        of IGNORE_CASE and REGEX
mk_statement_view(self)
return the MetaKit view containing RDF statements
mk_versa_list(self, view, sel_col, sel_val)
Versa query utility: return rownums for all sel_col in sel_val
Parameters:
    view - MetaKit view used for lookups.
    sel_col - name of the filter column.
        Lookup is performed on this column for values in sel_val
    sel_val - sequence of the lookup values.
        When sel_col value matches any value in sel_val,
        value from val_sel column is returned.
Return value:
    list of matching row numbers
objectsFromSubAndPreds(self, subject, predicates, scope=None)
Get a list of objects with the given predicates and subject
properties(self)
remove(self, statements)
removePattern(self, subject, predicate, object, statementUri, scope, flags)
require_transaction(self)
raise an exception if transaction was not opened
resources(self)
rollback(self)
size(self, scope)
subjectsFromPredAndObjs(self, predicate, objects, scope=None)
Get a list of subjects with the given predicate and objects
subjectsFromPredsAndObj(self, predicates, object, scope=None)
Get a list of subjects with the given predicates and object
unbind(self, name, scope)

Functions

CheckVersion(dbName)
CreateDb(dbName, modelName='default')
CreateFileName(dbName)
DestroyDb(dbName, modelName='default')
ExistsDb(dbName, 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.
dec = utf_8_decode(...)
dec_utf8 = lambda(s)
enc = utf_8_encode(...)
enc_utf8 = lambda(u)

Globals

BOUND_VIEW = 'ftrdf_%s_bound[name:S,object:B,scope:S]'
MODE_RW = 1
STATEMENT_ATTRS = ('subject', 'predicate', 'object', 'statementUri', 'scope')
STATEMENT_FLAGS = ['subjectFlags', 'predicateFlags', 'objectFlags', 'statementUriFlags', 'scopeFlags']
STATEMENT_VIEW = 'ftrdf_%s_statement[subject:S,predicate:S,object:S,statementUri:S,scope:S,otype:S]'
VERSION = '0.1'
VERSION_VIEW = 'ftrdf_version[version:S]'