| Home | Trees | Index | Help |
|---|
| Package rdflib :: Package store :: Package FOPLRelationalModel :: Module BinaryRelationPartition |
|
The set of classes used to model the 3 'partitions' for N3 assertions. There is a top level class which implements operations common to all partitions as well as a class for each partition. These classes are meant to allow the underlying SQL schema to be completely configurable as well as to automate the generation of SQL queries for adding,updating,removing,resolving triples from the partitions. These classes work in tandem with the RelationHashes to automate all (or most) of the SQL processing associated with this FOPL Relational Model
NOTE: The use of foreign keys (which - unfortunately - bumps the minimum MySQL version to 5.0) allows for the efficient removal of all statements about a particular resource using cascade on delete (currently not used)
see: http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-foreign-keys.html| Classes | |
|---|---|
AssociativeBox |
The partition associated with assertions of class membership (formally known - in Description Logics - as an Associative Box) This partition is for all assertions where the property is rdf:type see: http://en.wikipedia.org/wiki/Description_Logic#Modelling_in_Description_Logics |
BinaryRelationPartition |
The common ancestor of the three partitions for assertions. |
NamedBinaryRelations |
Partition associated with assertions where the predicate isn't rdf:type and the object isn't a literal |
NamedLiteralProperties |
The partition associated with assertions where the object is a Literal. |
| Function Summary | |
|---|---|
This function takes a quad pattern (where any term is one of: URIRef,BNode,Literal,None,or REGEXTerm) ,a list of 3 live partitions and returns a list of only those partitions that need to be searched in order to resolve the pattern. | |
This function implements query pattern resolution against a list of partition objects and 3 parameters specifying whether to sort the result set (in order to group identical triples by the contexts in which they appear), whether to fetch the entire result set or one at a time, and whether to fetch the matching contexts only or the assertions. | |
| Variable Summary | |
|---|---|
NoneType |
Any = None |
list |
ANY_TERM = ['U', 'B', 'F', 'V', 'L']
|
list |
ASSOCIATIVE_BOX_CLASSES = ['U']
|
dict |
BRPQueryDecisionMap = {'U_RNTR': (<class 'rdflib.store.F...
|
list |
CLASS_TERMS = ['U', 'B', 'V']
|
str |
CONTEXT_COLUMN = 'context'
|
list |
CONTEXT_TERMS = ['U', 'B', 'F']
|
str |
CREATE_BRP_TABLE = '\nCREATE TABLE %s (\n %s\n) ENGIN...
|
str |
CREATE_RESULT_TABLE = "\nCREATE TEMPORARY TABLE result (...
|
str |
CROSS_BRP_QUERY_SQL = 'SELECT DISTINCT %s FROM %s %s WHE...
|
str |
CROSS_BRP_RESULT_QUERY_SQL = 'SELECT * FROM result ORDER...
|
str |
DROP_RESULT_TABLE_SQL = 'DROP result'
|
list |
GROUND_IDENTIFIERS = ['U']
|
list |
IDENTIFIER_TERMS = ['U', 'B']
|
str |
LOOKUP_INTERSECTION_SQL = 'INNER JOIN %s %s ON (%s)'
|
str |
LOOKUP_UNION_SQL = 'LEFT JOIN %s %s ON (%s)'
|
list |
NAMED_BINARY_RELATION_OBJECTS = ['U', 'B', 'L']
|
list |
NAMED_BINARY_RELATION_PREDICATES = ['U']
|
list |
NAMED_LITERAL_OBJECTS = ['L']
|
list |
NAMED_LITERAL_PREDICATES = ['U']
|
list |
NON_LITERALS = ['U', 'B', 'F', 'V']
|
list |
PREDICATE_NAMES = ['U', 'V']
|
| Function Details |
|---|
BinaryRelationPartitionCoverage((subject, predicate, object_, context), BRPs)This function takes a quad pattern (where any term is one of: URIRef,BNode,Literal,None,or REGEXTerm) ,a list of 3 live partitions and returns a list of only those partitions that need to be searched in order to resolve the pattern. This function relies on the BRPQueryDecisionMap dictionary to determine which partitions to use. Note that the dictionary as it is currently constituted requres that REGEXTerms in the object slot require that *both* the binary relation partition and the literal properties partitions are searched when this search could be limited to the literal properties only (for more efficient REGEX evaluation of literal values). Given the nature of the REGEX function in SPARQL and the way Versa matches by REGEX, this seperation couldn't be done |
PatternResolution(quad, cursor, BRPs, orderByTriple=True, fetchall=True, fetchContexts=False)This function implements query pattern resolution against a list of partition objects and 3 parameters specifying whether to sort the result set (in order to group identical triples by the contexts in which they appear), whether to fetch the entire result set or one at a time, and whether to fetch the matching contexts only or the assertions. This function uses BinaryRelationPartitionCoverage to whittle out the partitions that don't need to be searched, generateHashIntersections / generateWhereClause to generate the SQL query and the parameter fill-ins and creates a single UNION query against the relevant partitions. Note the use of UNION syntax requires that the literal properties partition is first (since it uses the first select to determine the column types for the resulting rows from the subsequent SELECT queries) see: http://dev.mysql.com/doc/refman/5.0/en/union.html |
| Variable Details |
|---|
Any
|
ANY_TERM
|
ASSOCIATIVE_BOX_CLASSES
|
CLASS_TERMS
|
CONTEXT_COLUMN
|
CONTEXT_TERMS
|
CREATE_BRP_TABLE
|
CREATE_RESULT_TABLE
|
CROSS_BRP_QUERY_SQL
|
CROSS_BRP_RESULT_QUERY_SQL
|
DROP_RESULT_TABLE_SQL
|
GROUND_IDENTIFIERS
|
IDENTIFIER_TERMS
|
LOOKUP_INTERSECTION_SQL
|
LOOKUP_UNION_SQL
|
NAMED_BINARY_RELATION_OBJECTS
|
NAMED_BINARY_RELATION_PREDICATES
|
NAMED_LITERAL_OBJECTS
|
NAMED_LITERAL_PREDICATES
|
NON_LITERALS
|
PREDICATE_NAMES
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Wed Apr 4 16:05:47 2007 | http://epydoc.sf.net |