Skip to main content

Crate sbol_convert

Crate sbol_convert 

Source
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§

DowngradeCounts
Tally of how many SBOL 3 constructs were rewritten.
DowngradeOptions
Configuration for sbol3_to_sbol2.
DowngradeReport
Report of every non-fatal issue plus tallies of what was rewritten.
UpgradeCounts
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).
UpgradeOptions
Configuration for sbol2_to_sbol3.
UpgradeReport
Report of every non-fatal issue encountered during an upgrade run, plus counts of what the converter rewrote.

Enums§

DowngradeError
Errors returned by sbol3_to_sbol2. These are fatal; non-fatal observations live on DowngradeReport instead.
DowngradeWarning
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.
MapsToSide
Which side of a MapsTo failed to resolve.
NamespaceSource
Indicates which path was taken when a namespace had to be derived without a usable persistentIdentity + displayId pair.
UpgradeError
Errors returned by sbol2_to_sbol3.
UpgradeFromPathError
Errors returned by upgrade_from_sbol2_path.
UpgradeWarning
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 Document to SBOL 2 RDF, returning the resulting graph alongside a DowngradeReport. See downgrade for the loss model.
downgrade_with
Like downgrade, with explicit DowngradeOptions.
parse_and_upgrade
Convenience wrapper: parses input bytes as an sbol2::Document, calls sbol2_to_sbol3 on its graph, then returns both the SBOL 3 Graph and the UpgradeReport. Produces the same graph as upgrade_from_sbol2.
sbol2_to_sbol3
Converts an SBOL 2 RDF graph to SBOL 3 RDF.
sbol3_to_sbol2
Converts an SBOL 3 Document to an RdfGraph of SBOL 2 RDF.
upgrade
Upgrades a parsed SBOL 2 sbol2::Document to SBOL 3 in memory and returns the resulting Document alongside an UpgradeReport of any non-fatal issues encountered during conversion.
upgrade_from_sbol2
Upgrades an SBOL 2 RDF document to SBOL 3 and returns the resulting Document alongside an UpgradeReport of 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 explicit UpgradeOptions.
upgrade_with
Like upgrade, with explicit UpgradeOptions.