Package rdflib :: Package sparql :: Module sparqlGraph :: Class Container
[show private | hide private]
[frames | no frames]

Class Container

Known Subclasses:
Alt, Bag, Seq

Wrapper around an RDF Container resource.

This class is not really used by itself, rather through its subclasses: Seq, Bag, or Alt.
Method Summary
  __init__(self, triplets, resource)
The triplets is of type myTripleStore, the resource is simply the resource which is supposed to be a Seq.
  __getitem__(self, index)
Obvious getitem using the sorted keys.
  __iter__(self)
returns self!
  __len__(self)
  addItem(self, res)
Add a new resource to the list (as the last element).
  next(self)
Obvious iteration through the content using the sorted keys.

Instance Variable Summary
BNode resource: the RDFLib resource for the Container
myTripleStore triplets: the triple for the container instance

Method Details

__init__(self, triplets, resource)
(Constructor)

The triplets is of type myTripleStore, the resource is simply the resource which is supposed to be a Seq.

The 'target' resources are initially collected in a dictionary, keyed with the predicate names. The of keys is stored apart, and the iteration/getitem goes through the keys set to retrieve the dictionary content.
Parameters:
triplets - the triplets for the triple store
           (type=myTripleStore)
resource - an (RDFLib) resource, ie, the Seq, Alt, or Bag. Note that the init does not check whether this is a Seq, this is done by whoever creates this instance!

__getitem__(self, index)
(Indexing operator)

Obvious getitem using the sorted keys.

__iter__(self)

returns self!

addItem(self, res)

Add a new resource to the list (as the last element).
Parameters:
res - an RDFLib resource (BNode, URIRef, or Literal)

next(self)

Obvious iteration through the content using the sorted keys.
Raises:
StopIteration - when the end of the sequence has been reached

Instance Variable Details

resource

the RDFLib resource for the Container
Type:
BNode

triplets

the triple for the container instance
Type:
myTripleStore

Generated by Epydoc 2.1 on Wed Jun 29 09:50:16 2005 http://epydoc.sf.net