Skip to content

Harden namespace registration plus serializer, validator, and builder cleanups#15

Merged
amateescu merged 1 commit into
mainfrom
api-and-cleanups
Jun 13, 2026
Merged

Harden namespace registration plus serializer, validator, and builder cleanups#15
amateescu merged 1 commit into
mainfrom
api-and-cleanups

Conversation

@amateescu

Copy link
Copy Markdown
Owner

Changes

  • NamespaceManager::add() now throws on any prefix conflict, including the prov/xsd built-ins, closing a silent-override hole; add addOrReplace() for the deserializer/serializer/ProvGraph path where the container is the authority on its own declarations.
  • Add QualifiedName::blankNode(string) for explicit blank-node labels and Attributes::merge() (multimap union, promoting a single value to several under a shared key).
  • DocumentBuilder(iterable $namespaces) constructor and Prov::documentBuilder(iterable) to preload namespaces.
  • #[\NoDiscard] on Prov::validate() and Prov::deserialize().
  • Literal::int() rejects values outside the 32-bit range; PROV-N and PROV-XML emit xsd:long for out-of-range PHP ints.
  • ConstraintViolationList implements IteratorAggregate.
  • Consolidate the relation endpoint walkers onto RelationMetadata::refEndpoints()/dictionaryEntities(); ProvGraph::referencedIdentifiers() delegates to them.
  • JSON serializer: omit an empty prefix map (an empty document stays {}); throw on duplicate bundle identifiers.
  • XML serializer: reversible digit-prefix element-name escaping so a genuine _0foo attribute round-trips.
  • DocumentComparator: normalize raw-array dictionary key datatypes to full URIs.
  • RecordBuilder::resolveAttributes() returns the Attributes::empty() singleton; document merge() concatenation semantics; reword the RelationMetadata::FORMALS docblock.
  • Remove ProvNamespace::urnUuid() (a consumer-specific minting helper); URN resolution itself is unchanged.
  • Tooling: PHPUnit random execution order + cache directory, explicit ext-dom in require-dev, and scope the mago imprecise-type suppression to the four classes that need it.
  • Tests: namespace strictness/addOrReplace, blank-node factory, attribute merge, int-range typing, comparator datatype normalization, violation-list iteration, JSON/XML malformed-input fuzzing, a validator reorder-stability harness, constraint 33/34 boundary directions, ProvGraph default-prefix and built-in-redeclaration cases, and property-pool entries for escapable punctuation and slash/versioned/URN identifiers; tighten the round-trip census so PROV-N/JSON rejection no longer counts as a pass.
  • README: PROV-N grammar-extension and identifier-drop notes, DI guidance, and the kept helpers folded into the builder tips.

…pers, and clean up serializers, validator, and tooling
@amateescu amateescu merged commit 442c3f0 into main Jun 13, 2026
7 checks passed
@amateescu amateescu deleted the api-and-cleanups branch June 13, 2026 10:59
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