Expand description
SBOL version conversion for the sbol-rs ecosystem.
This crate converts between SBOL 2 and SBOL 3 at the RDF triple level.
upgrade converts a parsed sbol2::Document in memory, and
upgrade_from_sbol2 and friends read SBOL 2 RDF text or files; both
build an sbol3::Document. downgrade takes an sbol3::Document
and emits the equivalent SBOL 2 RDF graph. Every conversion also returns
a report of any non-fatal issues encountered along the way.
Structs§
- Downgrade
Counts - Tally of how many SBOL 3 constructs were rewritten.
- Downgrade
Options - Configuration for
sbol3_to_sbol2. - Downgrade
Report - Report of every non-fatal issue plus tallies of what was rewritten.
- Upgrade
Counts - Tally of how many SBOL 2 constructs the upgrade rewrote into SBOL 3 constructs. Useful for end-of-run summaries and CI signals (e.g. an expected document type accidentally dropping to zero across a refactor).
- Upgrade
Options - Configuration for
sbol2_to_sbol3. - Upgrade
Report - Report of every non-fatal issue encountered during an upgrade run, plus counts of what the converter rewrote.
Enums§
- Downgrade
Error - Errors returned by
sbol3_to_sbol2. These are fatal; non-fatal observations live onDowngradeReportinstead. - Downgrade
Warning - Non-fatal observations from
sbol3_to_sbol2. Each warning records a case where the SBOL 2 representation forced a choice the SBOL 3 source didn’t have to make. - Maps
ToSide - Which side of a MapsTo failed to resolve.
- Namespace
Source - Indicates which path was taken when a namespace had to be derived without
a usable
persistentIdentity+displayIdpair. - Upgrade
Error - Errors returned by
sbol2_to_sbol3. - Upgrade
From Path Error - Errors returned by
upgrade_from_sbol2_path. - Upgrade
Warning - Warnings emitted by
sbol2_to_sbol3. The presence of warnings does not stop conversion. Every warning records something the upgrade could not translate cleanly but chose not to fail on.
Functions§
- canonical_
nt_ line - Canonical N-Triples line for a single triple, used by the snapshot
regenerator and the conformance test so both sides agree on formatting.
xsd:string-typed literals are emitted in bare form (matching sbol-utilities and the N-Triples 1.1 convention) so plain-string divergences don’t masquerade as data drift. Embedded control characters in literals are escaped per the N-Triples grammar (\n,\r,\t,\\,\") so each triple stays on a single line for diff-friendly snapshot files. - downgrade
- Downgrades an SBOL 3
Documentto SBOL 2 RDF, returning the resulting graph alongside aDowngradeReport. Seedowngradefor the loss model. - downgrade_
with - Like
downgrade, with explicitDowngradeOptions. - parse_
and_ upgrade - Convenience wrapper: parses input bytes as an
sbol2::Document, callssbol2_to_sbol3on its graph, then returns both the SBOL 3Graphand theUpgradeReport. Produces the same graph asupgrade_from_sbol2. - sbol2_
to_ sbol3 - Converts an SBOL 2 RDF graph to SBOL 3 RDF.
- sbol3_
to_ sbol2 - Converts an SBOL 3
Documentto anRdfGraphof SBOL 2 RDF. - upgrade
- Upgrades a parsed SBOL 2
sbol2::Documentto SBOL 3 in memory and returns the resultingDocumentalongside anUpgradeReportof any non-fatal issues encountered during conversion. - upgrade_
from_ sbol2 - Upgrades an SBOL 2 RDF document to SBOL 3 and returns the resulting
Documentalongside anUpgradeReportof any non-fatal issues encountered during conversion. - upgrade_
from_ sbol2_ path - Reads an SBOL 2 RDF file from disk and upgrades it to SBOL 3. The
format is inferred from the path’s extension (
.ttl,.rdf,.xml,.jsonld,.nt). - upgrade_
from_ sbol2_ with - Like
upgrade_from_sbol2, with explicitUpgradeOptions. - upgrade_
with - Like
upgrade, with explicitUpgradeOptions.