Migrates to Rio 0.5

pull/46/head
Tpt 4 years ago
parent 60a5ae8e64
commit e320764fd0
  1. 6
      lib/Cargo.toml
  2. 100
      lib/src/io/read.rs
  3. 16
      lib/src/io/write.rs
  4. 8
      lib/src/store/memory.rs
  5. 108
      lib/src/store/mod.rs
  6. 8
      lib/src/store/rocksdb.rs
  7. 14
      lib/src/store/sled.rs

@ -27,9 +27,9 @@ digest = "0.9"
regex = "1"
oxilangtag = "0.1"
oxiri = "0.1"
rio_api = "0.4"
rio_turtle = "0.4"
rio_xml = "0.4"
rio_api = "0.5"
rio_turtle = "0.5"
rio_xml = "0.5"
hex = "0.4"
nom = "5"
peg = "0.6"

@ -1,6 +1,5 @@
//! Utilities to read RDF graphs and datasets
use crate::error::invalid_data_error;
use crate::io::{DatasetFormat, GraphFormat};
use crate::model::*;
use oxiri::{Iri, IriParseError};
@ -34,14 +33,14 @@ use std::io::BufRead;
/// ```
pub struct GraphParser {
format: GraphFormat,
base_iri: String,
base_iri: Option<Iri<String>>,
}
impl GraphParser {
pub fn from_format(format: GraphFormat) -> Self {
Self {
format,
base_iri: String::new(),
base_iri: None,
}
}
@ -61,25 +60,22 @@ impl GraphParser {
/// # Result::<_,Box<dyn std::error::Error>>::Ok(())
/// ```
pub fn with_base_iri(mut self, base_iri: impl Into<String>) -> Result<Self, IriParseError> {
self.base_iri = Iri::parse(base_iri.into())?.into_inner();
self.base_iri = Some(Iri::parse(base_iri.into())?);
Ok(self)
}
/// Executes the parsing itself
pub fn read_triples<R: BufRead>(&self, reader: R) -> Result<TripleReader<R>, io::Error> {
//TODO: drop the error when possible
Ok(TripleReader {
mapper: RioMapper::default(),
parser: match self.format {
GraphFormat::NTriples => TripleReaderKind::NTriples(
NTriplesParser::new(reader).map_err(invalid_data_error)?,
),
GraphFormat::Turtle => TripleReaderKind::Turtle(
TurtleParser::new(reader, &self.base_iri).map_err(invalid_data_error)?,
),
GraphFormat::RdfXml => TripleReaderKind::RdfXml(
RdfXmlParser::new(reader, &self.base_iri).map_err(invalid_data_error)?,
),
GraphFormat::NTriples => TripleReaderKind::NTriples(NTriplesParser::new(reader)),
GraphFormat::Turtle => {
TripleReaderKind::Turtle(TurtleParser::new(reader, self.base_iri.clone()))
}
GraphFormat::RdfXml => {
TripleReaderKind::RdfXml(RdfXmlParser::new(reader, self.base_iri.clone()))
}
},
buffer: Vec::new(),
})
@ -125,24 +121,15 @@ impl<R: BufRead> Iterator for TripleReader<R> {
}
if let Err(error) = match &mut self.parser {
TripleReaderKind::NTriples(parser) => Self::read(
parser,
&mut self.buffer,
&mut self.mapper,
invalid_data_error,
),
TripleReaderKind::Turtle(parser) => Self::read(
parser,
&mut self.buffer,
&mut self.mapper,
invalid_data_error,
),
TripleReaderKind::RdfXml(parser) => Self::read(
parser,
&mut self.buffer,
&mut self.mapper,
invalid_data_error,
),
TripleReaderKind::NTriples(parser) => {
Self::read(parser, &mut self.buffer, &mut self.mapper)
}
TripleReaderKind::Turtle(parser) => {
Self::read(parser, &mut self.buffer, &mut self.mapper)
}
TripleReaderKind::RdfXml(parser) => {
Self::read(parser, &mut self.buffer, &mut self.mapper)
}
}? {
return Some(Err(error));
}
@ -155,15 +142,17 @@ impl<R: BufRead> TripleReader<R> {
parser: &mut P,
buffer: &mut Vec<Triple>,
mapper: &mut RioMapper,
error: impl Fn(P::Error) -> io::Error,
) -> Option<Result<(), io::Error>> {
) -> Option<Result<(), io::Error>>
where
io::Error: From<P::Error>,
{
if parser.is_end() {
None
} else if let Err(e) = parser.parse_step(&mut |t| {
buffer.push(mapper.triple(&t));
Ok(())
}) {
Some(Err(error(e)))
Some(Err(e))
} else {
Some(Ok(()))
}
@ -191,14 +180,14 @@ impl<R: BufRead> TripleReader<R> {
/// ```
pub struct DatasetParser {
format: DatasetFormat,
base_iri: String,
base_iri: Option<Iri<String>>,
}
impl DatasetParser {
pub fn from_format(format: DatasetFormat) -> Self {
Self {
format,
base_iri: String::new(),
base_iri: None,
}
}
@ -218,22 +207,19 @@ impl DatasetParser {
/// # Result::<_,Box<dyn std::error::Error>>::Ok(())
/// ```
pub fn with_base_iri(mut self, base_iri: impl Into<String>) -> Result<Self, IriParseError> {
self.base_iri = Iri::parse(base_iri.into())?.into_inner();
self.base_iri = Some(Iri::parse(base_iri.into())?);
Ok(self)
}
/// Executes the parsing itself
pub fn read_quads<R: BufRead>(&self, reader: R) -> Result<QuadReader<R>, io::Error> {
//TODO: drop the error when possible
Ok(QuadReader {
mapper: RioMapper::default(),
parser: match self.format {
DatasetFormat::NQuads => {
QuadReaderKind::NQuads(NQuadsParser::new(reader).map_err(invalid_data_error)?)
DatasetFormat::NQuads => QuadReaderKind::NQuads(NQuadsParser::new(reader)),
DatasetFormat::TriG => {
QuadReaderKind::TriG(TriGParser::new(reader, self.base_iri.clone()))
}
DatasetFormat::TriG => QuadReaderKind::TriG(
TriGParser::new(reader, &self.base_iri).map_err(invalid_data_error)?,
),
},
buffer: Vec::new(),
})
@ -278,18 +264,12 @@ impl<R: BufRead> Iterator for QuadReader<R> {
}
if let Err(error) = match &mut self.parser {
QuadReaderKind::NQuads(parser) => Self::read(
parser,
&mut self.buffer,
&mut self.mapper,
invalid_data_error,
),
QuadReaderKind::TriG(parser) => Self::read(
parser,
&mut self.buffer,
&mut self.mapper,
invalid_data_error,
),
QuadReaderKind::NQuads(parser) => {
Self::read(parser, &mut self.buffer, &mut self.mapper)
}
QuadReaderKind::TriG(parser) => {
Self::read(parser, &mut self.buffer, &mut self.mapper)
}
}? {
return Some(Err(error));
}
@ -302,15 +282,17 @@ impl<R: BufRead> QuadReader<R> {
parser: &mut P,
buffer: &mut Vec<Quad>,
mapper: &mut RioMapper,
error: impl Fn(P::Error) -> io::Error,
) -> Option<Result<(), io::Error>> {
) -> Option<Result<(), io::Error>>
where
io::Error: From<P::Error>,
{
if parser.is_end() {
None
} else if let Err(e) = parser.parse_step(&mut |t| {
buffer.push(mapper.quad(&t));
Ok(())
}) {
Some(Err(error(e)))
Some(Err(e))
} else {
Some(Ok(()))
}

@ -4,7 +4,7 @@ use crate::io::{DatasetFormat, GraphFormat};
use crate::model::*;
use rio_api::formatter::{QuadsFormatter, TriplesFormatter};
use rio_turtle::{NQuadsFormatter, NTriplesFormatter, TriGFormatter, TurtleFormatter};
use rio_xml::{RdfXmlError, RdfXmlFormatter};
use rio_xml::RdfXmlFormatter;
use std::io;
use std::io::Write;
@ -47,9 +47,7 @@ impl GraphSerializer {
formatter: match self.format {
GraphFormat::NTriples => TripleWriterKind::NTriples(NTriplesFormatter::new(writer)),
GraphFormat::Turtle => TripleWriterKind::Turtle(TurtleFormatter::new(writer)),
GraphFormat::RdfXml => {
TripleWriterKind::RdfXml(RdfXmlFormatter::new(writer).map_err(map_xml_err)?)
}
GraphFormat::RdfXml => TripleWriterKind::RdfXml(RdfXmlFormatter::new(writer)?),
},
})
}
@ -93,9 +91,7 @@ impl<W: Write> TripleWriter<W> {
match &mut self.formatter {
TripleWriterKind::NTriples(formatter) => formatter.format(&triple.into())?,
TripleWriterKind::Turtle(formatter) => formatter.format(&triple.into())?,
TripleWriterKind::RdfXml(formatter) => {
formatter.format(&triple.into()).map_err(map_xml_err)?
}
TripleWriterKind::RdfXml(formatter) => formatter.format(&triple.into())?,
}
Ok(())
}
@ -105,7 +101,7 @@ impl<W: Write> TripleWriter<W> {
match self.formatter {
TripleWriterKind::NTriples(formatter) => formatter.finish(),
TripleWriterKind::Turtle(formatter) => formatter.finish()?,
TripleWriterKind::RdfXml(formatter) => formatter.finish().map_err(map_xml_err)?,
TripleWriterKind::RdfXml(formatter) => formatter.finish()?,
};
Ok(())
}
@ -206,7 +202,3 @@ impl<W: Write> QuadWriter<W> {
Ok(())
}
}
fn map_xml_err(e: RdfXmlError) -> io::Error {
io::Error::new(io::ErrorKind::Other, e) //TODO: drop
}

@ -301,7 +301,7 @@ impl MemoryStore {
/// Use a (memory greedy) [transaction](#method.transaction) if you do not want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_graph<'a>(
&self,
reader: impl BufRead,
@ -340,7 +340,7 @@ impl MemoryStore {
/// Use a (memory greedy) [transaction](#method.transaction) if you do not want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_dataset(
&self,
reader: impl BufRead,
@ -398,7 +398,7 @@ impl MemoryStore {
/// ```
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn dump_graph<'a>(
&self,
writer: impl Write,
@ -432,7 +432,7 @@ impl MemoryStore {
/// ```
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn dump_dataset(&self, writer: impl Write, format: DatasetFormat) -> Result<(), io::Error> {
dump_dataset(
self.quads_for_pattern(None, None, None, None).map(Ok),

@ -19,10 +19,11 @@ pub use crate::store::rocksdb::RocksDbStore;
#[cfg(feature = "sled")]
pub use crate::store::sled::SledStore;
use crate::error::{invalid_data_error, invalid_input_error};
use crate::error::invalid_input_error;
use crate::io::{DatasetFormat, DatasetSerializer, GraphFormat, GraphSerializer};
use crate::model::*;
use crate::store::numeric_encoder::*;
use oxiri::Iri;
use rio_api::parser::{QuadsParser, TriplesParser};
use rio_turtle::{NQuadsParser, NTriplesParser, TriGParser, TurtleError, TurtleParser};
use rio_xml::{RdfXmlError, RdfXmlParser};
@ -58,8 +59,12 @@ fn load_graph<S: WritableEncodedStore + StrContainer>(
format: GraphFormat,
to_graph_name: GraphNameRef<'_>,
base_iri: Option<&str>,
) -> Result<(), StoreOrParseError<S::Error, io::Error>> {
let base_iri = base_iri.unwrap_or("");
) -> Result<(), StoreOrParseError<S::Error>> {
let base_iri = if let Some(base_iri) = base_iri {
Some(Iri::parse(base_iri.into()).map_err(invalid_input_error)?)
} else {
None
};
match format {
GraphFormat::NTriples => {
load_from_triple_parser(store, NTriplesParser::new(reader), to_graph_name)
@ -75,32 +80,25 @@ fn load_graph<S: WritableEncodedStore + StrContainer>(
fn load_from_triple_parser<S: WritableEncodedStore + StrContainer, P: TriplesParser>(
store: &mut S,
parser: Result<P, P::Error>,
mut parser: P,
to_graph_name: GraphNameRef<'_>,
) -> Result<(), StoreOrParseError<S::Error, io::Error>>
) -> Result<(), StoreOrParseError<S::Error>>
where
StoreOrParseError<S::Error, P::Error>: From<P::Error>,
P::Error: Send + Sync + 'static,
StoreOrParseError<S::Error>: From<P::Error>,
{
let mut parser = parser.map_err(invalid_input_error)?;
let mut bnode_map = HashMap::default();
let to_graph_name = store
.encode_graph_name(to_graph_name)
.map_err(StoreOrParseError::Store)?;
parser
.parse_all(&mut move |t| {
let quad = store
.encode_rio_triple_in_graph(t, to_graph_name, &mut bnode_map)
.map_err(StoreOrParseError::Store)?;
store
.insert_encoded(&quad)
.map_err(StoreOrParseError::Store)?;
Ok(())
})
.map_err(|e| match e {
StoreOrParseError::Store(e) => StoreOrParseError::Store(e),
StoreOrParseError::Parse(e) => StoreOrParseError::Parse(invalid_data_error(e)),
})
parser.parse_all(&mut move |t| {
let quad = store
.encode_rio_triple_in_graph(t, to_graph_name, &mut bnode_map)
.map_err(StoreOrParseError::Store)?;
store
.insert_encoded(&quad)
.map_err(StoreOrParseError::Store)?;
Ok(())
})
}
fn dump_graph(
@ -120,8 +118,12 @@ fn load_dataset<S: WritableEncodedStore + StrContainer>(
reader: impl BufRead,
format: DatasetFormat,
base_iri: Option<&str>,
) -> Result<(), StoreOrParseError<S::Error, io::Error>> {
let base_iri = base_iri.unwrap_or("");
) -> Result<(), StoreOrParseError<S::Error>> {
let base_iri = if let Some(base_iri) = base_iri {
Some(Iri::parse(base_iri.into()).map_err(invalid_input_error)?)
} else {
None
};
match format {
DatasetFormat::NQuads => load_from_quad_parser(store, NQuadsParser::new(reader)),
DatasetFormat::TriG => load_from_quad_parser(store, TriGParser::new(reader, base_iri)),
@ -130,28 +132,21 @@ fn load_dataset<S: WritableEncodedStore + StrContainer>(
fn load_from_quad_parser<S: WritableEncodedStore + StrContainer, P: QuadsParser>(
store: &mut S,
parser: Result<P, P::Error>,
) -> Result<(), StoreOrParseError<S::Error, io::Error>>
mut parser: P,
) -> Result<(), StoreOrParseError<S::Error>>
where
StoreOrParseError<S::Error, P::Error>: From<P::Error>,
P::Error: Send + Sync + 'static,
StoreOrParseError<S::Error>: From<P::Error>,
{
let mut parser = parser.map_err(invalid_input_error)?;
let mut bnode_map = HashMap::default();
parser
.parse_all(&mut move |q| {
let quad = store
.encode_rio_quad(q, &mut bnode_map)
.map_err(StoreOrParseError::Store)?;
store
.insert_encoded(&quad)
.map_err(StoreOrParseError::Store)?;
Ok(())
})
.map_err(|e| match e {
StoreOrParseError::Store(e) => StoreOrParseError::Store(e),
StoreOrParseError::Parse(e) => StoreOrParseError::Parse(invalid_data_error(e)),
})
parser.parse_all(&mut move |q| {
let quad = store
.encode_rio_quad(q, &mut bnode_map)
.map_err(StoreOrParseError::Store)?;
store
.insert_encoded(&quad)
.map_err(StoreOrParseError::Store)?;
Ok(())
})
}
fn dump_dataset(
@ -166,42 +161,43 @@ fn dump_dataset(
writer.finish()
}
enum StoreOrParseError<S, P> {
enum StoreOrParseError<S> {
Store(S),
Parse(P),
Parse(io::Error),
}
impl<S> From<TurtleError> for StoreOrParseError<S, TurtleError> {
impl<S> From<TurtleError> for StoreOrParseError<S> {
fn from(error: TurtleError) -> Self {
Self::Parse(error)
Self::Parse(error.into())
}
}
impl<S> From<RdfXmlError> for StoreOrParseError<S, RdfXmlError> {
impl<S> From<RdfXmlError> for StoreOrParseError<S> {
fn from(error: RdfXmlError) -> Self {
Self::Parse(error)
Self::Parse(error.into())
}
}
impl<S> From<io::Error> for StoreOrParseError<S, io::Error> {
impl<S> From<io::Error> for StoreOrParseError<S> {
fn from(error: io::Error) -> Self {
Self::Parse(error)
}
}
impl<P: Into<io::Error>> From<StoreOrParseError<io::Error, P>> for io::Error {
fn from(error: StoreOrParseError<io::Error, P>) -> Self {
impl From<StoreOrParseError<io::Error>> for io::Error {
fn from(error: StoreOrParseError<io::Error>) -> Self {
match error {
StoreOrParseError::Store(error) => error,
StoreOrParseError::Parse(error) => error.into(),
StoreOrParseError::Parse(error) => error,
}
}
}
impl<P: Into<io::Error>> From<StoreOrParseError<Infallible, P>> for io::Error {
fn from(error: StoreOrParseError<Infallible, P>) -> Self {
impl From<StoreOrParseError<Infallible>> for io::Error {
fn from(error: StoreOrParseError<Infallible>) -> Self {
match error {
StoreOrParseError::Store(error) => match error {},
StoreOrParseError::Parse(error) => error.into(),
StoreOrParseError::Parse(error) => error,
}
}
}

@ -235,7 +235,7 @@ impl RocksDbStore {
/// See [`MemoryStore`](../memory/struct.MemoryStore.html#method.load_graph) for a usage example.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
/// Errors related to data loading into the store use the other error kinds.
pub fn load_graph<'a>(
&self,
@ -263,7 +263,7 @@ impl RocksDbStore {
/// See [`MemoryStore`](../memory/struct.MemoryStore.html#method.load_dataset) for a usage example.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
/// Errors related to data loading into the store use the other error kinds.
pub fn load_dataset(
&self,
@ -878,7 +878,7 @@ impl RocksDbTransaction<'_> {
/// return an error if you don't want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_graph<'a>(
&mut self,
reader: impl BufRead,
@ -903,7 +903,7 @@ impl RocksDbTransaction<'_> {
/// return an error if you don't want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_dataset(
&mut self,
reader: impl BufRead,

@ -268,7 +268,7 @@ impl SledStore {
/// See [`MemoryStore`](../memory/struct.MemoryStore.html#method.load_graph) for a usage example.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
/// Errors related to data loading into the store use the other error kinds.
pub fn load_graph<'a>(
&self,
@ -293,7 +293,7 @@ impl SledStore {
/// See [`MemoryStore`](../memory/struct.MemoryStore.html#method.load_dataset) for a usage example.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
/// Errors related to data loading into the store use the other error kinds.
pub fn load_dataset(
&self,
@ -814,7 +814,7 @@ impl SledTransaction<'_> {
/// return an error if you don't want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_graph<'a>(
&self,
reader: impl BufRead,
@ -840,7 +840,7 @@ impl SledTransaction<'_> {
/// return an error if you don't want that.
///
/// Errors related to parameter validation like the base IRI use the [`InvalidInput`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) error kind.
/// Errors related to a bad syntax in the loaded file use the [`InvalidData`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidData) or [`UnexpectedEof`](https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.UnexpectedEof) error kinds.
pub fn load_dataset(
&self,
reader: impl BufRead,
@ -1077,10 +1077,8 @@ impl From<SledUnabortableTransactionError> for EvaluationError {
}
}
impl From<StoreOrParseError<SledUnabortableTransactionError, io::Error>>
for SledUnabortableTransactionError
{
fn from(e: StoreOrParseError<SledUnabortableTransactionError, io::Error>) -> Self {
impl From<StoreOrParseError<SledUnabortableTransactionError>> for SledUnabortableTransactionError {
fn from(e: StoreOrParseError<SledUnabortableTransactionError>) -> Self {
match e {
StoreOrParseError::Store(e) => e,
StoreOrParseError::Parse(e) => Self::Storage(e),

Loading…
Cancel
Save