#[non_exhaustive]pub struct Document { /* private fields */ }Expand description
An SBOL document parsed from RDF.
Implementations§
Source§impl Document
impl Document
Sourcepub fn from_objects(objects: Vec<SbolObject>) -> Result<Self, BuildError>
pub fn from_objects(objects: Vec<SbolObject>) -> Result<Self, BuildError>
Builds a document from owned typed SBOL objects.
The supplied typed values are retained as the document’s primary typed surface; the RDF graph and property-bag indexed map are derived from them so the document is round-trip ready.
Source§impl Document
impl Document
Sourcepub fn read(input: &str, format: RdfFormat) -> Result<Self, ReadError>
pub fn read(input: &str, format: RdfFormat) -> Result<Self, ReadError>
Parses an SBOL document from an in-memory RDF serialization.
Sourcepub fn read_path(path: impl AsRef<Path>) -> Result<Self, ReadError>
pub fn read_path(path: impl AsRef<Path>) -> Result<Self, ReadError>
Parses an SBOL document from a file. The format is inferred from the
path’s extension (.ttl, .rdf, .jsonld, .nt). Returns
ReadError::UnknownFormat for any other extension.
Sourcepub fn read_turtle(input: &str) -> Result<Self, ReadError>
pub fn read_turtle(input: &str) -> Result<Self, ReadError>
Reads a Turtle serialization into an SBOL document.
Sourcepub fn write(&self, format: RdfFormat) -> Result<String, WriteError>
pub fn write(&self, format: RdfFormat) -> Result<String, WriteError>
Serializes the document in the given RDF format.
Sourcepub fn write_path(
&self,
path: impl AsRef<Path>,
format: RdfFormat,
) -> Result<(), WriteError>
pub fn write_path( &self, path: impl AsRef<Path>, format: RdfFormat, ) -> Result<(), WriteError>
Writes the document to a file in the given RDF format. The caller chooses the format explicitly; no inference from the path’s extension is performed.
Sourcepub fn write_turtle(&self) -> Result<String, WriteError>
pub fn write_turtle(&self) -> Result<String, WriteError>
Serializes the underlying RDF graph as Turtle.
Sourcepub fn objects(&self) -> &BTreeMap<Resource, Object>
pub fn objects(&self) -> &BTreeMap<Resource, Object>
Returns RDF-backed objects indexed by identity.
These are property-bag values preserving every triple under each
subject — including PROV/OM and extension classes that do not yet
have an owned typed representation. For SBOL classes with an owned
surface, prefer Document::components and friends.
Sourcepub fn get(&self, identity: &Resource) -> Option<&Object>
pub fn get(&self, identity: &Resource) -> Option<&Object>
Returns the RDF-backed object at identity, if any.
Sourcepub fn typed_objects(&self) -> &[SbolObject]
pub fn typed_objects(&self) -> &[SbolObject]
Returns the owned typed SBOL objects in the document, in identity order.
Sourcepub fn resolve(&self, identity: &Resource) -> Option<&SbolObject>
pub fn resolve(&self, identity: &Resource) -> Option<&SbolObject>
Returns the owned typed object whose identity matches identity.
Sourcepub fn find_by_display_id(
&self,
namespace: &str,
display_id: &str,
) -> Option<&SbolObject>
pub fn find_by_display_id( &self, namespace: &str, display_id: &str, ) -> Option<&SbolObject>
Returns the owned typed object whose compliant identity matches
{namespace}/[local/]{display_id}. The local path is optional
per SBOL 3.1.0 §5.1, so this scans every typed object whose
identity has the right namespace prefix and ends in the given
display_id rather than constructing a fixed IRI.
pub fn attachments(&self) -> impl Iterator<Item = &Attachment>
pub fn collections(&self) -> impl Iterator<Item = &Collection>
pub fn combinatorial_derivations( &self, ) -> impl Iterator<Item = &CombinatorialDerivation>
pub fn components(&self) -> impl Iterator<Item = &Component>
pub fn component_references(&self) -> impl Iterator<Item = &ComponentReference>
pub fn constraints(&self) -> impl Iterator<Item = &Constraint>
pub fn cuts(&self) -> impl Iterator<Item = &Cut>
pub fn entire_sequences(&self) -> impl Iterator<Item = &EntireSequence>
pub fn experiments(&self) -> impl Iterator<Item = &Experiment>
pub fn experimental_data(&self) -> impl Iterator<Item = &ExperimentalData>
pub fn externally_defined(&self) -> impl Iterator<Item = &ExternallyDefined>
pub fn implementations(&self) -> impl Iterator<Item = &Implementation>
pub fn interactions(&self) -> impl Iterator<Item = &Interaction>
pub fn interfaces(&self) -> impl Iterator<Item = &Interface>
pub fn local_sub_components(&self) -> impl Iterator<Item = &LocalSubComponent>
pub fn models(&self) -> impl Iterator<Item = &Model>
pub fn participations(&self) -> impl Iterator<Item = &Participation>
pub fn ranges(&self) -> impl Iterator<Item = &Range>
pub fn sequences(&self) -> impl Iterator<Item = &Sequence>
pub fn sequence_features(&self) -> impl Iterator<Item = &SequenceFeature>
pub fn sub_components(&self) -> impl Iterator<Item = &SubComponent>
pub fn variable_features(&self) -> impl Iterator<Item = &VariableFeature>
pub fn activities(&self) -> impl Iterator<Item = &Activity>
pub fn agents(&self) -> impl Iterator<Item = &Agent>
pub fn associations(&self) -> impl Iterator<Item = &Association>
pub fn plans(&self) -> impl Iterator<Item = &Plan>
pub fn usages(&self) -> impl Iterator<Item = &Usage>
pub fn measures(&self) -> impl Iterator<Item = &Measure>
pub fn units(&self) -> impl Iterator<Item = &Unit>
pub fn singular_units(&self) -> impl Iterator<Item = &SingularUnit>
pub fn compound_units(&self) -> impl Iterator<Item = &CompoundUnit>
pub fn unit_divisions(&self) -> impl Iterator<Item = &UnitDivision>
pub fn unit_exponentiations(&self) -> impl Iterator<Item = &UnitExponentiation>
pub fn unit_multiplications(&self) -> impl Iterator<Item = &UnitMultiplication>
pub fn prefixed_units(&self) -> impl Iterator<Item = &PrefixedUnit>
pub fn prefixes(&self) -> impl Iterator<Item = &Prefix>
pub fn si_prefixes(&self) -> impl Iterator<Item = &SIPrefix>
pub fn binary_prefixes(&self) -> impl Iterator<Item = &BinaryPrefix>
pub fn identified_extensions( &self, ) -> impl Iterator<Item = &IdentifiedExtension>
Sourcepub fn top_levels(&self) -> impl Iterator<Item = &SbolObject>
pub fn top_levels(&self) -> impl Iterator<Item = &SbolObject>
Iterates over the TopLevel typed objects in the document.
Sourcepub fn namespaces(&self) -> impl Iterator<Item = &Iri> + '_
pub fn namespaces(&self) -> impl Iterator<Item = &Iri> + '_
Iterates over the distinct namespaces declared by TopLevel objects in the document.
Sourcepub fn validate(&self) -> ValidationReport
pub fn validate(&self) -> ValidationReport
Builds a structured validation report.
Sourcepub fn validate_with(&self, options: ValidationOptions) -> ValidationReport
pub fn validate_with(&self, options: ValidationOptions) -> ValidationReport
Builds a structured validation report with explicit validation options.
Sourcepub fn validate_with_context(
&self,
context: ValidationContext<'_>,
) -> ValidationReport
pub fn validate_with_context( &self, context: ValidationContext<'_>, ) -> ValidationReport
Builds a structured validation report with resolver-aware validation context.
Sourcepub fn check(&self) -> Result<ValidationReport, ValidationReport>
pub fn check(&self) -> Result<ValidationReport, ValidationReport>
Runs validation and returns the report wrapped as Ok when no
fully-evaluated rule reported an error, or Err carrying the
same report when any rule did. Coverage gaps from Partial rules
do not on their own cause Err; use check_complete for that.
Sourcepub fn check_with(
&self,
options: ValidationOptions,
) -> Result<ValidationReport, ValidationReport>
pub fn check_with( &self, options: ValidationOptions, ) -> Result<ValidationReport, ValidationReport>
check with explicit validation options.
Sourcepub fn check_with_context(
&self,
context: ValidationContext<'_>,
) -> Result<ValidationReport, ValidationReport>
pub fn check_with_context( &self, context: ValidationContext<'_>, ) -> Result<ValidationReport, ValidationReport>
check with explicit resolver-aware validation context.
Sourcepub fn check_complete(&self) -> Result<ValidationReport, ValidationReport>
pub fn check_complete(&self) -> Result<ValidationReport, ValidationReport>
Like check, but also returns Err when any rule’s coverage
is partial — i.e. the validator was unable to fully evaluate it
for this run. Use for CI gates against documents the team
controls end-to-end.
Sourcepub fn check_complete_with(
&self,
options: ValidationOptions,
) -> Result<ValidationReport, ValidationReport>
pub fn check_complete_with( &self, options: ValidationOptions, ) -> Result<ValidationReport, ValidationReport>
check_complete with explicit validation options.
Sourcepub fn check_complete_with_context(
&self,
context: ValidationContext<'_>,
) -> Result<ValidationReport, ValidationReport>
pub fn check_complete_with_context( &self, context: ValidationContext<'_>, ) -> Result<ValidationReport, ValidationReport>
check_complete with explicit resolver-aware validation context.
Trait Implementations§
Source§impl ObjectGraph for Document
impl ObjectGraph for Document
Source§fn get(&self, iri: &Resource) -> Option<&Object>
fn get(&self, iri: &Resource) -> Option<&Object>
iri, if present. Read moreSource§fn resolve(&self, iri: &Resource) -> Option<&SbolObject>
fn resolve(&self, iri: &Resource) -> Option<&SbolObject>
SbolObject at iri, if present.