4Suite API Documentation

Module Ft.Rdf.Drivers.Rdflib

A persistent 4RDF model driver using more recent (development) rdflib store API
see:

- http://svn.rdflib.net/trunk/
- http://rdflib.net/store/
- http://rdflib.net/store/#ConjunctiveGraph
- http://rdflib.net/store/#Formula
- http://rdflib.net/Graph/

This is the first step in facilitating the move from 4rdf to rdlib:

see: http://lists.fourthought.com/pipermail/4suite-dev/2005-September/002021.html

For the most part, this is an interface mapping from Ft.Rdf.Model to the rdflib store API

Finally, it's also worth noting that rdflib does not support reification (the persistence of statement identity for reference).
The store interface provides a framework for persisting 'quoted'/'hypothetical' sets of statements (N3 formulae) which are somewhat analagous.

see: http://chatlogs.planetrdf.com/swig/2005-12-13.html#T16-40-05

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(RdflibAdapter)

Methods

__init__(self, g)
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)
objectsFromSubAndPreds(self, subject, predicates, scope)
Get a list of objects with the given predicates and subject
objectsFromSubsAndPred(self, subjects, predicate, scope)
Get a list of obejcts with the given predicate and subjects
objectsFromSubsAndPredNonDistinct(self, subjects, predicate, scope)
Get a list of *non-distinct* objects with the given predicate and subjects
remove(self, statements)
removePattern(self, subject, predicate, object_, statementUri, scope, flags)
resources(self, scope)
rollback(self)
size(self, scope)
subjectsFromPredAndObjs(self, predicate, objects, scope)
Get a list of resources with the given predicate and object
subjectsFromPredsAndObj(self, predicates, object_, scope)
unbind(self, name, scope)

Methods inherited from class RdflibAdapter

Members

properties = {1: True}
class RdflibAdapter

Methods

depthFirstGraphPurge(self, graph)
Recursively removes all formulae (QuotedGraphs) referenced within the given scope (named graph). This is particulary useful for clearing a top level graph which expresses a rule set - in which case, the antecendants and consequents are formulae which will contain quoted / hypothetical statements that must be erased recursively downward.
getGraph(self, scope=None, store=None)
hypothesize(self, scope)
This function 'converts' a set of quoted (hypothesized) N3 statements, reified via http://www.w3.org/2000/10/swap/reify# vocabulary, into a rdflib.Graph.QuotedGraph / Formula (http://rdflib.net/store/#Formula). It essentially ensures that hypothetical statements are distinct from asserted statements (in rdflib store implementations that support formulae partitioning). It also creates universally quantified rdflib.Variable instances for resources whose URIs begin with ? - ala Notation 3 syntax:
http://lists.w3.org/Archives/Public/public-cwm-talk/2005OctDec/0007.html

Note, the 4Suite RDF N3 / n3p parser reifies all quoted statements it comes across.

Functions

CreateDb(rdflib_params, closedWorld=None)
DestroyDb(rdflib_params, closedWorld=None)
ExistsDb(rdflib_params, closedWorld=None)
GetDb(rdflib_params, closedWorld=None)
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.
Unique(a)
Unique(a) -> ordered-set
Return a new set with any duplicates removed.
mapFtRdfStatements((subject, predicate, object_, statementUri, scope, otype), g, flags=None)
mapFtRdfTerm(ftTerm, notBNode=False)
mapRdfLibObject(obj)
mapRdfLibQuad((subject, predicate, object_, context))
readRdflibDbParameters(db_param)

Globals

BNODE_BASE = 'http://4suite.org/rdf/anonymous/'
OBJECT_TYPE_LITERAL = 'L'
OBJECT_TYPE_RESOURCE = 'R'
OBJECT_TYPE_UNKNOWN = '?'
VERSION = '1.0'