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

Class Seq

Container --+
            |
           Seq


The keys, inherited from Container, are sorted both when the class is created and when a new item is added. That ensures the right order in getting the data, as required by the semantics of rdf:Seq.
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.
  addItem(self, res)
Add a new resource to the list (as the last element).
    Inherited from Container
  __getitem__(self, index)
Obvious getitem using the sorted keys.
  __iter__(self)
returns self!
  __len__(self)
  next(self)
Obvious iteration through the content using the sorted keys.

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

Class Variable Summary
    Inherited from Container
int _index = 0                                                                     
list _keys = []
dict _list = {}

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 sorted list of keys is stored apart, and the iteration/getitem goes through the sorted key set to retrieve the dictionary content.
Parameters:
triplets - the triplets for the triple store
           (type=myTripleStore)
resource - an (RDFLib) resource, ie, the Seq. Note that the init does not check whether this is a Seq, this is done by whoever creates this instance!
Overrides:
rdflib.sparql.sparqlGraph.Container.__init__

addItem(self, res)

Add a new resource to the list (as the last element).
Parameters:
res - an RDFLib resource (BNode, URIRef, or Literal)
Overrides:
rdflib.sparql.sparqlGraph.Container.addItem (inherited documentation)

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