|
1 | 1 | # `horned-functional` [](https://github.com/fastobo/horned-functional/stargazers)
|
2 | 2 |
|
3 |
| -*An [OWL2 Functional-style Syntax](https://www.w3.org/TR/owl2-syntax/) parser for `horned-owl`* |
| 3 | +*An [OWL2 Functional-style Syntax](https://www.w3.org/TR/owl2-syntax/) parser for [`horned-owl`](https://github.com/phillord/horned-owl)* |
4 | 4 |
|
5 | 5 | [](https://travis-ci.org/fastobo/horned-functional/branches)
|
6 | 6 | [](https://codecov.io/gh/fastobo/horned-functional)
|
|
10 | 10 | [](https://docs.rs/horned-functional)
|
11 | 11 | [](https://github.com/fastobo/horned-functional/blob/master/CHANGELOG.md)
|
12 | 12 | [](https://github.com/fastobo/horned-functional/issues)
|
| 13 | + |
| 14 | +## Overview |
| 15 | + |
| 16 | +This library provides an OWL Functional-style parser implementation for the |
| 17 | +`horned-owl` library, which provides the complete OWL2 model as a Rust library. |
| 18 | + |
| 19 | +The parser is implemented as a `pest` parser, using a translation of the BNF |
| 20 | +grammar. It provides spanned errors to easily identify the faulty parts of an |
| 21 | +invalid OWL2 document. |
| 22 | + |
| 23 | +All OWL2 entities also receive an implementation of `FromFunctional`, which can |
| 24 | +be used to deserialize each entity independently from their functional syntax |
| 25 | +representation. Since the deserialization is context-dependent when not |
| 26 | +considering the entire document, it is possible to provide a custom prefix |
| 27 | +mapping to handle compact identifiers in situations where one is needed. |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +Add `horned-owl` and `horned-functional` to the `[dependencies]` sections of |
| 32 | +your `Cargo.toml` manifest: |
| 33 | +```toml |
| 34 | +[dependencies] |
| 35 | +horned-functional = "0.1.0" |
| 36 | +``` |
| 37 | + |
| 38 | +The `from_reader` function is the easiest way to deserialize an OWL Functional |
| 39 | +document from a `Read` implementor: |
| 40 | +```rust,no_run |
| 41 | +extern crate ureq; |
| 42 | +extern crate horned_functional; |
| 43 | +
|
| 44 | +fn main() { |
| 45 | + let url = "https://raw.githubusercontent.com/ha-mo-we/Racer/master/examples/owl2/owl-primer-mod.ofn"; |
| 46 | +
|
| 47 | + let response = ureq::get(url).call(); |
| 48 | + let mut reader = response.into_reader(); |
| 49 | +
|
| 50 | + match horned_functional::from_reader(reader) { |
| 51 | + Ok((ont, _)) => println!("Number of axioms: {}", ont.iter().count()), |
| 52 | + Err(e) => panic!("could not parse document: {}", e) |
| 53 | + }; |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | + |
| 58 | +## Feedback |
| 59 | + |
| 60 | +Found a bug ? Have an enhancement request ? Head over to the |
| 61 | +[GitHub issue tracker](https://github.com/fastobo/horned-functional/issues) of the project if |
| 62 | +you need to report or ask something. If you are filling in on a bug, please include as much |
| 63 | +information as you can about the issue, and try to recreate the same bug in a simple, easily |
| 64 | +reproducible situation. |
| 65 | + |
| 66 | + |
| 67 | +## About |
| 68 | + |
| 69 | +This project was developed by [Martin Larralde](https://github.com/althonos) |
| 70 | +as part of a Master's Degree internship in the [BBOP team](http://berkeleybop.org/) of the |
| 71 | +[Lawrence Berkeley National Laboratory](https://www.lbl.gov/), under the supervision of |
| 72 | +[Chris Mungall](http://biosciences.lbl.gov/profiles/chris-mungall/). |
0 commit comments