oldman.storage package¶
Subpackages¶
Submodules¶
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.
Parameters: - prefix – IRI prefix.
- store – TODO: describe.
- graph –
rdflib.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 theModel
object that owns this generator. - fragment – IRI fragment to append to the hash-less IRI. Defaults to None.
-
class
oldman.storage.id_generation.
PermanentIDGenerator
(is_generating_blank_nodes)[source]¶ Bases:
object
An
PermanentIDGenerator
object generates theResource
objects.-
is_generating_blank_nodes
¶ 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).
Parameters: - prefix – IRI prefix.
- fragment – IRI fragment to append to the hash-less IRI. Defaults to None.
-
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.
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).
Parameters: - previous_id – TODO: describe (maybe a temporary one).
- model_manager –
ModelManager
object. Gives access to its models. - store –
Store
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.
Parameters: - model_manager –
StoreModelManager
object. - iri – IRI of the resource.
- subgraph –
rdflib.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.
Returns: The
StoreResource
object created.- model_manager –
-
store
¶
oldman.storage.session module¶
-
class
oldman.storage.session.
CrossStoreSession
[source]¶ Bases:
oldman.core.session.session.Session
-
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
Parameters: - 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.
Returns: A new
Resource
object.
-
tracker
¶
-
-
class
oldman.storage.session.
DefaultCrossStoreSession
(store_selector)[source]¶ Bases:
oldman.storage.session.CrossStoreSession
TODO: explain because the name can be counter-intuitive
-
delete
(store_resource)[source]¶ TODO: describe.
Wait for the next flush() to remove the resource from the store.
-
tracker
¶
-