horned-functional 
An OWL2 Functional-style Syntax parser for horned-owl.
πΊοΈ Overview
This library provides extensions to the horned-owl
crate to work with the OWL Functional-Style syntax.
It provides a parser written with pest and a serializer.
π Usage
Add the latest versions of horned-owl and horned-functional to the
[dependencies] sections of your Cargo.toml manifest:
[]
= "0.11.0"
= "0.4.0"
π Parser
To easily read an entire OWL document, including prefixes, use the
horned_functional::to_string function:
use SetOntology;
let s = read_to_string
.expect;
let =
.expect;
All OWL elements can be parsed from functional syntax as well, using the
FromFunctional trait to read a from a serialized string with the from_ofn
method:
use Axiom;
use FromFunctional;
let axiom = from_ofn
.expect;
If the serialized version contains abbreviated IRIs, you can pass a custom
prefix mapping to the from_ofn_ctx method:
use Axiom;
use FromFunctional;
let mut mapping = default;
mapping.add_prefix.ok;
let ctx = from;
let axiom = from_ofn_ctx
.expect;
βοΈ Serializer
To easily serialize an entire OWL document, including prefixes, use the
horned_functional::to_string function:
let mut file = open
.map
.expect;
let = read
.expect;
// `horned_functional::to_string` needs an AxiomMappedOntology
let axiom_mapped = ontology.into;
// serialize using the same prefixes as the input OWL/XML file
let ofn = to_string;
// serialize without abbreviated IRIs
let ofn = to_string;
All OWL elements can be displayed in functional syntax as well, using
a custom Display implementation, allowing the functional syntax in
format!,
println! or
write! macros.
Just add the AsFunctional trait to the scope, and use the as_ofn method
to get a displayable type for any supported element:
use *;
use AsFunctional;
let build = new;
// build a Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0002175>))
let op = build.object_property;
let axiom = from;
println!;
π Feedback
β οΈ Issue Tracker
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.
π Changelog
This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.
π License
This library is provided under the open-source MIT license.
π° Citation
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)