Package rdflib :: Package store :: Package FOPLRelationalModel :: Module RelationalHash
[show private | hide private]
[frames | no frames]

Module rdflib.store.FOPLRelationalModel.RelationalHash

This module implements two hash tables for identifiers and values that facilitate maximal index lookups and minimal redundancy (since identifiers and values are stored once only and referred to by integer half-md5-hashes). The identifier hash uses the half-md5-hash (converted by base conversion to an integer) to key on the identifier's full lexical form (for partial matching by REGEX) and their term types. The use of a half-hash introduces a collision risk that is currently not accounted for. The volume at which the risk becomes significant is calculable, though through the 'birthday paradox'.

The value hash is keyed off the half-md5-hash (as an integer also) and stores the identifier's full lexical representation (for partial matching by REGEX)

These classes are meant to automate the creation, management, linking, insertion of these hashes (by SQL) automatically

see: http://en.wikipedia.org/wiki/Birthday_Paradox
Classes
IdentifierHash  
LiteralHash  
RelationalHash  

Function Summary
  GarbageCollectionQUERY(idHash, valueHash, aBoxPart, binRelPart, litPart)
Performs garbage collection on interned identifiers and their references.

Variable Summary
NoneType Any = None                                                                  
bool COLLISION_DETECTION = False
str CREATE_HASH_TABLE = '\nCREATE TABLE %s (\n    %s\n) ENGI...
str IDENTIFIER_GARBAGE_COLLECTION_SQL = 'CREATE TEMPORARY TA...
str PURGE_KEY_SQL = 'DELETE %s FROM %s INNER JOIN danglingId...
str VALUE_GARBAGE_COLLECTION_SQL = 'CREATE TEMPORARY TABLE d...

Function Details

GarbageCollectionQUERY(idHash, valueHash, aBoxPart, binRelPart, litPart)

Performs garbage collection on interned identifiers and their references. Joins the given KB parititions against the identifiers and values and removes the 'danglers'. This must be performed after every removal of an assertion and so becomes a primary bottleneck

Variable Details

Any

Type:
NoneType
Value:
None                                                                  

COLLISION_DETECTION

Type:
bool
Value:
False                                                                  

CREATE_HASH_TABLE

Type:
str
Value:
'''
CREATE TABLE %s (
    %s
) ENGINE=InnoDB;'''                                                    

IDENTIFIER_GARBAGE_COLLECTION_SQL

Type:
str
Value:
'CREATE TEMPORARY TABLE danglingIds SELECT %s.%s FROM %s %s where %s a\
nd %s.%s <> %s;'                                                       

PURGE_KEY_SQL

Type:
str
Value:
'DELETE %s FROM %s INNER JOIN danglingIds on danglingIds.%s = %s.%s;'  

VALUE_GARBAGE_COLLECTION_SQL

Type:
str
Value:
'CREATE TEMPORARY TABLE danglingIds SELECT %s.%s FROM %s %s where %s'  

Generated by Epydoc 2.1 on Mon Oct 23 14:11:24 2006 http://epydoc.sf.net