Skip to content

Require spec-mandatory relation endpoints, dedupe serializer namespace bootstrap, and drop ProvNamespace::contains()#19

Merged
amateescu merged 1 commit into
mainfrom
mandatory-endpoints-and-ns-cleanup
Jul 5, 2026
Merged

Require spec-mandatory relation endpoints, dedupe serializer namespace bootstrap, and drop ProvNamespace::contains()#19
amateescu merged 1 commit into
mainfrom
mandatory-endpoints-and-ns-cleanup

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Changes

  • Builder methods now require every PROV-mandatory relation endpoint as a non-nullable parameter (via resolveRequiredIdentifier()): wasGeneratedBy/wasInvalidatedBy entity; used/wasStartedBy/wasEndedBy/wasAssociatedWith activity; wasInformedBy both activities; wasDerivedFrom (and wasRevisionOf/wasQuotedFrom/hadPrimarySource) both entities; wasAttributedTo entity+agent; actedOnBehalfOf both agents; wasInfluencedBy both; specializationOf/alternateOf both; hadMember collection+entity; mentionOf specific+general+bundle; the dictionary relations' ref params. A builder call can no longer emit a - marker in a grammar-mandatory slot.
  • Model constructors are non-nullable, and the PROV-N/JSON/XML deserializers throw DeserializationException, only for endpoints no real document omits: Generation/Invalidation entity, Specialization/Alternate/Mention entity pairs, and the dictionary refs. The rest stay nullable and lenient on the read path so the openprov/testcases corpus (whose reference implementation emits - in some mandatory slots, e.g. wasAttributedTo agent and mentionOf bundle) still round-trips.
  • Mandatory/optional split re-derived from the PROV-N grammar productions, with mentionOf from PROV-LINKS and the dictionary relations from PROV-DICTIONARY.
  • identifier loses its constructor default on the affected relations (a required parameter cannot follow an optional one); it stays nullable-typed but is no longer positionally omittable.
  • NamespaceManager::forContainer() and stripDefaultSentinel() replace the namespace-bootstrap loop duplicated across the serializers, deserializers, and ProvGraph, and the three copies of the default-sentinel strip.
  • Remove ProvNamespace::contains() (no callers; NamespaceManager owns URI matching).
  • Add RecordBuilder::getNamespaceManager() so a caller assembling attributes can share the builder's live registry.

…e bootstrap, and drop ProvNamespace::contains()
@amateescu amateescu force-pushed the mandatory-endpoints-and-ns-cleanup branch from 06abca1 to 0407b46 Compare July 5, 2026 21:40
@amateescu amateescu merged commit e75fec3 into main Jul 5, 2026
7 checks passed
@amateescu amateescu deleted the mandatory-endpoints-and-ns-cleanup branch July 5, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant