Skip to content

feat(writer): encode a typed container index and linksets as RDF/XML (0.2.2) - #9

Merged
GeneralPawz merged 2 commits into
mainfrom
feat/typed-rdf-writer
Nov 3, 2026
Merged

GeneralPawz merged 2 commits into
mainfrom
feat/typed-rdf-writer

Conversation

@GeneralPawz

Copy link
Copy Markdown
Contributor

Closes #8. Needed by openbimrs/solibri#83.

Added

  • ContainerIndex::to_rdf_xml(base_iri) and LinkSet::to_rdf_xml(index, base_iri): deterministic RDF/XML using the ISO 21597-1 ct:/ls: classes from the issue.
  • IcddArchiveBuilder::from_index(index, base_iri) and add_typed_linkset(linkset).
    • Signature change from the issue: the builder keeps the typed index and base, so a linkset cannot be checked against a different index or base than the one in Index.rdf.
  • PartialEq/Eq on the schema types.

Changed

  • conformance_issues() now also reports a linkset document that is not in the index.
  • The Poing federation Index.rdf is built by the encoder. Its bytes change: ct:url is typed xsd:anyURI and the prefix declarations differ.

Rejected input

NotConformant for:

  • ISO cardinality violations: directed links without from/to, links with fewer than 2 elements, query identifiers missing their language or expression;
  • duplicates;
  • invalid blank-node labels;
  • invalid ct:creationDate;
  • XML 1.0 control characters.

Tests

  • Round trips (parse(to_rdf_xml(x)) == x), hand-built and seeded-generated.
  • Negative conformance tests and error tests for each rule.

Gate: ./scripts/gate.sh passes.

A consumer that writes a container with its own documents and links had to
assemble the ct: and ls: triples itself, duplicating the vocabulary this
crate owns, while federation.rs built its Index.rdf privately.

Add ContainerIndex::to_rdf_xml, LinkSet::to_rdf_xml,
IcddArchiveBuilder::from_index and add_typed_linkset. They encode through
vocab and serialize_rdf_xml, so output is deterministic, and they round-trip
through parse_index and parse_linkset. Input the readers could not represent
faithfully, or that breaks the Linkset cardinalities, returns NotConformant.
from_index keeps the typed index and base, so add_typed_linkset validates a
linkset against the index that was written; conformance_issues now reports
link elements that name a document missing from the index. Derive PartialEq
and Eq on the schema types so values can be compared. The Poing federation
writer now builds its index through the same encoder.

Closes #8
Adds public API only (typed RDF/XML writing, PartialEq and Eq derives), so
a patch bump: 0.2.2. The alias pin follows. The alias-purity mutation test
hardcoded 0.2.1; it now reads the manifest version so releases do not break it.
@GeneralPawz
GeneralPawz merged commit 7e294c7 into main Nov 3, 2026
2 checks passed
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.

Encode a typed container index and linksets as RDF/XML

1 participant