Conformance

prov implements the W3C PROV Data Model and five serialisations of it: PROV-JSON, PROV-XML, PROV-O (RDF), PROV-JSONLD and PROV-N. This page states what the current release conforms to; it was revised for 3.3.0.

Summary:

  • Every concept in the tables below round-trips through every format, with two permanent exceptions, C1 and C2.

  • The values table says how literals behave.

  • Readers accept some output from other producers, listed under “Reading other producers’ output”.

Reading the tables

  • A round trip is deserialize(serialize(doc)) == doc for every shared test case. ✓ means it holds; ✓ followed by a caveat, such as ✓ C5, means it holds except in the case that caveat describes; ✗ C2 means the format cannot represent the concept.

  • The PROV-N column shows the keyword get_provn() writes. Every row round-trips through PROV-N under the default profile, and under strict when written with strict=True, except that a strict write drops the identifier and attribute block of a hadMember, alternateOf or specializationOf that carries either (Work with PROV-N).

  • prov enforces no structural constraint at assertion time, except that hadMember, alternateOf, specializationOf and mentionOf require their parties; general validation is #62. Merge-time conformance, PROV-CONSTRAINTS unification, is unified()’s job and is described in Unification and flattening.

Component 1: Entities and Activities

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Entity §5.1.1

ProvEntity

entity()

entity

✓

✓

✓

✓

Activity §5.1.2

ProvActivity

activity()

activity

✓

✓

✓

✓

Generation §5.1.3

ProvGeneration

generation() / wasGeneratedBy()

wasGeneratedBy

✓

✓

✓

✓

Usage §5.1.4

ProvUsage

usage() / used()

used

✓

✓

✓

✓

Communication §5.1.5

ProvCommunication

communication() / wasInformedBy()

wasInformedBy

✓

✓

✓

✓

Start §5.1.6

ProvStart

start() / wasStartedBy()

wasStartedBy

✓

✓

✓

✓

End §5.1.7

ProvEnd

end() / wasEndedBy()

wasEndedBy

✓

✓

✓

✓

Invalidation §5.1.8

ProvInvalidation

invalidation() / wasInvalidatedBy()

wasInvalidatedBy

✓

✓

✓

✓

The factories are ProvBundle methods. ProvEntity also has wasGeneratedBy() and wasInvalidatedBy(), and ProvActivity has used(), wasInformedBy(), wasStartedBy() and wasEndedBy(), as chaining methods with the record itself as subject.

Component 2: Derivations

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Derivation §5.2.1

ProvDerivation

derivation() / wasDerivedFrom()

wasDerivedFrom

✓

✓

✓

✓

Revision §5.2.2

ProvDerivation + prov:Revision type

revision() / wasRevisionOf()

wasDerivedFrom with [prov:type='prov:Revision']

✓

✓

✓

✓

Quotation §5.2.3

ProvDerivation + prov:Quotation type

quotation() / wasQuotedFrom()

wasDerivedFrom with [prov:type='prov:Quotation']

✓

✓

✓

✓

Primary Source §5.2.4

ProvDerivation + prov:PrimarySource type

primary_source() / hadPrimarySource()

wasDerivedFrom with [prov:type='prov:PrimarySource']

✓

✓

✓

✓

The three subtypes share one class and differ only in prov:type, which is how PROV-N expresses them: the grammar has no wasRevisionOf keyword.

Component 3: Agents, Responsibility and Influence

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Agent §5.3.1

ProvAgent

agent()

agent

✓

✓

✓

✓

Person / Organization / SoftwareAgent §5.3.1

prov:type on ProvAgent

none, see “Not implemented”

agent with [prov:type='prov:Person'] and so on

✓

✓

✓

✓

Attribution §5.3.2

ProvAttribution

attribution() / wasAttributedTo()

wasAttributedTo

✓

✓

✓

✓

Association §5.3.3

ProvAssociation

association() / wasAssociatedWith()

wasAssociatedWith

✓

✓

✓

✓

Plan §5.3.3

the entity named by association(plan=...)

none

none; the plan is the association’s third argument

✓

✓

✓

✓

Delegation §5.3.4

ProvDelegation

delegation() / actedOnBehalfOf()

actedOnBehalfOf

✓

✓

✓

✓

Influence §5.3.5

ProvInfluence

influence() / wasInfluencedBy()

wasInfluencedBy

✓

✓

✓

✓

Component 4: Bundles

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Bundle constructor §5.4.1

ProvBundle

ProvDocument.bundle() / add_bundle()

bundle <id> ... endBundle

✓

✓

✓

✓

Bundle as an entity §5.4.2

not implemented, see below

Only a ProvDocument may contain named bundles. A bundle identifier is resolved in the bundle’s own scope (PROV-N section 3.4.1), so a declaration on the bundle that would change what its identifier reads as, its own default while the identifier is bare in the document’s default, or a rebinding of the identifier’s prefix, is refused with a ProvException.

Component 5: Alternate Entities

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Specialization §5.5.1

ProvSpecialization

specialization() / specializationOf()

specializationOf

✓

✓

✓

✓

Alternate §5.5.2

ProvAlternate

alternate() / alternateOf()

alternateOf

✓

✓

✓

✓

Mention (PROV-Links)

ProvMention, a ProvSpecialization

mention() / mentionOf()

mentionOf, or prov:mentionOf with strict=True

✓

✓

✓

✗ C2

alternate(a, b) is written as the triple a prov:alternateOf b, PROV-DM’s argument order.

Component 6: Collections

Concept (PROV-DM §)

Model class

Factory / alias

PROV-N keyword

JSON

XML

RDF

JSON-LD

Collection §5.6

ProvEntity + prov:Collection type

collection()

entity with [prov:type='prov:Collection']

✓

✓

✓

✓

EmptyCollection §5.6

ProvEntity + prov:EmptyCollection type

none, see “Not implemented”

entity with [prov:type='prov:EmptyCollection']

✓

✓

✓

✓

Membership §5.6

ProvMembership

membership() / hadMember()

hadMember

✓

✓

✓

✓

Values and datatypes (PROV-DM §5.7)

The shared attribute corpus exercises every XSD type below in every format, on prov:label, prov:location, prov:role, prov:type, prov:value and on ordinary attributes.

Value

Written as

Round trip

String, with or without an explicit xsd:string

a string

✓ in every format

Language-tagged string

the tag as given; tags compare case-insensitively

✓ C5 C6

Boolean

xsd:boolean, spelled true and false; 1 and 0 read as the same value and keep their text

✓

Python int with no datatype

the datatype that Python values gives for its size; PROV-N writes xsd:int as a bare number

✓

Integer with an asserted datatype (xsd:long, xsd:short, xsd:unsignedByte, …)

the asserted datatype, never collapsed to a narrower one

✓

xsd:decimal

as given; 10, 10.0 and "10.00" are one value (see Equality)

✓

Python float

xsd:double at full precision

✓

Qualified name as a value

xsd:QName in PROV-JSON, a node reference in PROV-JSONLD (a bare string under type, location and role), native elsewhere; a Literal typed xsd:QName or prov:QUALIFIED_NAME whose prefix is declared is stored as a qualified name

✓

xsd:dateTime

the form that Python values gives; a typed literal with an offset beyond ±14:00, a fraction of more than six digits or a year outside 1 to 9999 stays a Literal; PROV-O reads a longer fraction truncated (C10)

✓ C7 C10

xsd:anyURI, xsd:base64Binary and the other XSD types in the corpus

lexical form and datatype as given, compared by the rules in Equality; an Identifier value is stored as an xsd:anyURI Literal

✓ C10

Other Python values

the form that Python values gives

✓ C10

Permanent limitations

Two constructs cannot round-trip, and no change is planned.

  • C1. Two records with the same identifier that differ (PROV-O, permanent). PROV-O names a record by its identifier, so two records that share one collapse onto one node when written, and the round trip is not guaranteed. Reading it back may give one record, which compares unequal to the original, or raise. RDF from another tool that gives two records the same IRI reads back the same way. A relation node, identified or blank, that holds several values of one formal attribute raises, because a record holds one value of each. C1 applies to every record that carries an identifier, including an entity named only as an association’s plan. Minting a synthetic IRI and guessing values on decode were both rejected (#217). unified() merges the records or raises for a conflict.

  • C2. No Mention term in PROV-JSONLD (permanent). The submission defines none, so serialising or deserialising a document with a ProvMention raises prov.serializers.provjsonld.ProvJSONLDException.

Format notes

  • C8. RDF’s json-ld syntax is not PROV-JSONLD. rdf_format="json-ld" is rdflib’s generic JSON-LD writer over the PROV-O graph, with every PROV-O limitation. Use format="jsonld" for PROV-JSONLD.

Not implemented

  • A bundle as a first-class entity of type prov:Bundle (PROV-DM §5.4.2), so the provenance of a bundle itself cannot be asserted (#261).

  • Factories for the agent subtypes and for EmptyCollection; add the prov:type through other_attributes (#260).

  • PROV-Dictionary (#129).

  • PROV-CONSTRAINTS validation beyond what unified() checks (#62).

Reading other producers’ output

A round trip covers prov’s own output. Reading what other tools write is a separate claim. Each allowance below states its reason; prov does not adopt another implementation’s departure from the Recommendations without one.

Every reader warns ProvWarning and skips a hadMember, alternateOf, specializationOf or mentionOf that is missing a party, naming the statement as the reader’s errors do, and the rest of the document reads. A mentionOf without its bundle reads. A party given as JSON null (PROV-JSON, PROV-JSONLD) or as a blank <prov:entity/> still raises the reader’s error.

PROV-N profiles

Work with PROV-N lists what each of the three profiles, strict, default and lenient, accepts.

No profile accepts the keywords person, organization, softwareAgent, collection, emptyCollection, plan, wasRevisionOf, wasQuotedFrom or hadPrimarySource. They are not PROV-N. The grammar expresses subtypes through prov:type, no producer writes them and ProvToolbox’s reader rejects them; they raise ProvNSyntaxError under strict and default and are skipped under lenient.

The reader also accepts a leading byte order mark, a carriage return as a line end, an all-digit local name as an attribute name or datatype, and a bytearray stream. A declared prefix that is not a PN_PREFIX, a prefix name that holds an escape, a code point escape with a lowercase hex digit, a Unicode whitespace character other than space, tab, CR and LF between tokens, a duplicate bundle identifier, and an attribute named after one of the statement’s own arguments are errors.

PROV-XML

  • A reference element with no prov:ref whose child is itself a reference, the shape ProvToolbox writes for a hadMember member, is resolved with a ProvWarning; the intent is unambiguous. A reference with neither prov:ref nor text raises ProvXMLException.

  • A prov:hadMember element with several <prov:entity> children, which the schema allows, reads as one hadMember per member, each with the element’s prov:id, collection and attributes. An element with no <prov:entity> child is skipped with a ProvWarning.

  • <prov:other> elements and attributes the model cannot represent are skipped with a ProvWarning.

  • Names escaped as in C3 are unescaped.

  • The reader does not expand an entity declared in a DOCTYPE, internal or external, and never touches the network, because expansion opens a document to entity-expansion and file-disclosure attacks. A value that contains a reference to such an entity reads as the text before the reference, which is empty when the reference comes first. Predefined entities and character references, such as &amp; and &#67;, read as usual.

PROV-JSONLD

  • The decoder accepts the submission’s compacted shape only. It is not a JSON-LD processor: no expansion, no remote contexts.

  • ProvToolbox’s prov:-prefixed spellings of the type and special terms are accepted.

  • An array-valued entity on a Membership statement, which the submission (section 4.18) allows and ProvToolbox always writes, decodes to one hadMember per member, each with the statement’s @id and attributes; an empty array raises ProvJSONLDException.

  • Attribute values follow the 2026-10-14 revision of the PROV-JSONLD schema (openprov/prov-jsonld#7). A node reference, such as {"@id": "ex:shed"}, is a qualified name under any attribute. A bare string is an IRI under type, location and role, which the context coerces to @id, and a string under any other attribute. A node reference, or a bare string under those three terms, whose IRI no declared namespace compacts, raises ProvJSONLDException. One that names a blank node (_:) refers to no record, so the reader drops it with a ProvWarning and keeps the attribute’s other values. A node reference with a key other than @id, or with an empty @id, raises ProvJSONLDException. prov writes a qualified name under any attribute other than type, location and role as a node reference. It still reads an xsd:QName or prov:QUALIFIED_NAME value object as a qualified name, although a JSON-LD processor reads that as a typed literal. The schema’s label production admits only strings, so a qualified name under prov:label does not validate in either form.

PROV-O

  • An attribute predicate under a namespace declared neither in the document nor in the graph gets a minted prefix, with a ProvWarning.

  • A relation whose subject is a blank node reads with no identifier; an element’s blank-node label resolves in the default namespace.

  • An attribute whose object is a blank node that names no record, such as a prov:hadGeneration pointing at an anonymous generation, is dropped with a ProvWarning naming the subject and the predicate. A blank node that is an element’s subject resolves as that element’s identifier does, so it needs the default namespace the element itself needs.

  • The document declares the source’s own prefix bindings and the namespaces its names use, not rdflib’s default prefix bindings. A source declaration identical to one of those defaults, such as @prefix foaf: <http://xmlns.com/foaf/0.1/>, is kept only when a name, or the text of an xsd:QName or prov:QUALIFIED_NAME literal, uses it, and an unused ex is kept. The exception is a namespace the reader mints for a short IRI, such as the http:// of <http://alice.example>: it also declares every rdflib default binding under it, such as foaf, whether or not a name uses it. QName text under a prefix rdflib renamed, such as "dc:x"^^xsd:QName with the source’s dc bound to another IRI, reads under rdflib’s IRI for that prefix, because rdflib replaces the source’s binding at parse. A prefix the source declares and no name uses is not written by prov’s Turtle, so it does not survive a round trip.

  • A syntax with named graphs keeps bundles as separate graphs, for example trig and nquads. A triple syntax such as turtle, xml, nt or n3 flattens every bundle into one graph and loses which bundle each statement came from.

  • rdf_format selects the RDF syntax to read.

prov.read() detects the format from the content and forwards each reader’s own options (profile for PROV-N; rdf_format, relation_mapper and predicate_mapper for PROV-O; the json.load hooks for PROV-JSON and PROV-JSONLD, which receive each object after the check for repeated keys).

Edge cases

A table cell that cites a caveat points here. C3, C4, C11 and C12 apply to inputs no row covers.

  • C3. PROV-XML escapes attribute names that are not NCNames. A name may start with a digit or contain ' ( ) , : ; [ ] =; each illegal character is written as _xHHHH_, the OpenXML convention, and reversed on read. A third-party name that already looks like an escape is therefore unescaped.

  • C4. PROV-N local parts. A character PN_LOCAL cannot express, such as a space, cannot be in a local part: QualifiedName rejects it when built, from any format or from code, since the only PROV-N spelling would be a percent-encoding that reads back as a different IRI. PROV-O rejects an IRI containing a space. A namespace prefix must be a valid PN_PREFIX (a letter first, then name characters or ., not ending in .). Namespace rejects one that is not when it is built, from any format or from code, and prov does not rename it.

  • C5. Empty language tag. Literal("hi", langtag="") is rejected when built; PROV-XML’s xml:lang="" is rejected on read.

  • C6. Language tag that is not BCP 47. A tag such as en_US is rejected when the Literal is built, from any format or from code, so no writer meets one. A tag is letters, followed by any number of groups of letters and digits that each start with a hyphen. prov checks this shape only and does not look the tag up in the BCP 47 registry.

  • C7. Zone offsets that are not whole minutes. Python values gives the UTC rule. The instant is unchanged and the round trip compares equal; the original offset is not preserved.

  • C10. Literals rdflib normalises on read. rdflib rewrites some literal texts when it parses them, before prov sees them, so PROV-O reads these differently from every other format: an xsd:dateTime fraction beyond six digits is truncated to microseconds, so such a time reads as the truncated datetime where the other formats reject it as a time of a statement and keep it as a Literal as an attribute value; an xsd:decimal text in exponent form, such as 1e1, which is outside the lexical space and compares as text elsewhere, reads as rdflib’s decimal text and compares as the value 10; a numeric spelling such as 05 or 1e0 reads as the canonical one, which compares equal; and an xsd:duration text reads in rdflib’s normalised form, so PT0S reads as P0D and PT90M as PT1H30M, and the zero-duration row of the converted-value round trip is skipped for RDF.

  • C11. A NaN beside a decimal, or a decimal NaN beside a number. rdflib’s Turtle, long Turtle (longturtle), TriG and N3 writers order the values of one predicate by value. An xsd:decimal NaN or sNaN text, which rdflib parses to a Decimal, has no order against any number, and a well-formed xsd:decimal value has none against a NaN of any numeric datatype (a well-formed xsd:double or xsd:float, or a Python float). A record that holds either pair under one attribute therefore raises decimal.InvalidOperation when written to PROV-O in those four syntaxes. N-Triples, N-Quads, RDF/XML, JSON-LD, TriX and Hext write such a record, as does every other format.

  • C12. A prov:type equal to the record’s own type. PROV-O writes prov:type as rdf:type, so an asserted prov:type equal to the record’s own class, such as prov:Entity on an entity or prov:Derivation on a derivation, is the same triple as the record’s type. The reader cannot tell the two apart, so the value does not survive a round trip through PROV-O, and every other format keeps it. A subject typed with the class of its record type and with a subclass of that class, such as prov:Derivation and prov:Revision, reads back with the subclass as a prov:type and without the record type’s class, in every triple order. A subject typed with the classes of two record types, such as prov:Influence and prov:Derivation, takes its record type from whichever of the two rdf:type triples the reader meets first.

Corpus evidence

The PROV-N conformance corpus runs at every test run.

Set

Profile

Files

Result

Every example in the PROV-N and PROV-DM Recommendations

strict

127

94 parse and round-trip through the writer; 33 are excluded.

ProvToolbox’s hand-written PROV-N test documents

default

9

6 parse; 3 are excluded.

PROV-N that ProvToolbox’s writer produced from the shared test corpus, compared with the PROV-JSON fixture of the same name

default

388

229 equal; 159 differ for reasons in the generator, not in prov.

The corpus README names every excluded or differing file with its reason.