1919
2020import org .apache .commons .io .FileUtils ;
2121import org .eclipse .rdf4j .model .Literal ;
22+ import org .eclipse .rdf4j .query .TupleQueryResult ;
2223import org .eclipse .rdf4j .repository .sail .SailRepository ;
2324import org .eclipse .rdf4j .repository .sail .SailRepositoryConnection ;
2425import org .eclipse .rdf4j .sail .lmdb .LmdbBenchmarkStore ;
@@ -71,7 +72,8 @@ public class FoafCliqueQueryBenchmark {
7172 @ Param ({ "12345" })
7273 public long seed ;
7374
74- @ Param ({ "interpreted" , "executor_codegen" , "full_codegen" , LFTJ_DISABLED })
75+ // @Param({ "interpreted", "executor_codegen", "full_codegen", LFTJ_DISABLED })
76+ @ Param ({ "full_codegen" })
7577 public String benchmarkMode ;
7678
7779 private File dataDir ;
@@ -80,7 +82,7 @@ public class FoafCliqueQueryBenchmark {
8082 public static void main (String [] args ) throws RunnerException {
8183 new Runner (new OptionsBuilder ()
8284 .include ("FoafCliqueQueryBenchmark" )
83- .forks (1 )
85+ .forks (0 )
8486 .build ()).run ();
8587 }
8688
@@ -192,19 +194,23 @@ public long executeScenario(QueryScenario scenario) {
192194
193195 private long executeCount (String query ) {
194196 try (SailRepositoryConnection connection = repository .getConnection ()) {
195- return connection .prepareTupleQuery (query ).evaluate ().stream ().count ();
197+ try (TupleQueryResult evaluate = connection .prepareTupleQuery (query ).evaluate ()) {
198+ return evaluate .stream ().count ();
199+ }
196200 }
197201 }
198202
199203 private long executeAggregateCount (String query ) {
200204 try (SailRepositoryConnection connection = repository .getConnection ()) {
201- return connection .prepareTupleQuery (query )
202- .evaluate ()
203- .stream ()
204- .findFirst ()
205- .map (bindingSet -> (Literal ) bindingSet .getValue (RESULT_COUNT_BINDING ))
206- .map (Literal ::longValue )
207- .orElseThrow (() -> new IllegalStateException ("Missing aggregate count result" ));
205+ try (TupleQueryResult evaluate = connection .prepareTupleQuery (query )
206+ .evaluate ()) {
207+ return evaluate
208+ .stream ()
209+ .findFirst ()
210+ .map (bindingSet -> (Literal ) bindingSet .getValue (RESULT_COUNT_BINDING ))
211+ .map (Literal ::longValue )
212+ .orElseThrow (() -> new IllegalStateException ("Missing aggregate count result" ));
213+ }
208214 }
209215 }
210216
0 commit comments