From 3a6fdac1b7f98e2340294deb8f0d72f2afbf00d5 Mon Sep 17 00:00:00 2001 From: Filippo De Bortoli Date: Wed, 13 Nov 2024 12:03:47 +0100 Subject: [PATCH] Fixes dependency feature warning, adds documentation for crate features in README. --- Cargo.toml | 1 + README.md | 19 ++++++++++--------- src/io/owx/reader.rs | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0cd9e1c..0dd8b7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ rio_xml="0.8.4" [features] default = ["remote"] remote = ["ureq"] +encoding = ["quick-xml/encoding"] [dev-dependencies] horned-owl = {path=".", features = ["remote"]} diff --git a/README.md b/README.md index 191576a..5bb0f54 100644 --- a/README.md +++ b/README.md @@ -6,22 +6,23 @@ Horned OWL *Horned-OWL* is a library for processing and manipulating documents written using the [Web Ontology Language (OWL)](https://en.wikipedia.org/wiki/Web_Ontology_Language). It extends the existing ecosystem of Rust crates for the Semantic Web and provides tools to interact with OWL ontologies within Rust applications. -It leverages the features of Rust to be performant and competitive against other libraries for ontologies manipulation, such as the [OWL API](https://github.com/owlcs/owlapi). Horned-OWL is aimed at allowing ontologies +It leverages the characteristics of Rust to be performant and competitive against other libraries for ontologies manipulation, such as the [OWL API](https://github.com/owlcs/owlapi). Horned-OWL is aimed at allowing ontologies with millions of terms. - -## Features - -+ Supports the OWL 2 language as specified in the [W3C Recommendation](https://www.w3.org/TR/owl-overview/) -+ Supports the Semantic Web Rule Language as specified in the [W3C User Submission](https://www.w3.org/submissions/SWRL/) -+ Supports serialization/deserialization of the following OWL syntaxes: ++ Support for the OWL 2 language as specified in the [W3C Recommendation](https://www.w3.org/TR/owl-overview/) ++ Support for the Semantic Web Rule Language as specified in the [W3C User Submission](https://www.w3.org/submissions/SWRL/) ++ Support for serialization/deserialization of the following OWL syntaxes: + [x] RDF/XML + [x] OWL/XML + [x] Functional Syntax + [ ] Manchester Syntax -+ Provides a [visitor](https://en.wikipedia.org/wiki/Visitor_pattern) trait to navigate and manipulate ontologies -+ Provides traits and implementations for several types of ontologies ++ A [visitor](https://en.wikipedia.org/wiki/Visitor_pattern) trait to navigate and manipulate ontologies ++ Traits and implementations for several types of ontologies + +## Features ++ `encoding`: enables the `encoding` feature for the [quick-xml](https://crates.io/crates/quick-xml) dependency, expanding support to non-UTF-8 encoded documents while parsing OWL/XML. ++ `remote`: enables the resolution of non-local imports while parsing RDF/XML. ## Performance We test the performance of our crate in validating large ontologies (e.g. the Gene Ontology) against competing implementations based on the OWL API. Preliminary results are encouraging, showing a potential speedup of 20x-40x. diff --git a/src/io/owx/reader.rs b/src/io/owx/reader.rs index d8846a3..709d09d 100644 --- a/src/io/owx/reader.rs +++ b/src/io/owx/reader.rs @@ -119,7 +119,7 @@ fn decode_expand_curie_maybe<'a, A: ForIRI, R: BufRead>( // return it as as borrowed string. // - in any other case, we need to perform a copy, otherwise the decoded // string / unabbreviated IRI is not going to live long enough. - #[cfg(feature = "quick-xml/encoding")] + #[cfg(feature = "encoding")] match r.reader.decode(val) { Cow::Borrowed(b) => expand_curie_maybe(r, b), Cow::Owned(o) => match expand_curie_maybe(r, &o) { @@ -128,7 +128,7 @@ fn decode_expand_curie_maybe<'a, A: ForIRI, R: BufRead>( }, } - #[cfg(not(feature = "quick-xml/encoding"))] + #[cfg(not(feature = "encoding"))] match r.reader.decoder().decode(val) { Ok(curie) => { let cur = expand_curie_maybe(r, curie);