oldman.storage package


oldman.storage.id_generation module

class oldman.storage.id_generation.BlankNodePermanentIDGenerator(hostname=u'localhost')[source]

Bases: oldman.storage.id_generation.PrefixedUUIDPermanentIDGenerator

Generates skolem IRIs that denote blank nodes.

Parameters:hostname – Defaults to “localhost”.
class oldman.storage.id_generation.IncrementalIriGenerator(prefix, store, class_iri, fragment=None)[source]

Bases: oldman.storage.id_generation.PermanentIDGenerator

Generates IRIs with short numbers.

Beautiful but slow in concurrent settings. The number generation implies a critical section and a sequence of two SPARQL requests, which represents a significant bottleneck.

  • prefix – IRI prefix.
  • store – TODO: describe.
  • graphrdflib.Graph object where to store the counter.
  • class_iri – IRI of the RDFS class of which new Resource objects are instance of. Usually corresponds to the class IRI of the Model object that owns this generator.
  • fragment – IRI fragment to append to the hash-less IRI. Defaults to None.

See oldman.iri.permanent.PermanentIDGenerator.generate_permanent_id().


For test purposes only

class oldman.storage.id_generation.PermanentIDGenerator(is_generating_blank_nodes)[source]

Bases: object

An PermanentIDGenerator object generates the Resource objects.


Generates an ID.

Returns:A PermanentID.

TODO: remove

class oldman.storage.id_generation.PrefixedUUIDPermanentIDGenerator(prefix, fragment=None, is_generating_blank_nodes=False)[source]

Bases: oldman.storage.id_generation.PermanentIDGenerator

Uses a prefix, a fragment and a unique UUID1 number to generate IRIs.

Recommended generator because UUID1 is robust and fast (no DB access).

  • prefix – IRI prefix.
  • fragment – IRI fragment to append to the hash-less IRI. Defaults to None.

See oldman.iri.permanent.PermanentIDGenerator.generate_permanent_id().

class oldman.storage.id_generation.UUIDFragmentPermanentIDGenerator[source]

Bases: oldman.storage.id_generation.PermanentIDGenerator

Generates an hashed IRI from a hash-less IRI.

Its fragment is a unique UUID1 number.


See oldman.iri.permanent.PermanentIDGenerator.generate_permanent_id().

oldman.storage.resource module

class oldman.storage.resource.StoreResource(previous_id, model_manager, store, session, types=None, is_new=True, **kwargs)[source]

Bases: oldman.core.resource.resource.Resource

StoreResource: resource manipulated by the data store.

End-users should not manipulate it.

Is serializable (pickable).

  • previous_id – TODO: describe (maybe a temporary one).
  • model_managerModelManager object. Gives access to its models.
  • storeStore object. Store that has authority on this resource.
  • kwargs – Other parameters considered by the Resource constructor and values indexed by their attribute names.
classmethod load_from_graph(model_manager, store, session, iri, subgraph, is_new=True)[source]

Loads a new StoreResource object from a sub-graph.

TODO: update the comments.

  • model_managerStoreModelManager object.
  • iri – IRI of the resource.
  • subgraphrdflib.Graph object containing triples about the resource.
  • is_new – When is True and id given, checks that the IRI is not already existing in the union_graph. Defaults to True.

The StoreResource object created.


oldman.storage.session module

class oldman.storage.session.CrossStoreSession[source]

Bases: oldman.core.session.session.Session

load_from_graph(id, resource_graph, store)[source]
new(id, store, types=None, hashless_iri=None, collection_iri=None, is_new=True, former_types=None, **kwargs)[source]

Creates a new Resource object without saving it in the data_store.

The kwargs dict can contains regular attribute key-values that will be assigned to OMAttribute objects.

TODO: update this doc

  • id – TODO: explain
  • types – IRIs of RDFS classes the resource is instance of. Defaults to None. Note that these IRIs are used to find the models of the resource (see find_models_and_types() for more details).
  • hashless_iri – hash-less IRI that MAY be considered when generating an IRI for the new resource. Defaults to None. Ignored if id is given. Must be None if collection_iri is given.
  • collection_iri – IRI of the controller to which this resource belongs. This information is used to generate a new IRI if no id is given. The IRI generator may ignore it. Defaults to None. Must be None if hashless_iri is given.

A new Resource object.

class oldman.storage.session.DefaultCrossStoreSession(store_selector)[source]

Bases: oldman.storage.session.CrossStoreSession

TODO: explain because the name can be counter-intuitive


Does nothing


TODO: describe.

Wait for the next flush() to remove the resource from the store.


TODO: re-implement it

get(iri, types=None, eager_with_reversed_attributes=True)[source]
load_from_graph(id, resource_graph, store)[source]
new(id, store, types=None, is_new=True, former_types=None, **kwargs)[source]
receive_reference(reference, object_resource=None, object_iri=None)[source]
oldman.storage.session.cluster_by_store_and_status(resources_to_update, resources_to_delete)[source]

Module contents