Package rdflib :: Package store :: Module AbstractSQLStore :: Class AbstractSQLStore
[show private | hide private]
[frames | no frames]

Type AbstractSQLStore

SQLGenerator --+
               |
  object --+   |
           |   |
       Store --+
               |
              AbstractSQLStore


SQL-92 formula-aware implementation of an rdflib Store.
It stores it's triples in the following partitions:

- Asserted non rdf:type statements
- Asserted literal statements
- Asserted rdf:type statements (in a table which models Class membership)
The motivation for this partition is primarily query speed and scalability as most graphs will always have more rdf:type statements than others
- All Quoted statements

In addition it persists namespace mappings in a seperate table

Method Summary
  __init__(self, identifier, configuration)
identifier: URIRef of the Store.
  __len__(self, context)
Number of statements in the store.
  __repr__(self)
  add(self, (subject, predicate, obj), context, quoted)
Add a triple to the store of triples.
  addN(self, quads)
Adds each item in the list of statements to a specific context.
  bind(self, prefix, namespace)
  close(self, commit_pending_transaction)
FIXME: Add documentation!!
  commit(self)
  contexts(self, triple)
Generator over all contexts in the graph.
  namespace(self, prefix)
  namespaces(self)
  objects(self, subject, predicate)
A generator of objects with the given subject and predicate.
  predicate_objects(self, subject)
A generator of (predicate, object) tuples for the given subject
  prefix(self, namespace)
  remove(self, (subject, predicate, obj), context)
Remove a triple from the store
  rollback(self)
  subject_objects(self, predicate)
A generator of (subject, object) tuples for the given predicate
  subject_predicates(self, object)
A generator of (subject, predicate) tuples for the given object
  subjects(self, predicate, obj)
A generator of subjects with the given predicate and object.
  triples(self, (subject, predicate, obj), context)
A generator over all the triples matching pattern.
  triples_choices(self, (subject, predicate, object_), context)
A variant of triples that can take a list of terms instead of a single term in any slot.
  value(self, subject, predicate, object, default, any)
Get a value for a subject/predicate, predicate/object, or subject/object pair -- exactly one of subject, predicate, object must be None.
    Inherited from SQLGenerator
  buildClause(self, tableName, subject, predicate, obj, context, typeTable)
  buildContextClause(self, context, tableName)
  buildLitDTypeClause(self, obj, tableName)
  buildLiteralTripleSQLCommand(self, subject, predicate, obj, context, storeId)
  buildLitLanguageClause(self, obj, tableName)
  buildObjClause(self, obj, tableName)
  buildPredClause(self, predicate, tableName)
  buildSubjClause(self, subject, tableName)
  buildTripleSQLCommand(self, subject, predicate, obj, context, storeId, quoted)
  buildTypeClassClause(self, obj, tableName)
  buildTypeMemberClause(self, subject, tableName)
  buildTypeSQLCommand(self, member, klass, context, storeId)
  EscapeQuotes(self, qstr)
Ported from Ft.Lib.DbUtil
  executeSQL(self, cursor, qStr, params, paramList)
This takes the query string and parameters and (depending on the SQL implementation) either fill in the parameter in-place or pass it on to the Python DB impl (if it supports this).
  normalizeTerm(self, term)
    Inherited from Store
  create(self, configuration)
  destroy(self, configuration)
This destroys the instance of the store identified by the configuration string.
  gc(self)
Allows the store to perform any needed garbage collection
  open(self, configuration, create)
Opens the store specified by the configuration string.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
    Inherited from Store
  node_pickler

Class Variable Summary
bool autocommit_default = True
bool context_aware = True
bool formula_aware = True
int regex_matching = 1                                                                     
bool transaction_aware = True

Method Details

__init__(self, identifier=None, configuration=None)
(Constructor)

identifier: URIRef of the Store. Defaults to CWD configuration: string containing infomation open can use to connect to datastore.
Overrides:
rdflib.store.Store.__init__

__len__(self, context=None)
(Length operator)

Number of statements in the store.
Overrides:
rdflib.store.Store.__len__

add(self, (subject, predicate, obj), context=None, quoted=False)

Add a triple to the store of triples.
Overrides:
rdflib.store.Store.add

addN(self, quads)

Adds each item in the list of statements to a specific context. The quoted argument is interpreted by formula-aware stores to indicate this statement is quoted/hypothetical. Note that the default implementation is a redirect to add
Overrides:
rdflib.store.Store.addN (inherited documentation)

close(self, commit_pending_transaction=False)

FIXME: Add documentation!!
Overrides:
rdflib.store.Store.close

contexts(self, triple=None)

Generator over all contexts in the graph. If triple is specified, a generator over all contexts the triple is in.
Overrides:
rdflib.store.Store.contexts (inherited documentation)

objects(self, subject=None, predicate=None)

A generator of objects with the given subject and predicate.

predicate_objects(self, subject=None)

A generator of (predicate, object) tuples for the given subject

remove(self, (subject, predicate, obj), context)

Remove a triple from the store
Overrides:
rdflib.store.Store.remove

subject_objects(self, predicate=None)

A generator of (subject, object) tuples for the given predicate

subject_predicates(self, object=None)

A generator of (subject, predicate) tuples for the given object

subjects(self, predicate=None, obj=None)

A generator of subjects with the given predicate and object.

triples(self, (subject, predicate, obj), context=None)

A generator over all the triples matching pattern. Pattern can be any objects for comparing against nodes in the store, for example, RegExLiteral, Date? DateRange?

quoted table: <id>_quoted_statements asserted rdf:type table: <id>_type_statements asserted non rdf:type table: <id>_asserted_statements

triple columns: subject,predicate,object,context,termComb,objLanguage,objDatatype class membership columns: member,klass,context termComb

FIXME: These union all selects *may* be further optimized by joins
Overrides:
rdflib.store.Store.triples

triples_choices(self, (subject, predicate, object_), context=None)

A variant of triples that can take a list of terms instead of a single term in any slot. Stores can implement this to optimize the response time from the import default 'fallback' implementation, which will iterate over each term in the list and dispatch to tripless
Overrides:
rdflib.store.Store.triples_choices

value(self, subject, predicate=u'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', object=None, default=None, any=False)

Get a value for a subject/predicate, predicate/object, or
subject/object pair -- exactly one of subject, predicate,
object must be None. Useful if one knows that there may only
be one value.

It is one of those situations that occur a lot, hence this
'macro' like utility

Parameters:
-----------
subject, predicate, object  -- exactly one must be None
default -- value to be returned if no values found
any -- if True:
         return any value in the case there is more than one
       else:
         raise UniquenessError

Class Variable Details

autocommit_default

Type:
bool
Value:
True                                                                   

context_aware

Type:
bool
Value:
True                                                                   

formula_aware

Type:
bool
Value:
True                                                                   

regex_matching

Type:
int
Value:
1                                                                     

transaction_aware

Type:
bool
Value:
True                                                                   

Generated by Epydoc 2.1 on Wed Apr 4 16:05:45 2007 http://epydoc.sf.net