-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
116 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
use std::fmt::{Display, Formatter}; | ||
use crate::combiner::CombinerError; | ||
use crate::splitter::QueryParseError; | ||
use thiserror::Error; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum ChrontextError { | ||
FromJSONFileError(String), | ||
#[error("Missing SPARQL database")] | ||
NoSPARQLDatabaseDefined, | ||
#[error("Error creating SPARQL database `{0}`")] | ||
CreateSPARQLDatabaseError(String), | ||
DeserializeFromJSONFileError(String), | ||
#[error("No timeseries database defined")] | ||
NoTimeseriesDatabaseDefined, | ||
} | ||
|
||
impl Display for ChrontextError { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
ChrontextError::FromJSONFileError(s) => { | ||
write!(f, "Error reading engine config from JSON: {}", s) | ||
} | ||
ChrontextError::NoSPARQLDatabaseDefined => write!(f, "Missing SPARQL database"), | ||
ChrontextError::CreateSPARQLDatabaseError(s) => { | ||
write!(f, "Error creating SPARQL database {}", s) | ||
} | ||
ChrontextError::DeserializeFromJSONFileError(s) => { | ||
write!(f, "Error deserializing config from JSON file {}", s) | ||
} | ||
ChrontextError::NoTimeseriesDatabaseDefined => { | ||
write!(f, "No timeseries database defined") | ||
} | ||
} | ||
} | ||
#[error(transparent)] | ||
QueryParseError(#[from] QueryParseError), | ||
#[error(transparent)] | ||
CombinerError(#[from] CombinerError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
pub mod sparql_embedded_oxigraph; | ||
pub mod sparql_endpoint; | ||
|
||
use crate::sparql_database::sparql_embedded_oxigraph::EmbeddedOxigraphError; | ||
use crate::sparql_database::sparql_endpoint::SparqlEndpointQueryExecutionError; | ||
use async_trait::async_trait; | ||
use sparesults::QuerySolution; | ||
use spargebra::Query; | ||
use std::error::Error; | ||
use thiserror::Error; | ||
#[derive(Debug, Error)] | ||
pub enum SparqlQueryError { | ||
#[error(transparent)] | ||
EmbeddedOxigraphError(#[from] EmbeddedOxigraphError), | ||
#[error(transparent)] | ||
SparqlEndpointQueryExecutionError(#[from] SparqlEndpointQueryExecutionError), | ||
} | ||
|
||
#[async_trait] | ||
pub trait SparqlQueryable: Send + Sync { | ||
async fn execute(&self, query: &Query) -> Result<Vec<QuerySolution>, Box<dyn Error>>; | ||
async fn execute(&self, query: &Query) -> Result<Vec<QuerySolution>, SparqlQueryError>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.