prov.identifier¶
prov.identifier implements PROV’s namespaced identifiers: a Namespace
groups identifiers under a URI and an optional prefix, and a
QualifiedName combines a namespace with a local part to name
entities, activities, agents, and attributes. Identifier is the
common base, also used directly to represent xsd:anyURI values. prov.model.NamespaceManager
(see prov.model) tracks the namespaces registered on a bundle and resolves prefixes during
parsing and serialization.
- class prov.identifier.Identifier(uri: str)[source]¶
Bases:
objectBase class for all identifiers and also represents xsd:anyURI.
- class prov.identifier.QualifiedName(namespace: Namespace, localpart: str)[source]¶
Bases:
IdentifierRepresents a qualified name, which combines a namespace and a local part for use in identifying entities in a namespace-aware context.
This class facilitates handling and manipulation of qualified names, which combine a namespace and a local identifier. It supports string representation, hashing, and retrieval of individual components (namespace or local part).
- class prov.identifier.Namespace(prefix: str, uri: str)[source]¶
Bases:
objectPROV Namespace.
- contains(identifier: Identifier) bool[source]¶
Check whether the given identifier’s URI is contained in this namespace.
- Parameters:
identifier – Identifier (or URI string) to check.
- Returns:
Trueif the identifier’s URI starts with this namespace’s URI,Falseotherwise (including when the URI cannot be determined).
- qname(identifier: str | Identifier) QualifiedName | None[source]¶
Resolve an identifier to a
QualifiedNamein this namespace.- Parameters:
identifier – Identifier (or URI string) to resolve.
- Returns:
A new
QualifiedNamein this namespace ifidentifier’s URI starts with this namespace’s URI, otherwiseNone.