2121import org .eclipse .rdf4j .common .transaction .IsolationLevels ;
2222import org .eclipse .rdf4j .query .BindingSet ;
2323import org .eclipse .rdf4j .query .TupleQueryResult ;
24- import org .eclipse .rdf4j .query .explanation .Explanation ;
2524import org .eclipse .rdf4j .repository .sail .SailRepository ;
2625import org .eclipse .rdf4j .repository .sail .SailRepositoryConnection ;
2726import org .eclipse .rdf4j .rio .RDFFormat ;
@@ -61,6 +60,8 @@ public class QueryBenchmark {
6160 private static final String common_themes ;
6261 private static final String different_datasets_with_similar_distributions ;
6362 private static final String long_chain ;
63+ private static final String optional_lhs_filter ;
64+ private static final String optional_rhs_filter ;
6465 private static final String lots_of_optional ;
6566 private static final String minus ;
6667 private static final String nested_optionals ;
@@ -79,6 +80,10 @@ public class QueryBenchmark {
7980 getResourceAsStream ("benchmarkFiles/different-datasets-with-similar-distributions.qr" ),
8081 StandardCharsets .UTF_8 );
8182 long_chain = IOUtils .toString (getResourceAsStream ("benchmarkFiles/long-chain.qr" ), StandardCharsets .UTF_8 );
83+ optional_lhs_filter = IOUtils .toString (getResourceAsStream ("benchmarkFiles/optional-lhs-filter.qr" ),
84+ StandardCharsets .UTF_8 );
85+ optional_rhs_filter = IOUtils .toString (getResourceAsStream ("benchmarkFiles/optional-rhs-filter.qr" ),
86+ StandardCharsets .UTF_8 );
8287 lots_of_optional = IOUtils .toString (getResourceAsStream ("benchmarkFiles/lots-of-optional.qr" ),
8388 StandardCharsets .UTF_8 );
8489 minus = IOUtils .toString (getResourceAsStream ("benchmarkFiles/minus.qr" ), StandardCharsets .UTF_8 );
@@ -303,6 +308,24 @@ public long long_chain() {
303308 }
304309 }
305310
311+ @ Benchmark
312+ public long optional_lhs_filter () {
313+ try (SailRepositoryConnection connection = repository .getConnection ()) {
314+ return count (connection
315+ .prepareTupleQuery (optional_lhs_filter )
316+ .evaluate ());
317+ }
318+ }
319+
320+ @ Benchmark
321+ public long optional_rhs_filter () {
322+ try (SailRepositoryConnection connection = repository .getConnection ()) {
323+ return count (connection
324+ .prepareTupleQuery (optional_rhs_filter )
325+ .evaluate ());
326+ }
327+ }
328+
306329 @ Benchmark
307330 public long lots_of_optional () {
308331 try (SailRepositoryConnection connection = repository .getConnection ()) {
0 commit comments