| Home | Trees | Index | Help |
|---|
| Package rdflib :: Package store :: Package FOPLRelationalModel :: Module BinaryRelationPartition :: Class BinaryRelationPartition |
|
object --+
|
BinaryRelationPartition
AssociativeBox,
NamedBinaryRelations,
NamedLiteralProperties
The common ancestor of the three partitions for assertions.
Implements behavior common to all 3. Each subclass is expected to define the following:
nameSuffix - The suffix appended to the name of the table
termEnumerations - a 4 item list (for each quad 'slot') of lists (or None) which enumerate the allowable term types
for each quad slot (one of 'U' - URIs,'V' - Variable,'L' - Literals,'B' - BNodes,'F' - Formulae)
columnNames - a list of column names for each quad slot (can be of additional length where each item is a 3-item tuple of:
column name, column type, index)
columnIntersectionList - a list of 2 item tuples (the quad index and a boolean indicating whether or not the associated term is an identifier)
this list (the order of which is very important) is used for generating intersections between the partition and the identifier / value hash
hardCodedResultFields - a dictionary mapping quad slot indices to their hardcoded value (for partitions - such as ABOX - which have a hardcoded value for a particular quad slot)
hardCodedResultTermsTypes - a dictionary mapping quad slot indices to their hardcoded term type (for partitions - such as Literal properties - which have hardcoded values for a particular quad slot's term type)
| Method Summary | |
|---|---|
__init__(self,
identifier,
idHash,
valueHash)
| |
__repr__(self)
| |
Generates a CREATE TABLE statement which creates a SQL table used for persisting assertions associated with this partition | |
Adds the pending identifiers / values and assertions (using executemany for maximum efficiency), and resets the queue. | |
Generates foreign key expression relating a particular quad term with the identifier hash | |
Generates the SQL JOINS (INNER and LEFT) used to intersect the identifier and value hashes with this partition. | |
Takes a query pattern (a list of quad terms - subject,predicate,object,context) and generates a SQL WHERE clauses which works in conjunction to the intersections to filter the result set by partial matching (by REGEX), full matching (by integer half-hash), and term types. | |
IndexManagementSQL(self,
create)
| |
Takes a list of QuadSlot objects and queues the new identifiers / values to insert and the assertions as well (so they can be added in a batch for maximum efficiency) | |
Generates a SQL command with parameter references (%s) in order to facilitate efficient batch insertion of multiple assertions by Python DB implementations (such as MySQLdb) | |
Generates a list of column aliases for the SELECT SQL command used in order to fetch contexts from each partition | |
Returns a list of column aliases for the SELECT SQL command used to fetch quads from a partition | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Class Variable Summary | |
|---|---|
str |
assertedColumnName = 'asserted'
|
str |
indexSuffix = 'Index'
|
| Method Details |
|---|
createSQL(self)Generates a CREATE TABLE statement which creates a SQL table used for persisting assertions associated with this partition |
flushInsertions(self, db)Adds the pending identifiers / values and assertions (using executemany for maximum efficiency), and resets the queue. |
foreignKeySQL(self, slot)Generates foreign key expression relating a particular quad term with the identifier hash |
generateHashIntersections(self)Generates the SQL JOINS (INNER and LEFT) used to intersect the identifier and value hashes with this partition. This relies on each parition setting up an ordered list of intersections (ordered with optimization in mind). For instance the ABOX partition would want to intersect on classes first (since this will have a lower cardinality than any other field) wherease the Literal Properties partition would want to intersect on datatypes first. The paritions and hashes are joined on the integer half-MD5-hash of the URI (or literal) as well as the 'Term Type' |
generateWhereClause(self, queryPattern)Takes a query pattern (a list of quad terms - subject,predicate,object,context) and generates a SQL WHERE clauses which works in conjunction to the intersections to filter the result set by partial matching (by REGEX), full matching (by integer half-hash), and term types. For maximally efficient SELECT queries |
insertRelations(self, quadSlots)Takes a list of QuadSlot objects and queues the new identifiers / values to insert and the assertions as well (so they can be added in a batch for maximum efficiency) |
insertRelationsSQLCMD(self)Generates a SQL command with parameter references (%s) in order to facilitate efficient batch insertion of multiple assertions by Python DB implementations (such as MySQLdb) |
selectContextFields(self, first)Generates a list of column aliases for the SELECT SQL command used in order to fetch contexts from each partition |
selectFields(self, first=False)Returns a list of column aliases for the SELECT SQL command used to fetch quads from a partition |
| Class Variable Details |
|---|
assertedColumnName
|
indexSuffix
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Mon Oct 23 14:11:25 2006 | http://epydoc.sf.net |