mod engine;
mod plan;
mod types;
pub use engine::Reasoner;
pub use types::{
ExecutionProfile, Inference, Limit, ProfileError, ReasoningError, RunLimits, RunReport,
};
use std::{error::Error, future::Future};
pub trait TripleCursor: Send {
type Term: Clone + Eq + Send + Sync;
type Error: Error + Send + Sync + 'static;
fn next(&mut self)
-> impl Future<Output = Result<Option<[Self::Term; 3]>, Self::Error>> + Send;
}
pub trait TripleSource: Send + Sync {
type Term: Clone + Eq + Send + Sync;
type Error: Error + Send + Sync + 'static;
type Cursor: TripleCursor<Term = Self::Term, Error = Self::Error>;
fn scan(
&self,
pattern: [Option<Self::Term>; 3],
) -> impl Future<Output = Result<Self::Cursor, Self::Error>> + Send;
}
pub trait ReasoningStore: Send {
type Term: Clone + Eq + Send + Sync;
type Error: Error + Send + Sync + 'static;
type Snapshot: TripleSource<Term = Self::Term, Error = Self::Error>;
fn resolve_iri(
&mut self,
iri: &str,
) -> impl Future<Output = Result<Self::Term, Self::Error>> + Send;
fn snapshot(&mut self) -> impl Future<Output = Result<Self::Snapshot, Self::Error>> + Send;
fn contains(
&mut self,
triple: &[Self::Term; 3],
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn insert_inferred(
&mut self,
inference: Inference<Self::Term>,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn is_cancelled(&self) -> bool;
}