Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 81 additions & 30 deletions rust/case2geojson/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/case2geojson/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
geojson = "0.24.1"
iref = "3.2.2"
json-ld = { git = "https://github.com/miterst/json-ld.git", rev = "6b48152595b661ae5ada46747e15f373e698d151" }
oxigraph = { version = "0.4.1", default-features = false}
oxigraph = { version = "0.5.2", default-features = false}
serde_json = "1.0.145"
static-iref = "3.0.0"
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread", "test-util"] }
22 changes: 17 additions & 5 deletions rust/case2geojson/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use json_ld::{
JsonLdProcessor, RemoteDocument,
};
use oxigraph::model::{GraphNameRef, LiteralRef, NamedNodeRef, QuadRef};
use oxigraph::sparql::QueryResults;
use oxigraph::sparql::{QueryResults, SparqlEvaluator};
use oxigraph::store::Store;
use static_iref::iri;
use std::{env, fs};
Expand Down Expand Up @@ -153,7 +153,13 @@ WHERE
"#;

// SPARQL query
if let QueryResults::Solutions(solutions) = store.query(query).unwrap() {
if let QueryResults::Solutions(solutions) = SparqlEvaluator::new()
.parse_query(query)
.expect("SPARQL syntax expected to be OK")
.on_store(&store)
.execute()
.expect("SPARQL expected to execute")
{
for option_solution in solutions {
let solution = option_solution.unwrap();

Expand Down Expand Up @@ -387,8 +393,8 @@ mod tests {
);

let store = Store::new()?;
assert!(store.insert(quad0)?);
assert!(!store.insert(quad1)?);
store.insert(quad0)?;
store.insert(quad1)?;

assert!(store.contains(quad2)?);
Result::<_, Box<dyn std::error::Error>>::Ok(())
Expand Down Expand Up @@ -425,7 +431,13 @@ WHERE {
))?;

// SPARQL query
if let QueryResults::Solutions(mut solutions) = store.query(query)? {
if let QueryResults::Solutions(mut solutions) = SparqlEvaluator::new()
.parse_query(query)
.expect("SPARQL syntax expected to be OK")
.on_store(&store)
.execute()
.expect("SPARQL expected to execute")
{
assert_eq!(
solutions.next().unwrap()?.get("nLocation"),
Some(&n_kb_location.into_owned().into())
Expand Down
Loading