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: object

Base class for all identifiers and also represents xsd:anyURI.

property uri: str

The URI associated with the current identifier.

provn_representation() str[source]

Return the PROV-N representation of this identifier as an xsd:anyURI literal.

class prov.identifier.QualifiedName(namespace: Namespace, localpart: str)[source]

Bases: Identifier

Represents 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).

property namespace: Namespace

Namespace of qualified name.

property localpart: str

Local part of qualified name.

provn_representation() str[source]

Return the PROV-N representation of this qualified name as a quoted string.

class prov.identifier.Namespace(prefix: str, uri: str)[source]

Bases: object

PROV Namespace.

property uri: str

Namespace URI.

property prefix: str

Namespace prefix.

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:

True if the identifier’s URI starts with this namespace’s URI, False otherwise (including when the URI cannot be determined).

qname(identifier: str | Identifier) QualifiedName | None[source]

Resolve an identifier to a QualifiedName in this namespace.

Parameters:

identifier – Identifier (or URI string) to resolve.

Returns:

A new QualifiedName in this namespace if identifier’s URI starts with this namespace’s URI, otherwise None.