Package rdfalchemy :: Module rdfSubject' :: Class rdfSubject
[hide private]
[frames] | no frames]

Class rdfSubject

source code

object --+
         |
        rdfSubject
Known Subclasses:

Instance Methods [hide private]
 
__cmp__(self, other) source code
 
__delitem__(self, pred) source code
 
__getitem__(self, pred) source code
 
__hash__(self)
hash(x)
source code
 
__init__(self, resUri=None, **kwargs)
The constructor tries hard to do return you an rdfSubject
source code
 
__repr__(self)
repr(x)
source code
 
_ppo(self, db=None)
Like pretty print...
source code
 
_remove(self, db=None, cascade='bnode', bnodeCheck=True)
remove all triples where this rdfSubject is the subject of the triple
source code
 
_rename(self, name, db=None)
rename a node
source code
 
_set_with_dict(self, kv) source code
 
md5_term_hash(self)
Not sure what good this method is but it's defined for rdflib.Identifiers so it's here for now
source code
 
n3(self)
n3 repr of this node
source code

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods [hide private]
 
ClassInstances(cls)
return a generator for instances of this rdf:type you can look in MyClass.rdf_type to see the predicate being used
source code
 
GetRandom(cls)
for develoment just returns a random instance of this class
source code
 
_getdescriptor(cls, key)
__get_descriptor returns the descriptor for the key.
source code
 
filter_by(cls, **kwargs)
Class method returns a generator over classs instances meeting the kwargs conditions.
source code
 
get_by(cls, **kwargs)
Class Method, returns a single instance of the class by a single kwarg.
source code
 
query(cls) source code
Class Variables [hide private]
  db = <Graph identifier=VBeThTIq0 (<class 'rdflib.Graph.Conjunc...
  rdf_type = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__hash__(self)
(Hashing function)

source code 
hash(x)
Overrides: object.__hash__
(inherited documentation)

__init__(self, resUri=None, **kwargs)
(Constructor)

source code 

The constructor tries hard to do return you an rdfSubject

Can be given as one of:

  • an instance of an rdfSubject
  • an instance of a BNode or a URIRef
  • an n3 uriref string like: "<urn:isbn:1234567890>"
  • an n3 bnode string like: "_:xyz1234"
Parameters:
  • resUri - the "resource uri". If None then create an instance with a BNode resUri.
  • kwargs - is a set of values that will be set using the keys to find the appropriate descriptor
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

_getdescriptor(cls, key)
Class Method

source code 
__get_descriptor returns the descriptor for the key. It essentially cls.__dict__[key] with recursive calls to super

_ppo(self, db=None)

source code 
Like pretty print... Return a 'pretty predicate,object' of self returning all predicate object pairs with qnames

_remove(self, db=None, cascade='bnode', bnodeCheck=True)

source code 
remove all triples where this rdfSubject is the subject of the triple
Parameters:
  • db - limit the remove operation to this graph
  • cascade - must be one of:

    • none -- remove none
    • bnode -- (default) remove all unreferenced bnodes
    • all -- remove all unreferenced bnode(s) AND uri(s)
  • bnodeCheck - boolean

    • True -- (default) check bnodes and raise exception if there are still references to this node
    • False -- do not check. This can leave orphaned object reference in triples. Use only if you are resetting the value in the same transaction

_set_with_dict(self, kv)

source code 
Parameters:
  • kv - a dict

    for each key,value pair in dict kv
    set self.key = value

filter_by(cls, **kwargs)
Class Method

source code 

Class method returns a generator over classs instances meeting the kwargs conditions.

Each keyword must be a class descriptor

filter by RDF.type == cls.rdf_type is implicit

Order helps, the first keyword should be the most restrictive

get_by(cls, **kwargs)
Class Method

source code 

Class Method, returns a single instance of the class by a single kwarg. the keyword must be a descriptor of the class. example:

bigBlue = Company.get_by(symbol='IBM')

Note: the keyword should map to an rdf predicate that is of type owl:InverseFunctional


Class Variable Details [hide private]

db

Value:
<Graph identifier=VBeThTIq0 (<class 'rdflib.Graph.ConjunctiveGraph'>)>