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
| Function Summary |
| |
GarbageCollectionQUERY(idHash,
valueHash,
aBoxPart,
binRelPart,
litPart)
Performs garbage collection on interned identifiers and their
references. |
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
-
|
Any
-
- Type:
-
NoneType
- Value:
|
COLLISION_DETECTION
-
- Type:
-
bool
- Value:
|
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'
|
|