Struct fastobo::visit::IdCompactor
source · pub struct IdCompactor { /* private fields */ }
Expand description
A visitor that will compact identifiers in an OBO document.
Usage
The compactor will follow the rules from the OBO specification:
- if the document declares an IDSpace prefix
p
that maps to an Urlu
, URL identifiers that can be factorized as{u}{v}
will be replaced by Prefixed identifiers{p}:{v}
- if the document does not declare an IDSpace
p'
, URL identifiers that can be factorized ashttp://purl.obolibrary.org/obo/{p'}_{id}
will be replaced by Prefixed identifiers{p'}:{id}
.
Example
let mut doc = fastobo::from_str(
"[Term]
id: http://purl.obolibrary.org/obo/BFO_0000055
").unwrap();
IdCompactor::new().visit_doc(&mut doc);
assert_eq!(doc.to_string(),
"[Term]
id: BFO:0000055
");
See also
- IdDecompactor that does the opposite.
Implementations§
source§impl IdCompactor
impl IdCompactor
Trait Implementations§
source§impl Clone for IdCompactor
impl Clone for IdCompactor
source§fn clone(&self) -> IdCompactor
fn clone(&self) -> IdCompactor
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IdCompactor
impl Debug for IdCompactor
source§impl Default for IdCompactor
impl Default for IdCompactor
source§fn default() -> IdCompactor
fn default() -> IdCompactor
Returns the “default value” for a type. Read more
source§impl VisitMut for IdCompactor
impl VisitMut for IdCompactor
fn visit_header_frame(&mut self, header: &mut HeaderFrame)
fn visit_ident(&mut self, id: &mut Ident)
fn visit_class_ident(&mut self, id: &mut ClassIdent)
fn visit_creation_date(&mut self, creation_date: &mut CreationDate)
fn visit_definition(&mut self, id: &mut Definition)
fn visit_doc(&mut self, doc: &mut OboDoc)
fn visit_entity_frame(&mut self, frame: &mut EntityFrame)
fn visit_header_clause(&mut self, clause: &mut HeaderClause)
fn visit_ident_prefix(&mut self, prefix: &mut IdentPrefix)
fn visit_import(&mut self, import: &mut Import)
fn visit_instance_clause(&mut self, clause: &mut InstanceClause)
fn visit_instance_frame(&mut self, frame: &mut InstanceFrame)
fn visit_instance_ident(&mut self, id: &mut InstanceIdent)
fn visit_iso_date(&mut self, date: &mut IsoDate)
fn visit_iso_datetime(&mut self, datetime: &mut IsoDateTime)
fn visit_iso_time(&mut self, time: &mut IsoTime)
fn visit_literal_property_value(&mut self, id: &mut LiteralPropertyValue)
fn visit_naive_date(&mut self, date: &mut NaiveDateTime)
fn visit_namespace_ident(&mut self, id: &mut NamespaceIdent)
fn visit_property_value(&mut self, pv: &mut PropertyValue)
fn visit_prefixed_ident(&mut self, id: &mut PrefixedIdent)
fn visit_quoted_string(&mut self, string: &mut QuotedString)
fn visit_relation_ident(&mut self, id: &mut RelationIdent)
fn visit_resource_property_value(&mut self, id: &mut ResourcePropertyValue)
fn visit_subset_ident(&mut self, id: &mut SubsetIdent)
fn visit_synonym(&mut self, syn: &mut Synonym)
fn visit_synonym_scope(&mut self, scope: &mut SynonymScope)
fn visit_synonymtype_ident(&mut self, id: &mut SynonymTypeIdent)
fn visit_term_clause(&mut self, clause: &mut TermClause)
fn visit_term_frame(&mut self, frame: &mut TermFrame)
fn visit_typedef_clause(&mut self, clause: &mut TypedefClause)
fn visit_typedef_frame(&mut self, frame: &mut TypedefFrame)
fn visit_unprefixed_ident(&mut self, string: &mut UnprefixedIdent)
fn visit_unquoted_string(&mut self, string: &mut UnquotedString)
fn visit_url(&mut self, url: &mut Url)
fn visit_xref(&mut self, xref: &mut Xref)
fn visit_xref_list(&mut self, xrefs: &mut XrefList)
Auto Trait Implementations§
impl RefUnwindSafe for IdCompactor
impl Send for IdCompactor
impl Sync for IdCompactor
impl Unpin for IdCompactor
impl UnwindSafe for IdCompactor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more