Package ccrdf :: Module rdfdict :: Class rdfDict
[show private | hide private]
[frames | no frames]

Class rdfDict

Known Subclasses:
ccLicense, ccWork

Provides a dictionary-like wrapper around a set of RDF triples with a common subject. In addition to the standard dictionary interface provides convenience methods for manipulating the triples.
Method Summary
  __init__(self, subject, rdfStore)
Creates a new rdfDict given the particular subject and an optional TripleStore (rdfStore).
  __contains__(self, key)
Returns true if the given key appears as a predicate of the subject.
  __delitem__(self, key)
Removes all items with the given key.
  __getitem__(self, key)
Return the object described in RDF with a subject of self.subject and a predicate of key.
  __iter__(self)
Returns an iterator over the unique keys (predicates) for the given subject.
  __len__(self)
Returns the number of predicate-object pairs associated with the subject self.subject.
  __setitem__(self, key, value)
Adds an RDF triple of the values (self.subject, key, value); any objects with the same subject/predicate are replaced.
  __str__(self)
Return the string representation of this instance using an algorithm inspired by the Dublic Core dumb-down method.
  about(self)
Return the subject used to create the instance (usually equivalent to rdf:about.
  add(self, key, value)
Adds an RDF triple consisting of the subject, key and value.
  addAll(self, key, values)
Adds the list of objects in values with the same subject and predicate.
  getAll(self, key)
Returns a list of objects which have a predicate of key.
  getFirst(self, key)
Returns the first object having the predicate key.
  iterkeys(self)
Returns an iterator over the unique keys (predicates) for the given subject.
  remove(self, key, value)
Removes a specific key-value pair.
  __getvalues(self, key)
Returns a list of values for a particular key; coerces BNodes to rdfDicts and mangles Literals with language attributes (if available).

Method Details

__init__(self, subject, rdfStore=None)
(Constructor)

Creates a new rdfDict given the particular subject and an optional TripleStore (rdfStore). If no TripleStore is provided, creates a new one.

__contains__(self, key)
(In operator)

Returns true if the given key appears as a predicate of the subject.

__delitem__(self, key)
(Index deletion operator)

Removes all items with the given key.

__getitem__(self, key)
(Indexing operator)

Return the object described in RDF with a subject of self.subject and a predicate of key. If more than one match is found, raises an AmbiguousKeyError.

__iter__(self)

Returns an iterator over the unique keys (predicates) for the given subject.

__len__(self)
(Length operator)

Returns the number of predicate-object pairs associated with the subject self.subject.

__setitem__(self, key, value)
(Index assignment operator)

Adds an RDF triple of the values (self.subject, key, value); any objects with the same subject/predicate are replaced.

__str__(self)
(Informal representation operator)

Return the string representation of this instance using an algorithm inspired by the Dublic Core dumb-down method.

about(self)

Return the subject used to create the instance (usually equivalent to rdf:about.

add(self, key, value)

Adds an RDF triple consisting of the subject, key and value.

addAll(self, key, values)

Adds the list of objects in values with the same subject and predicate.

getAll(self, key)

Returns a list of objects which have a predicate of key. The list may be empty or contain only a single element.

getFirst(self, key)

Returns the first object having the predicate key. If no match is found returns None.

iterkeys(self)

Returns an iterator over the unique keys (predicates) for the given subject.

remove(self, key, value)

Removes a specific key-value pair.

__getvalues(self, key)

Returns a list of values for a particular key; coerces BNodes to rdfDicts and mangles Literals with language attributes (if available).

Generated by Epydoc 2.1 on Mon Jul 10 17:08:26 2006 http://epydoc.sf.net