@@ -26,7 +26,7 @@ use json_ld::{
2626 JsonLdProcessor , RemoteDocument ,
2727} ;
2828use oxigraph:: model:: { GraphNameRef , LiteralRef , NamedNodeRef , QuadRef } ;
29- use oxigraph:: sparql:: QueryResults ;
29+ use oxigraph:: sparql:: { QueryResults , SparqlEvaluator } ;
3030use oxigraph:: store:: Store ;
3131use static_iref:: iri;
3232use std:: { env, fs} ;
@@ -153,7 +153,13 @@ WHERE
153153"# ;
154154
155155 // SPARQL query
156- if let QueryResults :: Solutions ( solutions) = store. query ( query) . unwrap ( ) {
156+ if let QueryResults :: Solutions ( solutions) = SparqlEvaluator :: new ( )
157+ . parse_query ( query)
158+ . expect ( "SPARQL syntax expected to be OK" )
159+ . on_store ( & store)
160+ . execute ( )
161+ . expect ( "SPARQL expected to execute" )
162+ {
157163 for option_solution in solutions {
158164 let solution = option_solution. unwrap ( ) ;
159165
@@ -387,8 +393,8 @@ mod tests {
387393 ) ;
388394
389395 let store = Store :: new ( ) ?;
390- assert ! ( store. insert( quad0) ?) ;
391- assert ! ( ! store. insert( quad1) ?) ;
396+ store. insert ( quad0) ?;
397+ store. insert ( quad1) ?;
392398
393399 assert ! ( store. contains( quad2) ?) ;
394400 Result :: < _ , Box < dyn std:: error:: Error > > :: Ok ( ( ) )
@@ -425,7 +431,13 @@ WHERE {
425431 ) ) ?;
426432
427433 // SPARQL query
428- if let QueryResults :: Solutions ( mut solutions) = store. query ( query) ? {
434+ if let QueryResults :: Solutions ( mut solutions) = SparqlEvaluator :: new ( )
435+ . parse_query ( query)
436+ . expect ( "SPARQL syntax expected to be OK" )
437+ . on_store ( & store)
438+ . execute ( )
439+ . expect ( "SPARQL expected to execute" )
440+ {
429441 assert_eq ! (
430442 solutions. next( ) . unwrap( ) ?. get( "nLocation" ) ,
431443 Some ( & n_kb_location. into_owned( ) . into( ) )
0 commit comments