horned-functional
An OWL2 Functional-style Syntax parser for horned-owl
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:
toml
[dependencies]
horned-functional = "0.2.0"
The from_reader
function is the easiest way to deserialize an OWL Functional
document from a Read
implementor:
```rust,norun
extern crate ureq;
extern crate hornedfunctional;
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)