Makes QueryResults::read return ParseError

pull/190/head
Tpt 3 years ago
parent 00b8528399
commit b469060227
  1. 9
      lib/src/sparql/model.rs

@ -5,10 +5,10 @@ use crate::sparql::error::EvaluationError;
use oxrdf::{Variable, VariableRef}; use oxrdf::{Variable, VariableRef};
pub use sparesults::QuerySolution; pub use sparesults::QuerySolution;
use sparesults::{ use sparesults::{
QueryResultsFormat, QueryResultsParser, QueryResultsReader, QueryResultsSerializer, ParseError, QueryResultsFormat, QueryResultsParser, QueryResultsReader, QueryResultsSerializer,
SolutionsReader, SolutionsReader,
}; };
use std::io::{self, BufRead, Write}; use std::io::{BufRead, Write};
use std::rc::Rc; use std::rc::Rc;
/// Results of a [SPARQL query](https://www.w3.org/TR/sparql11-query/). /// Results of a [SPARQL query](https://www.w3.org/TR/sparql11-query/).
@ -23,7 +23,10 @@ pub enum QueryResults {
impl QueryResults { impl QueryResults {
/// Reads a SPARQL query results serialization. /// Reads a SPARQL query results serialization.
pub fn read(reader: impl BufRead + 'static, format: QueryResultsFormat) -> io::Result<Self> { pub fn read(
reader: impl BufRead + 'static,
format: QueryResultsFormat,
) -> Result<Self, ParseError> {
Ok(QueryResultsParser::from_format(format) Ok(QueryResultsParser::from_format(format)
.read_results(reader)? .read_results(reader)?
.into()) .into())

Loading…
Cancel
Save