Skip to content

Commit

Permalink
handle LoaderError dyn
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatychev committed Jul 25, 2024
1 parent 773a5ee commit 6081584
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions api/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ mod check_implementability {
/// - a list of terms (either atoms or index of quad)
/// - a list of triples (SPO indexes)
/// - a list of named graphs associated the triple indexes contained in the graph
///
/// This avoids the need to store arbitrarily nested triples.
/// NB: unasserted triples are not used in any quoted graph.
use super::*;
Expand Down
1 change: 1 addition & 0 deletions api/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ mod check_implementability {
/// where the graph maintains
/// - a list of terms (either atoms or index of triple)
/// - a list of triples (SPO indexes, plus an 'asserted' flag)
///
/// This avoids the need to store arbitrarily nested triples.
use super::*;
use crate::term::SimpleTerm;
Expand Down
4 changes: 2 additions & 2 deletions api/src/source/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ mod test {
];
let mut h: Vec<[SimpleTerm; 3]> = vec![];
g.triples()
.filter_triples(|t| !Term::eq(t.p(), &ez_term(":e")))
.filter_triples(|t| !Term::eq(t.p(), ez_term(":e")))
.for_each_triple(|t| {
h.insert_triple(t).unwrap();
})
Expand All @@ -153,7 +153,7 @@ mod test {
];
let mut h: Vec<Spog<SimpleTerm>> = vec![];
d.quads()
.filter_quads(|q| !Term::eq(q.p(), &ez_term(":e")))
.filter_quads(|q| !Term::eq(q.p(), ez_term(":e")))
.for_each_quad(|q| {
h.insert_quad(q).unwrap();
})
Expand Down
2 changes: 1 addition & 1 deletion c14n/src/rdfc10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl<'a, H: HashFunction, T: Term> C14nState<'a, H, T> {
// Step 5
let mut ret_issuer: Option<BnodeIssuer> = None;
for (related_hash, mut blank_node) in hn.into_iter() {
data_to_hash.update(&hex(&related_hash));
data_to_hash.update(hex(&related_hash));
let mut chosen_path = String::new();
let mut chosen_issuer: Option<BnodeIssuer> = None;
// Step 5.4
Expand Down
2 changes: 1 addition & 1 deletion resource/src/loader/_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub enum LoaderError {
CantGuessSyntax(IriBuf),
/// An error was encountered while parsing the data into an RDF graph
#[error("Can not parse {0:?}: {1}")]
ParseError(IriBuf, Box<dyn std::error::Error>),
ParseError(IriBuf, Box<dyn sophia_api::Error>),
}

impl LoaderError {
Expand Down
2 changes: 1 addition & 1 deletion resource/src/resource/_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<E: Error> From<crate::loader::LoaderError> for ResourceError<E> {
}
}

impl<E: Error> std::error::Error for ResourceError<E> {}
impl<E> std::error::Error for ResourceError<E> where E: sophia_api::Error {}

/// A result whose error is a [`ResourceError`]
pub type ResourceResult<T, G> = Result<T, ResourceError<<G as Graph>::Error>>;
10 changes: 5 additions & 5 deletions turtle/src/serializer/_pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//!
//! Possible improvements:
//! 1. PrettifiableDataset should encapsulate some of the "indexes" built by Prettifier
//! (labelled, subject_types, named_graphs)
//! and build directly in CollectibleDataset::from_quad_source().
//! (labelled, subject_types, named_graphs)
//! and build directly in CollectibleDataset::from_quad_source().
//!
//! 2. Instead of writing directly to the output,
//! generate a hierarchical structure,
//! and decide on line breaks and indentation based on the overall structure,
//! rather than a priori.
//! generate a hierarchical structure,
//! and decide on line breaks and indentation based on the overall structure,
//! rather than a priori.

use super::turtle::TurtleConfig;
use regex::Regex;
Expand Down

0 comments on commit 6081584

Please sign in to comment.