oldman.core package

Submodules

oldman.core.common module

oldman.core.common.is_blank_node(iri)[source]

Tests if id is a locally skolemized IRI.

External skolemized blank nodes are not considered as blank nodes.

Parameters:iri – IRI of the resource.
Returns:True if is a blank node.
oldman.core.common.is_temporary_blank_node(iri)[source]

oldman.core.exception module

exception oldman.core.exception.AlreadyAllocatedModelError[source]

Bases: oldman.core.exception.ModelGenerationError

The class IRI or the short name of a new model is already allocated.

exception oldman.core.exception.ModelGenerationError[source]

Bases: oldman.core.exception.OMError

Error when generating a new model.

exception oldman.core.exception.OMAccessError[source]

Bases: oldman.core.exception.OMUserError

Error when accessing objects.

exception oldman.core.exception.OMAlreadyDeclaredDatatypeError[source]

Bases: oldman.core.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.core.exception.OMAlreadyGeneratedAttributeError[source]

Bases: oldman.core.exception.OMInternalError

Attribute generation occurs only once per SupportedProperty.

You should not try to add metadata or regenerate after that.

exception oldman.core.exception.OMAttributeAccessError[source]

Bases: oldman.core.exception.OMAccessError

When such an attribute cannot be identified (is not supported or no model has been found).

exception oldman.core.exception.OMAttributeDefError[source]

Bases: oldman.core.exception.OMSchemaError

Inconsistency in the definition of a model class attribute.

exception oldman.core.exception.OMAttributeTypeCheckError[source]

Bases: oldman.core.exception.OMEditError

The value assigned to the attribute has wrong type.

exception oldman.core.exception.OMBadRequestException[source]

Bases: oldman.core.exception.OMControllerException

TODO: describe

Error: 400

exception oldman.core.exception.OMClassInstanceError[source]

Bases: oldman.core.exception.OMAccessError

The object is not an instance of the expected RDFS class.

exception oldman.core.exception.OMControllerException[source]

Bases: exceptions.Exception

TODO: describe

exception oldman.core.exception.OMDifferentHashlessIRIError[source]

Bases: oldman.core.exception.OMIriError, oldman.core.exception.OMEditError

When creating or updating an object with a different hashless IRI is forbidden.

Blank nodes are not concerned.

exception oldman.core.exception.OMEditError[source]

Bases: oldman.core.exception.OMUserError

Runtime errors, occuring when editing or creating an object.

exception oldman.core.exception.OMError[source]

Bases: exceptions.Exception

Root of exceptions generated by the oldman package expected HTTP ones.

exception oldman.core.exception.OMExpiredMethodDeclarationTimeSlotError[source]

Bases: oldman.core.exception.ModelGenerationError

All methods must be declared before creating a first model.

exception oldman.core.exception.OMForbiddenOperationException[source]

Bases: oldman.core.exception.OMControllerException

No chance TODO: improve

exception oldman.core.exception.OMForbiddenSkolemizedIRIError[source]

Bases: oldman.core.exception.OMEditError

When updating a skolemized IRI from the local domain is forbidden.

exception oldman.core.exception.OMHashIriError[source]

Bases: oldman.core.exception.OMAccessError

A hash IRI has been given instead of a hash-less IRI.

exception oldman.core.exception.OMInternalError[source]

Bases: oldman.core.exception.OMError

Do not expect it.

exception oldman.core.exception.OMIriError[source]

Bases: oldman.core.exception.OMRuntimeError

Root class for problems with an IRI (generation, validation).

exception oldman.core.exception.OMMethodNotAllowedException[source]

Bases: oldman.core.exception.OMControllerException

405

exception oldman.core.exception.OMNotAcceptableException[source]

Bases: oldman.core.exception.OMControllerException

406 Not Acceptable

TODO: indicate the content-type

exception oldman.core.exception.OMObjectNotFoundError[source]

Bases: oldman.core.exception.OMAccessError

When the object is not found.

exception oldman.core.exception.OMPropertyDefError[source]

Bases: oldman.core.exception.OMSchemaError

Inconsistency in the definition of a supported property.

exception oldman.core.exception.OMPropertyDefTypeError[source]

Bases: oldman.core.exception.OMPropertyDefError

A RDF property cannot be both an ObjectProperty and a DatatypeProperty.

exception oldman.core.exception.OMReadOnlyAttributeError[source]

Bases: oldman.core.exception.OMEditError

End-users are not allowed to edit this attribute.

exception oldman.core.exception.OMRequiredAuthenticationException[source]

Bases: oldman.core.exception.OMControllerException

Try again TODO: improve

exception oldman.core.exception.OMRequiredHashlessIRIError[source]

Bases: oldman.core.exception.OMEditError

No hash-less IRI has been given.

exception oldman.core.exception.OMRequiredPropertyError[source]

Bases: oldman.core.exception.OMEditError

A required property has no value.

exception oldman.core.exception.OMReservedAttributeNameError[source]

Bases: oldman.core.exception.OMAttributeDefError

Some attribute names are reserved and should not be included in the JSON-LD context.

exception oldman.core.exception.OMResourceNotFoundException[source]

Bases: oldman.core.exception.OMControllerException

TODO: describe

exception oldman.core.exception.OMRuntimeError[source]

Bases: oldman.core.exception.OMError

Error at runtime after the initialization.

exception oldman.core.exception.OMSPARQLError[source]

Bases: oldman.core.exception.OMAccessError

Invalid SPARQL query given.

exception oldman.core.exception.OMSPARQLParseError[source]

Bases: oldman.core.exception.OMInternalError

Invalid SPARQL request.

exception oldman.core.exception.OMSchemaError[source]

Bases: oldman.core.exception.ModelGenerationError

Error in the schema graph and/or the JSON-LD context.

exception oldman.core.exception.OMStoreError[source]

Bases: oldman.core.exception.OMRuntimeError

Error detected in the stored data.

exception oldman.core.exception.OMTemporaryIriError[source]

Bases: oldman.core.exception.OMEditError

When saving a Resource that has an attribute that points to a temporary IRI.

exception oldman.core.exception.OMUnauthorizedTypeChangeError[source]

Bases: oldman.core.exception.OMEditError

When updating a resource with new types without explicit authorization.

exception oldman.core.exception.OMUndeclaredClassNameError[source]

Bases: oldman.core.exception.ModelGenerationError

The name of the model class should be defined in the JSON-LD context.

exception oldman.core.exception.OMUniquenessError[source]

Bases: oldman.core.exception.OMEditError

Attribute uniqueness violation.

Example: IRI illegal reusing.

exception oldman.core.exception.OMUnsupportedUserIRIError[source]

Bases: oldman.core.exception.OMIriError, oldman.core.exception.OMEditError

The IRI provided by the user is not supported.

exception oldman.core.exception.OMUserError[source]

Bases: oldman.core.exception.OMRuntimeError

Error when accessing or editing objects.

exception oldman.core.exception.OMWrongResourceError[source]

Bases: oldman.core.exception.OMEditError

Not updating the right object.

exception oldman.core.exception.UnsupportedDataStorageFeatureException[source]

Bases: oldman.core.exception.OMStoreError

Feature not supported by the data store.

oldman.core.id module

class oldman.core.id.OMId(iri, is_permanent)[source]

TODO: explain why an ID object and not a simple IRI. An ID can be temporary.

Immutable data structure.

fragment

TODO: explain

hashless_iri

TODO: explain

iri
is_blank_node

TODO: explain

is_permanent
class oldman.core.id.PermanentId(iri)[source]

Bases: oldman.core.id.OMId

TODO: explain

class oldman.core.id.TemporaryId(suggested_hashless_iri=None, suggested_iri_fragment=None, collection_iri=None, can_remain_bnode=True)[source]

Bases: oldman.core.id.OMId

TODO: describe

can_remain_bnode

Returns True if is currently a blank node and may remain it before being stored.

collection_iri
suggested_fragment

TODO: explain

suggested_hashless_iri

TODO: explain

oldman.core.id.generate_iri_with_uuid_fragment(hashless_iri)[source]

TODO: describe

oldman.core.id.generate_uuid_iri(prefix=u'http://localhost/.well-known/genid/', fragment=None)[source]

TODO: describe

oldman.core.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.core.vocabulary.NEXT_NUMBER_IRI = 'urn:oldman:nextNumber'

Used to increment IRIs.

Module contents