Package WebOrganiser :: Module RDFAccess :: Class Store
[show private | hide private]
[frames | no frames]

Class Store


A convenience wrapper around RDF stores.

Method Summary
  __init__(self, store, handlers, base_uri)
Initialise with the given underlying 'store', a 'handlers' collection, and an optional 'base_uri' which can be used to qualify URI references.
  add_item(self, item, item_type_name, doc)
Add an 'item' having the given 'item_type_name' to the store, using the definition document 'doc'.
  close(self)
Close the underlying store.
  combine_items(self, results)
Combine the 'results', returning a collection of items.
  commit(self)
Commit changes to the underlying store if appropriate.
  contexts(self)
Return a list of contexts found in this store.
  fill_element(self, doc, element, items, element_name)
Within the given document 'doc', inside the given 'element', insert the top-level details of the given 'items'.
  fill_element_properties(self, doc, elements, property_type, property_value, labels)
  fill_element_serialised(self, doc, element, items, qualifier)
Within the given document 'doc', inside the given 'element', insert the XML serialisation of each item in the supplied 'items'.
  get_comparison(self, comparison, values)
Return a comparison expression for the given 'comparison' and 'values', suitable for triple stores which support querying.
  get_context(self, context)
Return a copy of this store which uses the given 'context' to constrain operations on the stored triples.
  get_date_from_attributes(self, **attributes)
Return the date string for the given 'attributes'.
  get_handler(self, item)
Return the handler suitable for processing the given 'item'.
  get_handler_for_item_type_name(self, item_type_name)
Return the handler capable of processing items having the given 'item_type_name'.
  get_identifier_from_item(self, item)
Return an identifier built from the given 'item'.
  get_identifier_from_item_type(self, item_type)
  get_item_from_identifier(self, identifier)
Return an item built from the given 'identifier'.
  get_item_from_reference(self, reference)
Similar to get_item_from_identifer, but with a narrower range of types, return an item for the given 'reference' according to the following mapping: BNode starts with _ URIRef all other symbols NOTE: This is dependent on referenced items being defined by/under BNode NOTE: objects, but this is probably going to be phased out.
  get_item_type(self, item)
Return the type of the given 'item'.
  get_item_types_from_identifiers(self, values)
  get_items_using_attributes(self, attributes)
To query the store, prepare filters, taking information from the given 'attributes' and adding the default item types where appropriate, and return a list of items.
  get_label(self, uriref)
Return a label for a (typically) type-based 'uriref'.
  get_predicates_for_attribute(self, attribute)
Query the handlers and return a tuple of predicates which can represent the given 'attribute'.
  get_prefix(self, uriref, label)
Return the prefix for the 'uriref' minus the 'label'.
  get_property_types_for_uriref(self, uriref)
Query the handlers and return the abstract property types which the given 'uriref' can represent.
  get_selected_items(self, values)
Return a list of items found using the given 'values': a list of unique identifiers each corresponding to an item.
  get_supported_item_types(self)
Return a list of all item types supported by the handlers.
  get_uriref(self, item)
Return the given 'item' as a URIRef or None if the 'item' is not of a compatible/equivalent nature.
  get_urirefs_for_attribute(self, attribute)
Query the handlers and return lists of URIRefs which can represent the given 'attribute'.
  get_urirefs_for_item_type(self, item_type_name)
Query the handlers and return a list of URIRefs which can represent the given 'item_type_name'.
  get_urirefs_for_property_type(self, property_type_name)
Query the handlers and return URIRefs which can represent the given 'property_type_name'.
  get_urirefs_from_identifier(self, identifier)
Return a list of URIRef objects corresponding to the given property type 'identifier' or None if any URIRef objects should correspond (when 'identifier' is specified as None).
  get_values_from_identifier(self, property_type, value)
  get_values_using_predicates(self, predicates, value)
  has_item(self, item)
Return whether the store contains the given 'item'.
  parse_item(self, stream, item_type_name, uriref)
From the given 'stream', parse an item having the given 'item_type_name' and bearing the given 'uriref'.
  remove_context(self, context)
Removes the specified 'context' from the database.
  remove_item(self, item, deep)
Remove the given 'item' from the store.
  rollback(self)
Roll back changes to the underlying store if appropriate.
  serialise_item(self, item, stream, *args, **kw)
Serialise the given 'item' to the given 'stream', specifying additional arguments to control the serialisation process.

Class Variable Summary
type DuplicateResourceError = WebOrganiser.RDFAccess.DuplicateResourceError

Method Details

__init__(self, store, handlers, base_uri='/')
(Constructor)

Initialise with the given underlying 'store', a 'handlers' collection,
and an optional 'base_uri' which can be used to qualify URI references.

add_item(self, item, item_type_name, doc)

Add an 'item' having the given 'item_type_name' to the store, using the
definition document 'doc'. If 'item' is None, a new item will be added
to the store.

close(self)

Close the underlying store.

combine_items(self, results)

Combine the 'results', returning a collection of items.

commit(self)

Commit changes to the underlying store if appropriate.

contexts(self)

Return a list of contexts found in this store.

fill_element(self, doc, element, items, element_name='item')

Within the given document 'doc', inside the given 'element', insert the
top-level details of the given 'items'. Each item will be represented by
an element of the optional 'element_name' (or the default name, "item").

The fill_element method provides item summaries, more appropriate for
list views. Typically, each item will look something like this:

<item item-value="..." item-type="...">
  <prop1 attrA="..."/>
  <prop2 attrB="..."/>
</item>

fill_element_serialised(self, doc, element, items, qualifier=None)

Within the given document 'doc', inside the given 'element', insert the
XML serialisation of each item in the supplied 'items'.

The fill_element_serialised method provides an accurate rendition of
each item in RDFCalendar's XML format.

get_comparison(self, comparison, values)

Return a comparison expression for the given 'comparison' and 'values',
suitable for triple stores which support querying.

get_context(self, context)

Return a copy of this store which uses the given 'context' to constrain
operations on the stored triples.

get_date_from_attributes(self, **attributes)

Return the date string for the given 'attributes'.

get_handler(self, item)

Return the handler suitable for processing the given 'item'.

get_handler_for_item_type_name(self, item_type_name)

Return the handler capable of processing items having the given
'item_type_name'.

get_identifier_from_item(self, item)

Return an identifier built from the given 'item'. Here, we distinguish
between BNode, URIRef within the store, and other URIRef items as
follows:

BNode                               starts with _
URIRef within base URI for store    unprefixed (remove the base URI)
URIRef                              starts with -

get_item_from_identifier(self, identifier)

Return an item built from the given 'identifier'. Here, we distinguish
between BNode, URIRef within the store, and other URIRef items as
follows:

BNode                               starts with _
URIRef within base URI for store    unprefixed (add the base URI)
URIRef                              starts with -

get_item_from_reference(self, reference)

Similar to get_item_from_identifer, but with a narrower range of types,
return an item for the given 'reference' according to the following
mapping:

BNode                               starts with _
URIRef                              all other symbols

NOTE: This is dependent on referenced items being defined by/under BNode
NOTE: objects, but this is probably going to be phased out.

get_item_type(self, item)

Return the type of the given 'item'.

get_items_using_attributes(self, attributes)

To query the store, prepare filters, taking information from the given
'attributes' and adding the default item types where appropriate, and
return a list of items.

Supported attributes:

filter-item-value, filter-type
search-value, search-type, search-operation
(attributes supported by get_date_from_attributes)

get_label(self, uriref)

Return a label for a (typically) type-based 'uriref'.

get_predicates_for_attribute(self, attribute)

Query the handlers and return a tuple of predicates which can represent
the given 'attribute'.

get_prefix(self, uriref, label)

Return the prefix for the 'uriref' minus the 'label'.

get_property_types_for_uriref(self, uriref)

Query the handlers and return the abstract property types which the
given 'uriref' can represent.

get_selected_items(self, values)

Return a list of items found using the given 'values': a list of unique
identifiers each corresponding to an item.

get_supported_item_types(self)

Return a list of all item types supported by the handlers.

get_uriref(self, item)

Return the given 'item' as a URIRef or None if the 'item' is not of a
compatible/equivalent nature.

get_urirefs_for_attribute(self, attribute)

Query the handlers and return lists of URIRefs which can represent the
given 'attribute'.

get_urirefs_for_item_type(self, item_type_name)

Query the handlers and return a list of URIRefs which can represent the
given 'item_type_name'.

get_urirefs_for_property_type(self, property_type_name)

Query the handlers and return URIRefs which can represent the given
'property_type_name'.

get_urirefs_from_identifier(self, identifier)

Return a list of URIRef objects corresponding to the given property type
'identifier' or None if any URIRef objects should correspond (when
'identifier' is specified as None).

has_item(self, item)

Return whether the store contains the given 'item'.

parse_item(self, stream, item_type_name, uriref=None)

From the given 'stream', parse an item having the given 'item_type_name'
and bearing the given 'uriref'.

remove_context(self, context)

Removes the specified 'context' from the database.

remove_item(self, item, deep=0)

Remove the given 'item' from the store.

rollback(self)

Roll back changes to the underlying store if appropriate.

serialise_item(self, item, stream, *args, **kw)

Serialise the given 'item' to the given 'stream', specifying additional
arguments to control the serialisation process.

Generated by Epydoc 2.1 on Wed Sep 19 00:05:14 2007 http://epydoc.sf.net