6.1. identification - Generate Identifiers
This module generates Identifiers.
To Generate [identifier]: -> Try:
Abstract ->
AbstractIdentifierGeneratorUUID ->
UUIDGeneratorIRI ->
NamespaceIRIGenerator
- class AbstractIdentifierGenerator
Abstract base class for identifier generators that generate
Identifiersbased on an internal schema and an (optional) proposal.Different Implementations of IdentifierGenerators may generate differently formed ids, e.g. URNs, HTTP-scheme IRIs, IRDIs, etc. Some of them may use a given private namespace and create ids within this namespace, others may just use long random numbers to ensure uniqueness.
- abstract generate_id(proposal: str | None = None) str
Generate a new Identifier for an Identifiable object.
- Parameters:
proposal – An optional string for a proposed suffix of the Identifier (e.g. the last path part or fragment of an IRI). It may be ignored by some implementations of or be changed if the resulting id is already existing.
- class NamespaceIRIGenerator(namespace: str, provider: AbstractObjectProvider)
An IdentifierGenerator, that generates IRIs in a given namespace, checking uniqueness against a Registry.
Identifiersare generated by concatenating a fixed namespace with the proposed suffix. To verify uniqueness, the existence of the id is checked by querying the given Registry. If a collision is detected, a number is prepended- Variables:
namespace – The IRI Namespace to generate Identifiers in. It must be a valid IRI (starting with a scheme) and end on either #, /, or = to form a reasonable namespace.
provider – An
AbstractObjectProviderto check existence ofIdentifiers
- generate_id(proposal: str | None = None) str
Generate a new Identifier for an Identifiable object.
- Parameters:
proposal – An optional string for a proposed suffix of the Identifier (e.g. the last path part or fragment of an IRI). It may be ignored by some implementations of or be changed if the resulting id is already existing.
- property namespace
- class UUIDGenerator
An IdentifierGenerator, that generates URNs of version 1 UUIDs according to RFC 4122.
- generate_id(proposal: str | None = None) str
Generate a new Identifier for an Identifiable object.
- Parameters:
proposal – An optional string for a proposed suffix of the Identifier (e.g. the last path part or fragment of an IRI). It may be ignored by some implementations of or be changed if the resulting id is already existing.