[][src]Crate horned_functional

horned-functional Star me

An OWL2 Functional-style Syntax parser for horned-owl

TravisCI Codecov License Source Crate Documentation Changelog GitHub issues DOI


This library provides an OWL Functional-style parser implementation for the horned-owl library, which provides the complete OWL2 model as a Rust library.

The parser is implemented as a pest parser, using a translation of the BNF grammar. It provides spanned errors to easily identify the faulty parts of an invalid OWL2 document.

All OWL2 entities also receive an implementation of FromFunctional, which can be used to deserialize each entity independently from their functional syntax representation. Since the deserialization is context-dependent when not considering the entire document, it is possible to provide a custom prefix mapping to handle compact identifiers in situations where one is needed.


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

horned-functional = "0.1.1"

The from_reader function is the easiest way to deserialize an OWL Functional document from a Read implementor:

extern crate ureq;
extern crate horned_functional;

fn main() {
    let url = "https://raw.githubusercontent.com/ha-mo-we/Racer/master/examples/owl2/owl-primer-mod.ofn";

    let response = ureq::get(url).call();
    let mut reader = response.into_reader();

    match horned_functional::from_reader(reader) {
      Ok((ont, _)) => println!("Number of axioms: {}", ont.iter().count()),
      Err(e) => panic!("could not parse document: {}", e)


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.


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)



The error type for this crate.



A trait for OWL elements that can be deserialized from OWL strings.



Parse an entire OWL document from a file on the local filesystem..


Parse an entire OWL document from a Read implementor.


Parse an entire OWL document from a string.

Type Definitions


The result type for this crate.