Skip to main content

Document

Struct Document 

Source
#[non_exhaustive]
pub struct Document { /* private fields */ }
Expand description

An SBOL document parsed from RDF.

Implementations§

Source§

impl Document

Source

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

Source

pub fn read(input: &str, format: RdfFormat) -> Result<Self, ReadError>

Parses an SBOL document from an in-memory RDF serialization.

Source

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.

Source

pub fn read_turtle(input: &str) -> Result<Self, ReadError>

Reads a Turtle serialization into an SBOL document.

Source

pub fn write(&self, format: RdfFormat) -> Result<String, WriteError>

Serializes the document in the given RDF format.

Source

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.

Source

pub fn write_turtle(&self) -> Result<String, WriteError>

Serializes the underlying RDF graph as Turtle.

Source

pub fn rdf_graph(&self) -> &RdfGraph

Returns the underlying RDF graph.

Source

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.

Source

pub fn get(&self, identity: &Resource) -> Option<&Object>

Returns the RDF-backed object at identity, if any.

Source

pub fn typed_objects(&self) -> &[SbolObject]

Returns the owned typed SBOL objects in the document, in identity order.

Source

pub fn resolve(&self, identity: &Resource) -> Option<&SbolObject>

Returns the owned typed object whose identity matches identity.

Source

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.

Source

pub fn attachments(&self) -> impl Iterator<Item = &Attachment>

Source

pub fn collections(&self) -> impl Iterator<Item = &Collection>

Source

pub fn combinatorial_derivations( &self, ) -> impl Iterator<Item = &CombinatorialDerivation>

Source

pub fn components(&self) -> impl Iterator<Item = &Component>

Source

pub fn component_references(&self) -> impl Iterator<Item = &ComponentReference>

Source

pub fn constraints(&self) -> impl Iterator<Item = &Constraint>

Source

pub fn cuts(&self) -> impl Iterator<Item = &Cut>

Source

pub fn entire_sequences(&self) -> impl Iterator<Item = &EntireSequence>

Source

pub fn experiments(&self) -> impl Iterator<Item = &Experiment>

Source

pub fn experimental_data(&self) -> impl Iterator<Item = &ExperimentalData>

Source

pub fn externally_defined(&self) -> impl Iterator<Item = &ExternallyDefined>

Source

pub fn implementations(&self) -> impl Iterator<Item = &Implementation>

Source

pub fn interactions(&self) -> impl Iterator<Item = &Interaction>

Source

pub fn interfaces(&self) -> impl Iterator<Item = &Interface>

Source

pub fn local_sub_components(&self) -> impl Iterator<Item = &LocalSubComponent>

Source

pub fn models(&self) -> impl Iterator<Item = &Model>

Source

pub fn participations(&self) -> impl Iterator<Item = &Participation>

Source

pub fn ranges(&self) -> impl Iterator<Item = &Range>

Source

pub fn sequences(&self) -> impl Iterator<Item = &Sequence>

Source

pub fn sequence_features(&self) -> impl Iterator<Item = &SequenceFeature>

Source

pub fn sub_components(&self) -> impl Iterator<Item = &SubComponent>

Source

pub fn variable_features(&self) -> impl Iterator<Item = &VariableFeature>

Source

pub fn activities(&self) -> impl Iterator<Item = &Activity>

Source

pub fn agents(&self) -> impl Iterator<Item = &Agent>

Source

pub fn associations(&self) -> impl Iterator<Item = &Association>

Source

pub fn plans(&self) -> impl Iterator<Item = &Plan>

Source

pub fn usages(&self) -> impl Iterator<Item = &Usage>

Source

pub fn measures(&self) -> impl Iterator<Item = &Measure>

Source

pub fn units(&self) -> impl Iterator<Item = &Unit>

Source

pub fn singular_units(&self) -> impl Iterator<Item = &SingularUnit>

Source

pub fn compound_units(&self) -> impl Iterator<Item = &CompoundUnit>

Source

pub fn unit_divisions(&self) -> impl Iterator<Item = &UnitDivision>

Source

pub fn unit_exponentiations(&self) -> impl Iterator<Item = &UnitExponentiation>

Source

pub fn unit_multiplications(&self) -> impl Iterator<Item = &UnitMultiplication>

Source

pub fn prefixed_units(&self) -> impl Iterator<Item = &PrefixedUnit>

Source

pub fn prefixes(&self) -> impl Iterator<Item = &Prefix>

Source

pub fn si_prefixes(&self) -> impl Iterator<Item = &SIPrefix>

Source

pub fn binary_prefixes(&self) -> impl Iterator<Item = &BinaryPrefix>

Source

pub fn identified_extensions( &self, ) -> impl Iterator<Item = &IdentifiedExtension>

Source

pub fn top_levels(&self) -> impl Iterator<Item = &SbolObject>

Iterates over the TopLevel typed objects in the document.

Source

pub fn namespaces(&self) -> impl Iterator<Item = &Iri> + '_

Iterates over the distinct namespaces declared by TopLevel objects in the document.

Source

pub fn validate(&self) -> ValidationReport

Builds a structured validation report.

Source

pub fn validate_with(&self, options: ValidationOptions) -> ValidationReport

Builds a structured validation report with explicit validation options.

Source

pub fn validate_with_context( &self, context: ValidationContext<'_>, ) -> ValidationReport

Builds a structured validation report with resolver-aware validation context.

Source

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.

Source

pub fn check_with( &self, options: ValidationOptions, ) -> Result<ValidationReport, ValidationReport>

check with explicit validation options.

Source

pub fn check_with_context( &self, context: ValidationContext<'_>, ) -> Result<ValidationReport, ValidationReport>

check with explicit resolver-aware validation context.

Source

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.

Source

pub fn check_complete_with( &self, options: ValidationOptions, ) -> Result<ValidationReport, ValidationReport>

check_complete with explicit validation options.

Source

pub fn check_complete_with_context( &self, context: ValidationContext<'_>, ) -> Result<ValidationReport, ValidationReport>

check_complete with explicit resolver-aware validation context.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Document

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ObjectGraph for Document

Source§

fn get(&self, iri: &Resource) -> Option<&Object>

Returns the RDF-backed property bag at iri, if present. Read more
Source§

fn resolve(&self, iri: &Resource) -> Option<&SbolObject>

Returns the owned typed SbolObject at iri, if present.
Source§

fn iter_typed(&self) -> Box<dyn Iterator<Item = &SbolObject> + '_>

Iterates every typed object in the scope. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V