oldman package¶
Subpackages¶
Submodules¶
oldman.common module¶
oldman.exception module¶
- exception oldman.exception.AlreadyAllocatedModelError[source]¶
Bases: oldman.exception.ModelGenerationError
The class IRI or the short name of a new model is already allocated.
- exception oldman.exception.ModelGenerationError[source]¶
Bases: oldman.exception.OMError
Error when generating a new model.
- exception oldman.exception.OMAccessError[source]¶
Bases: oldman.exception.OMUserError
Error when accessing objects.
- exception oldman.exception.OMAlreadyDeclaredDatatypeError[source]¶
Bases: oldman.exception.OMAttributeDefError
At least two different datatypes for the same attribute.
You may check the possible datatype inherited from the property (rdfs:range) and the one specified in the JSON-LD context.
- exception oldman.exception.OMAlreadyGeneratedAttributeError[source]¶
Bases: oldman.exception.OMInternalError
Attribute generation occurs only once per SupportedProperty.
You should not try to add metadata or regenerate after that.
- exception oldman.exception.OMAttributeAccessError[source]¶
Bases: oldman.exception.OMAccessError
When such an attribute cannot be identified (is not supported or no model has been found).
- exception oldman.exception.OMAttributeDefError[source]¶
Bases: oldman.exception.OMSchemaError
Inconsistency in the definition of a model class attribute.
- exception oldman.exception.OMAttributeTypeCheckError[source]¶
Bases: oldman.exception.OMEditError
The value assigned to the attribute has wrong type.
- exception oldman.exception.OMBadRequestException[source]¶
Bases: oldman.exception.OMControllerException
TODO: describe
Error: 400
- exception oldman.exception.OMClassInstanceError[source]¶
Bases: oldman.exception.OMAccessError
The object is not an instance of the expected RDFS class.
- exception oldman.exception.OMControllerException[source]¶
Bases: exceptions.Exception
TODO: describe
- exception oldman.exception.OMDataStoreError[source]¶
Bases: oldman.exception.OMRuntimeError
Error detected in the stored data.
- exception oldman.exception.OMDifferentHashlessIRIError[source]¶
Bases: oldman.exception.OMEditError
When creating or updating an object with a different hashless IRI is forbidden.
Blank nodes are not concerned.
- exception oldman.exception.OMEditError[source]¶
Bases: oldman.exception.OMUserError
Runtime errors, occuring when editing or creating an object.
- exception oldman.exception.OMError[source]¶
Bases: exceptions.Exception
Root of exceptions generated by the oldman package expected HTTP ones.
- exception oldman.exception.OMExpiredMethodDeclarationTimeSlotError[source]¶
Bases: oldman.exception.ModelGenerationError
All methods must be declared before creating a first model.
- exception oldman.exception.OMForbiddenOperationException[source]¶
Bases: oldman.exception.OMControllerException
No chance TODO: improve
- exception oldman.exception.OMForbiddenSkolemizedIRIError[source]¶
Bases: oldman.exception.OMEditError
When updating a skolemized IRI from the local domain is forbidden.
- exception oldman.exception.OMHashIriError[source]¶
Bases: oldman.exception.OMAccessError
A hash IRI has been given instead of a hash-less IRI.
- exception oldman.exception.OMInternalError[source]¶
Bases: oldman.exception.OMError
Do not expect it.
- exception oldman.exception.OMMethodNotAllowedException[source]¶
Bases: oldman.exception.OMControllerException
405
- exception oldman.exception.OMNotAcceptableException[source]¶
Bases: oldman.exception.OMControllerException
406 Not Acceptable
TODO: indicate the content-type
- exception oldman.exception.OMObjectNotFoundError[source]¶
Bases: oldman.exception.OMAccessError
When the object is not found.
- exception oldman.exception.OMPropertyDefError[source]¶
Bases: oldman.exception.OMSchemaError
Inconsistency in the definition of a supported property.
- exception oldman.exception.OMPropertyDefTypeError[source]¶
Bases: oldman.exception.OMPropertyDefError
A RDF property cannot be both an ObjectProperty and a DatatypeProperty.
- exception oldman.exception.OMReadOnlyAttributeError[source]¶
Bases: oldman.exception.OMEditError
End-users are not allowed to edit this attribute.
- exception oldman.exception.OMRequiredAuthenticationException[source]¶
Bases: oldman.exception.OMControllerException
Try again TODO: improve
- exception oldman.exception.OMRequiredHashlessIRIError[source]¶
Bases: oldman.exception.OMEditError
No hash-less IRI has been given.
- exception oldman.exception.OMRequiredPropertyError[source]¶
Bases: oldman.exception.OMEditError
A required property has no value.
- exception oldman.exception.OMReservedAttributeNameError[source]¶
Bases: oldman.exception.OMAttributeDefError
Some attribute names are reserved and should not be included in the JSON-LD context.
- exception oldman.exception.OMResourceNotFoundException[source]¶
Bases: oldman.exception.OMControllerException
TODO: describe
- exception oldman.exception.OMRuntimeError[source]¶
Bases: oldman.exception.OMError
Error at runtime after the initialization.
- exception oldman.exception.OMSPARQLError[source]¶
Bases: oldman.exception.OMAccessError
Invalid SPARQL query given.
- exception oldman.exception.OMSPARQLParseError[source]¶
Bases: oldman.exception.OMInternalError
Invalid SPARQL request.
- exception oldman.exception.OMSchemaError[source]¶
Bases: oldman.exception.ModelGenerationError
Error in the schema graph and/or the JSON-LD context.
Bases: oldman.exception.OMEditError
When updating a resource with new types without explicit authorization.
- exception oldman.exception.OMUndeclaredClassNameError[source]¶
Bases: oldman.exception.ModelGenerationError
The name of the model class should be defined in the JSON-LD context.
- exception oldman.exception.OMUniquenessError[source]¶
Bases: oldman.exception.OMEditError
Attribute uniqueness violation.
Example: IRI illegal reusing.
- exception oldman.exception.OMUserError[source]¶
Bases: oldman.exception.OMRuntimeError
Error when accessing or editing objects.
- exception oldman.exception.OMWrongResourceError[source]¶
Bases: oldman.exception.OMEditError
Not updating the right object.
- exception oldman.exception.UnsupportedDataStorageFeatureException[source]¶
Bases: oldman.exception.OMDataStoreError
Feature not supported by the data store.
oldman.iri module¶
- class oldman.iri.BlankNodeIriGenerator(hostname=u'localhost')[source]¶
Bases: oldman.iri.PrefixedUUIDIriGenerator
Generates skolem IRIs that denote blank nodes.
Parameters: hostname – Defaults to “localhost”.
- class oldman.iri.IncrementalIriGenerator(prefix, data_store, class_iri, fragment=None)[source]¶
Bases: oldman.iri.IriGenerator
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.
- 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 the Model object that owns this generator.
- fragment – IRI fragment to append to the hash-less IRI. Defaults to None.
- class oldman.iri.IriGenerator[source]¶
Bases: object
An IriGenerator object generates the IRIs of some new Resource objects.
- class oldman.iri.PrefixedUUIDIriGenerator(prefix, fragment=None)[source]¶
Bases: oldman.iri.IriGenerator
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.iri.UUIDFragmentIriGenerator[source]¶
Bases: oldman.iri.IriGenerator
Generates an hashed IRI from a hash-less IRI.
Its fragment is a unique UUID1 number.
oldman.vocabulary module¶
oldman.vocabulary¶
RDF vocabulary used by OldMan. Some of it is specific to OldMan.
TODO: replace these URNs by URLs.
Parent model prioritization
In RDF, a class is often the child of multiple classes. When the code inherited from these classes (common practise in Object-Oriented Programming) is conflicting, arbitration is necessary.
In this library, we provide a RDF vocabulary to declare priorities for each parent of a given child class. A priority statement is declared as follows:
?cls <urn:oldman:model:ordering:hasPriority> [
<urn:oldman:model:ordering:class> ?parent1 ;
<urn:oldman:model:ordering:priority> 2
].
By default, when no priority is declared for a pair (child, parent), its priority value is set to 0.
- oldman.vocabulary.NEXT_NUMBER_IRI = 'urn:oldman:nextNumber'¶
Used to increment IRIs.