|
|
@ -22,13 +22,11 @@ type StreamedSophiaQuad<'a> = StreamedQuad<'a, ByValue<SophiaQuad>>; |
|
|
|
/// + the query must be a SELECT query with a single selected variable
|
|
|
|
/// + the query must be a SELECT query with a single selected variable
|
|
|
|
/// + it must not produce NULL results
|
|
|
|
/// + it must not produce NULL results
|
|
|
|
macro_rules! sparql_to_hashset { |
|
|
|
macro_rules! sparql_to_hashset { |
|
|
|
($store: ident, $err_map: ident, $sparql: expr) => { |
|
|
|
($store: ident, $err_map: ident, $sparql: expr) => {{ |
|
|
|
//sparql_result_as_term_set($store, $sparql).map_err($err_map)
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
(|| -> Result<HashSet<Term>, EvaluationError> { |
|
|
|
(|| -> Result<HashSet<Term>, EvaluationError> { |
|
|
|
let q = $store.prepare_query($sparql, QueryOptions::default())?; |
|
|
|
if let QueryResults::Solutions(solutions) = |
|
|
|
let r = q.exec()?; |
|
|
|
$store.query($sparql, QueryOptions::default())? |
|
|
|
if let QueryResults::Solutions(solutions) = r { |
|
|
|
{ |
|
|
|
solutions |
|
|
|
solutions |
|
|
|
.map(|r| r.map(|v| v.get(0).unwrap().clone())) |
|
|
|
.map(|r| r.map(|v| v.get(0).unwrap().clone())) |
|
|
|
.collect() |
|
|
|
.collect() |
|
|
@ -37,8 +35,7 @@ macro_rules! sparql_to_hashset { |
|
|
|
} |
|
|
|
} |
|
|
|
})() |
|
|
|
})() |
|
|
|
.map_err($err_map) |
|
|
|
.map_err($err_map) |
|
|
|
} |
|
|
|
}}; |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
macro_rules! impl_dataset { |
|
|
|
macro_rules! impl_dataset { |
|
|
@ -418,7 +415,7 @@ macro_rules! impl_dataset { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mod mem { |
|
|
|
mod memory { |
|
|
|
use super::*; |
|
|
|
use super::*; |
|
|
|
|
|
|
|
|
|
|
|
impl_dataset!( |
|
|
|
impl_dataset!( |