[][src]Struct fastobo::visit::IdCompactor

pub struct IdCompactor { /* fields omitted */ }

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 Url u, 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 as http://purl.obolibrary.org/obo/{p'}_{id} will be replaced by Prefixed identifiers {p'}:{id}.

Example

let mut doc = OboDoc::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
");

* [IdDecompactor](./struct.IdDecompactor.html) that does the opposite.

Methods

impl IdCompactor[src]

pub fn new() -> Self[src]

Trait Implementations

impl VisitMut for IdCompactor[src]

fn visit_class_ident(&mut self, id: &mut ClassIdent)[src]

fn visit_doc(&mut self, doc: &mut OboDoc)[src]

fn visit_entity_frame(&mut self, frame: &mut EntityFrame)[src]

fn visit_header_clause(&mut self, clause: &mut HeaderClause)[src]

fn visit_ident_local(&mut self, prefix: &mut IdentLocal)[src]

fn visit_ident_prefix(&mut self, prefix: &mut IdentPrefix)[src]

fn visit_import(&mut self, import: &mut Import)[src]

fn visit_instance_clause(&mut self, clause: &mut InstanceClause)[src]

fn visit_instance_frame(&mut self, frame: &mut InstanceFrame)[src]

fn visit_instance_ident(&mut self, id: &mut InstanceIdent)[src]

fn visit_iso_date(&mut self, date: &mut IsoDateTime)[src]

fn visit_naive_date(&mut self, date: &mut NaiveDateTime)[src]

fn visit_namespace_ident(&mut self, id: &mut NamespaceIdent)[src]

fn visit_property_value(&mut self, pv: &mut PropertyValue)[src]

fn visit_prefixed_ident(&mut self, id: &mut PrefixedIdent)[src]

fn visit_quoted_string(&mut self, string: &mut QuotedString)[src]

fn visit_relation_ident(&mut self, id: &mut RelationIdent)[src]

fn visit_subset_ident(&mut self, id: &mut SubsetIdent)[src]

fn visit_synonym(&mut self, syn: &mut Synonym)[src]

fn visit_synonym_scope(&mut self, scope: &mut SynonymScope)[src]

fn visit_synonymtype_ident(&mut self, id: &mut SynonymTypeIdent)[src]

fn visit_term_clause(&mut self, clause: &mut TermClause)[src]

fn visit_term_frame(&mut self, frame: &mut TermFrame)[src]

fn visit_typedef_clause(&mut self, clause: &mut TypedefClause)[src]

fn visit_typedef_frame(&mut self, frame: &mut TypedefFrame)[src]

fn visit_unprefixed_ident(&mut self, string: &mut UnprefixedIdent)[src]

fn visit_unquoted_string(&mut self, string: &mut UnquotedString)[src]

fn visit_url(&mut self, url: &mut Url)[src]

fn visit_xref(&mut self, xref: &mut Xref)[src]

fn visit_xref_list(&mut self, xrefs: &mut XrefList)[src]

impl Clone for IdCompactor[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for IdCompactor[src]

impl Debug for IdCompactor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]