Home | Trees | Index | Help |
---|
Package sqltriples :: Module Store :: Class TripleStore |
|
A triple store whose contents are stored in an SQL-accessible database table.
Method Summary | |
---|---|
Initialise access to the store via the given 'adapter' and employing the given, optional 'context' URI, using a table with the given, optional 'table_name' ("triples" by default) and a sequence (for BNode generation) with the optional 'sequence_name' ("bnode" by default). | |
Add a triple using the information found in the given 'pattern'. | |
and_objects(self,
queries)
| |
and_predicates(self,
queries)
| |
and_subjects(self,
queries)
| |
and_triples(self,
queries)
| |
and_tuples(self,
queries,
pattern)
| |
Close the connection to the database system. | |
Commit the changes made to the triple store. | |
Return a list of contexts found in this store. | |
Return a count of the triples conforming to the given 'pattern'. | |
Drop the store's table and sequence. | |
Drop the index from certain columns. | |
Drop the BNode sequence. | |
Drop the triple store's table. | |
Return a copy of this store which uses the given 'context' to constrain operations on the stored triples. | |
has_triple(self,
pattern)
| |
Initialise the database by creating a table and a sequence. | |
Initialise an index for certain columns. | |
Initialise the BNode sequence. | |
Initialise the triple store's table. | |
intersect_objects(self,
queries)
| |
intersect_predicates(self,
queries)
| |
intersect_subjects(self,
queries)
| |
intersect_triples(self,
queries)
| |
intersect_tuples(self,
queries,
pattern)
| |
not_objects(self,
result)
| |
not_predicates(self,
result)
| |
not_subjects(self,
result)
| |
not_triples(self,
result)
| |
not_tuples(self,
result,
pattern)
| |
Return objects for the given 'subject' and/or 'predicate' identifiers. | |
or_objects(self,
queries)
| |
or_predicates(self,
queries)
| |
or_subjects(self,
queries)
| |
or_triples(self,
queries)
| |
or_tuples(self,
queries,
pattern)
| |
Return predicates for the given 'subject' and/or 'object' identifiers. | |
Remove all triples conforming to the given 'pattern'. | |
Removes the specified 'context' from the database. | |
Roll back (undo) the changes made to the triple store. | |
Return a Subject for the given 'subject' identifier. | |
Return subjects for the given 'predicate' and/or 'object' identifiers. | |
Return triples conforming to the given 'pattern'. | |
tuples(self,
pattern,
expression,
functions,
ordering,
order_by,
limit,
partial)
| |
Return the qualified column name for the given 'name' and optional 'index'. | |
Convert a 'value' into a Unicode object and a type code. | |
_findall(self,
s,
c)
| |
Return a BNode identifier using the database. | |
For the given 'value' and using the given 'column_name', add a condition to the given 'conditions' list and any associated values to the given 'values' list. | |
Return a query conditions list and a values list for the given 'pattern'. | |
Instantiate and return an object from the given 'value' and 'type_code'. | |
Return the appropriate parameter marker for the chosen database system. | |
Encode the given string 's' so that parameter markers are suitable for the chosen database system. | |
Present the given 'values' collection in the appropriate form for the chosen database system (either as a dictionary mapping parameter names to values, or as the provided collection of values). | |
Return the aliased table name for the given, optional 'index'. |
Class Variable Summary | |
---|---|
classobj |
BNode = sqltriples.Types.BNode |
dict |
codes_to_names = {None: 'URIRef', 'B': 'BNode', 'U': 'UR...
|
type |
Literal = sqltriples.Types.Literal |
dict |
names_to_codes = {'Literal': 'L', 'BNode': 'B', 'Namespa...
|
type |
Namespace = sqltriples.Types.Namespace |
str |
null_context = 'None'
|
Namespace |
TYPE = Namespace(u'http://www.w3.org/1999/02/22-rdf-synt...
|
type |
URIRef = sqltriples.Types.URIRef |
Method Details |
---|
__init__(self,
adapter,
context=None,
table_name=None,
sequence_name=None,
debug=0)
|
add(self, pattern)Add a triple using the information found in the given 'pattern'. |
close(self)Close the connection to the database system. |
commit(self)Commit the changes made to the triple store. |
contexts(self)Return a list of contexts found in this store. |
count(self, pattern=None, expression=None)Return a count of the triples conforming to the given 'pattern'. |
delete(self)Drop the store's table and sequence. |
delete_index(self)Drop the index from certain columns. |
delete_sequence(self)Drop the BNode sequence. |
delete_table(self)Drop the triple store's table. |
get_context(self, context)Return a copy of this store which uses the given 'context' to constrain operations on the stored triples. |
init(self)Initialise the database by creating a table and a sequence. |
init_index(self)Initialise an index for certain columns. |
init_sequence(self)Initialise the BNode sequence. |
init_table(self)Initialise the triple store's table. |
objects(self, subject=None, predicate=None, pattern=None, expression=None, functions=None, ordering=None, order_by=None, limit=None)Return objects for the given 'subject' and/or 'predicate' identifiers. Where the given 'functions' dictionary is specified, a function will be applied for all columns named as keys in that dictionary. For example, the following dictionary... {"object", "substr(_, 1, 4)"} ...results in the following function being applied in the underlying query: substr(object, 1, 4) Where the 'ordering' is specified (as either "asc" or "desc"), a query is produced which sorts the results according to retrieved objects. Where the 'order_by' qualifier can be used to choose whether the "subject" or the "object" will order the results. Where a 'limit' is specified (as an integer), the number of results will be limited to the stated amount. |
predicates(self, subject=None, object=None, pattern=None, expression=None, ordering=None, order_by=None, limit=None)Return predicates for the given 'subject' and/or 'object' identifiers. Where the 'ordering' is specified (as either "asc" or "desc"), a query is produced which sorts the results according to retrieved objects. Where the 'order_by' qualifier can be used to choose whether the "subject" or the "object" will order the results. Where a 'limit' is specified (as an integer), the number of results will be limited to the stated amount. |
remove(self, pattern)Remove all triples conforming to the given 'pattern'. |
remove_context(self, context)Removes the specified 'context' from the database. |
rollback(self)Roll back (undo) the changes made to the triple store. |
subject(self, subject)Return a Subject for the given 'subject' identifier. |
subjects(self, predicate=None, object=None, pattern=None, expression=None, ordering=None, order_by=None, limit=None)Return subjects for the given 'predicate' and/or 'object' identifiers. Where the 'ordering' is specified (as either "asc" or "desc"), a query is produced which sorts the results according to retrieved objects. Where the 'order_by' qualifier can be used to choose whether the "subject" or the "object" will order the results. Where a 'limit' is specified (as an integer), the number of results will be limited to the stated amount. |
triples(self, pattern=None, expression=None, functions=None, ordering=None, order_by=None, limit=None)Return triples conforming to the given 'pattern'. Where the given 'functions' dictionary is specified, a function will be applied for all columns named as keys in that dictionary. For example, the following dictionary... {"object", "substr(_, 1, 4)"} ...results in the following function being applied in the underlying query: substr(object, 1, 4) Where the 'ordering' is specified (as either "asc" or "desc"), a query is produced which sorts the results according to retrieved objects. Where the 'order_by' qualifier can be used to choose whether the "subject" or the "object" will order the results. Where a 'limit' is specified (as an integer), the number of results will be limited to the stated amount. |
_column(self, name, index=None)Return the qualified column name for the given 'name' and optional 'index'. If 'index' is not specified (or None), an unqualified name will be returned. |
_convert(self, value)Convert a 'value' into a Unicode object and a type code. |
_get_bnode_id(self)Return a BNode identifier using the database. |
_get_condition(self, value, column_name, conditions, values, index, new_index)For the given 'value' and using the given 'column_name', add a condition to the given 'conditions' list and any associated values to the given 'values' list. The specified 'index' is used to qualify table references. The specified 'value' can either be a single value tested for equality, a query describing some set of already selected results, more complicated expressions with accompanying literal values, or a list of single values comprising a set of possible matching values for the resulting query. Return the new table index, based on the given value of 'index'. |
_get_conditions(self, pattern, index=None, new_index=None)Return a query conditions list and a values list for the given 'pattern'. If the optional 'index' flag is specified (and set to a value other than None), the column names will be qualified with an appropriate table name. |
_instantiate(self, value, type_code)Instantiate and return an object from the given 'value' and 'type_code'. |
_pmark(self, i)Return the appropriate parameter marker for the chosen database system. |
_pmarks(self, s)Encode the given string 's' so that parameter markers are suitable for the chosen database system. |
_present(self, values)Present the given 'values' collection in the appropriate form for the chosen database system (either as a dictionary mapping parameter names to values, or as the provided collection of values). |
_table(self, index=None)Return the aliased table name for the given, optional 'index'. If 'index' is not specified (or None), a plain table name will be returned. |
Class Variable Details |
---|
codes_to_names
|
names_to_codes
|
null_context
|
TYPE
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Sep 18 23:34:28 2007 | http://epydoc.sf.net |