#owl #obo #ontology #semantics #file-format #flat-file #obofoundry

fastobo-owl

OWL language mapping for ontologies in the OBO flat file format 1.4

5 releases

0.2.1 Feb 23, 2022
0.2.0 Feb 15, 2022
0.1.2 Jan 22, 2022
0.1.1 Jan 21, 2022
0.1.0 Jan 20, 2022

#609 in Science

MIT and LGPL-3.0

94KB
1.5K SLoC

fastobo-owl Star me

OWL language mapping for ontologies in the OBO flat file format 1.4

Actions Codecov License Source Crate Documentation Changelog GitHub issues DOI

Overview

This library provides an implementation of the OBO to OWL mappings for the OBO format version 1.4 ontology language. It can be used to produce a semantically-equivalent OWL ontology from any OBO ontology.

Usage

Add fastobo-owl to the [dependencies] sections of your Cargo.toml manifest:

[dependencies]
fastobo-owl = "0.2.1"

Then use the IntoOwl trait to convert an OboDoc into any OWL ontology (the output type must implement the Default, Ontology and MutableOntology traits). Here's a how you could write a very simple script to load an OBO document from a file, convert it to OWL, and write it to another file in OWL/XML syntax:

extern crate fastobo;
extern crate fastobo_owl;

use fastobo_owl::IntoOwl;

// load an OBO ontology from a file
let obo = fastobo::from_file("tests/data/ms.obo").expect("failed to read OBO file");

// extract prefixes from the OBO header, so that they can be used
// to build abbreviated IRIs when serializing the OWL output
// (note: this contains OBO default prefixes such as xsd, rdf, or oboInOwl)
let prefixes = obo.prefixes();

// convert the ontology to OBO (the ontology type is implied by the later
// call to owx::writer::write which expects an `AxiomMappedOntology`)
let owl = obo.into_owl()
  .expect("failed to convert OBO to OWL");

// write the OWL ontology with abbreviated IRIs
let mut output = std::fs::File::create("tests/data/ms.owx").unwrap();
horned_owl::io::owx::writer::write(&mut output, &owl, Some(&prefixes));

See also

  • fastobo-syntax: Standalone pest parser for the OBO format version 1.4.
  • fastobo: Abstract Syntax Tree and data structures for the OBO format version 1.4.
  • fastobo-py: Idiomatic Python bindings to the fastobo crate.
  • fastobo-graphs: Data model and serde implementation of the OBO graphs specification, with conversion traits from and to OBO.
  • fastobo-validator: Standalone CLI to validate OBO files against the specification.

Feedback

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker of the project if you need to report or ask something. If you are filling in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

About

This project was developed by Martin Larralde as part of a Master's Degree internship in the BBOP team of the Lawrence Berkeley National Laboratory, under the supervision of Chris Mungall. Cite this project as:

Larralde M. Developing Python and Rust libraries to improve the ontology ecosystem [version 1; not peer reviewed]. F1000Research 2019, 8(ISCB Comm J):1500 (poster) (https://doi.org/10.7490/f1000research.1117405.1)

Dependencies

~9MB
~169K SLoC