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)) == docfor 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 thedefaultprofile, and understrictwhen written withstrict=True, except that a strict write drops the identifier and attribute block of ahadMember,alternateOforspecializationOfthat carries either (Work with PROV-N).provenforces no structural constraint at assertion time, except thathadMember,alternateOf,specializationOfandmentionOfrequire their parties; general validation is #62. Merge-time conformance, PROV-CONSTRAINTS unification, isunified()’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 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Activity §5.1.2 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Generation §5.1.3 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Usage §5.1.4 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Communication §5.1.5 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Start §5.1.6 |
|
|
✓ |
✓ |
✓ |
✓ |
|
End §5.1.7 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Invalidation §5.1.8 |
|
|
✓ |
✓ |
✓ |
✓ |
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 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Revision §5.2.2 |
|
|
|
✓ |
✓ |
✓ |
✓ |
Quotation §5.2.3 |
|
|
|
✓ |
✓ |
✓ |
✓ |
Primary Source §5.2.4 |
|
|
|
✓ |
✓ |
✓ |
✓ |
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 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Person / Organization / SoftwareAgent §5.3.1 |
|
none, see “Not implemented” |
|
✓ |
✓ |
✓ |
✓ |
Attribution §5.3.2 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Association §5.3.3 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Plan §5.3.3 |
the entity named by |
none |
none; the plan is the association’s third argument |
✓ |
✓ |
✓ |
✓ |
Delegation §5.3.4 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Influence §5.3.5 |
|
|
✓ |
✓ |
✓ |
✓ |
Component 4: Bundles¶
Concept (PROV-DM §) |
Model class |
Factory / alias |
PROV-N keyword |
JSON |
XML |
RDF |
JSON-LD |
|---|---|---|---|---|---|---|---|
Bundle constructor §5.4.1 |
|
|
✓ |
✓ |
✓ |
✓ |
|
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 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Alternate §5.5.2 |
|
|
✓ |
✓ |
✓ |
✓ |
|
Mention (PROV-Links) |
|
|
✓ |
✓ |
✓ |
✗ 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 |
|
|
|
✓ |
✓ |
✓ |
✓ |
EmptyCollection §5.6 |
|
none, see “Not implemented” |
|
✓ |
✓ |
✓ |
✓ |
Membership §5.6 |
|
|
✓ |
✓ |
✓ |
✓ |
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 |
a string |
✓ in every format |
Language-tagged string |
the tag as given; tags compare case-insensitively |
✓ C5 C6 |
Boolean |
|
✓ |
Python |
the datatype that Python values gives for its size; PROV-N writes |
✓ |
Integer with an asserted datatype ( |
the asserted datatype, never collapsed to a narrower one |
✓ |
|
as given; |
✓ |
Python |
|
✓ |
Qualified name as a value |
|
✓ |
|
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 |
✓ C7 C10 |
|
lexical form and datatype as given, compared by the rules in Equality; an |
✓ 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
ProvMentionraisesprov.serializers.provjsonld.ProvJSONLDException.
Format notes¶
C8. RDF’s
json-ldsyntax 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. Useformat="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 theprov:typethroughother_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:refwhose child is itself a reference, the shape ProvToolbox writes for ahadMembermember, is resolved with aProvWarning; the intent is unambiguous. A reference with neitherprov:refnor text raisesProvXMLException.A
prov:hadMemberelement with several<prov:entity>children, which the schema allows, reads as onehadMemberper member, each with the element’sprov:id, collection and attributes. An element with no<prov:entity>child is skipped with aProvWarning.<prov:other>elements and attributes the model cannot represent are skipped with aProvWarning.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&andC, 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
entityon aMembershipstatement, which the submission (section 4.18) allows and ProvToolbox always writes, decodes to onehadMemberper member, each with the statement’s@idand attributes; an empty array raisesProvJSONLDException.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 undertype,locationandrole, 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, raisesProvJSONLDException. One that names a blank node (_:) refers to no record, so the reader drops it with aProvWarningand keeps the attribute’s other values. A node reference with a key other than@id, or with an empty@id, raisesProvJSONLDException.provwrites a qualified name under any attribute other thantype,locationandroleas a node reference. It still reads anxsd:QNameorprov:QUALIFIED_NAMEvalue object as a qualified name, although a JSON-LD processor reads that as a typed literal. The schema’slabelproduction admits only strings, so a qualified name underprov:labeldoes 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:hadGenerationpointing at an anonymous generation, is dropped with aProvWarningnaming 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 anxsd:QNameorprov:QUALIFIED_NAMEliteral, uses it, and an unusedexis kept. The exception is a namespace the reader mints for a short IRI, such as thehttp://of<http://alice.example>: it also declares every rdflib default binding under it, such asfoaf, whether or not a name uses it. QName text under a prefix rdflib renamed, such as"dc:x"^^xsd:QNamewith the source’sdcbound 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 byprov’s Turtle, so it does not survive a round trip.A syntax with named graphs keeps bundles as separate graphs, for example
trigandnquads. A triple syntax such asturtle,xml,ntorn3flattens every bundle into one graph and loses which bundle each statement came from.rdf_formatselects 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_LOCALcannot express, such as a space, cannot be in a local part:QualifiedNamerejects 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 validPN_PREFIX(a letter first, then name characters or., not ending in.).Namespacerejects one that is not when it is built, from any format or from code, andprovdoes not rename it.C5. Empty language tag.
Literal("hi", langtag="")is rejected when built; PROV-XML’sxml:lang=""is rejected on read.C6. Language tag that is not BCP 47. A tag such as
en_USis rejected when theLiteralis 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.provchecks 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
provsees them, so PROV-O reads these differently from every other format: anxsd:dateTimefraction beyond six digits is truncated to microseconds, so such a time reads as the truncateddatetimewhere the other formats reject it as a time of a statement and keep it as aLiteralas an attribute value; anxsd:decimaltext in exponent form, such as1e1, which is outside the lexical space and compares as text elsewhere, reads as rdflib’s decimal text and compares as the value10; a numeric spelling such as05or1e0reads as the canonical one, which compares equal; and anxsd:durationtext reads in rdflib’s normalised form, soPT0Sreads asP0DandPT90MasPT1H30M, and the zero-duration row of the converted-value round trip is skipped for RDF.C11. A
NaNbeside a decimal, or a decimalNaNbeside a number. rdflib’s Turtle, long Turtle (longturtle), TriG and N3 writers order the values of one predicate by value. Anxsd:decimalNaNorsNaNtext, which rdflib parses to aDecimal, has no order against any number, and a well-formedxsd:decimalvalue has none against a NaN of any numeric datatype (a well-formedxsd:doubleorxsd:float, or a Pythonfloat). A record that holds either pair under one attribute therefore raisesdecimal.InvalidOperationwhen 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:typeequal to the record’s own type. PROV-O writesprov:typeasrdf:type, so an assertedprov:typeequal to the record’s own class, such asprov:Entityon an entity orprov:Derivationon 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 asprov:Derivationandprov:Revision, reads back with the subclass as aprov:typeand without the record type’s class, in every triple order. A subject typed with the classes of two record types, such asprov:Influenceandprov:Derivation, takes its record type from whichever of the twordf:typetriples 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 |
|
127 |
94 parse and round-trip through the writer; 33 are excluded. |
ProvToolbox’s hand-written PROV-N test documents |
|
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 |
|
388 |
229 equal; 159 differ for reasons in the generator, not in |
The corpus README names every excluded or differing file with its reason.