34
34
import org .eclipse .rdf4j .query .QueryEvaluationException ;
35
35
import org .eclipse .rdf4j .query .algebra .AbstractQueryModelNode ;
36
36
import org .eclipse .rdf4j .query .algebra .BindingSetAssignment ;
37
- import org .eclipse .rdf4j .query .algebra .Extension ;
38
37
import org .eclipse .rdf4j .query .algebra .Join ;
39
38
import org .eclipse .rdf4j .query .algebra .LeftJoin ;
40
39
import org .eclipse .rdf4j .query .algebra .StatementPattern ;
@@ -100,7 +99,11 @@ public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings)
100
99
tupleExpr .visit (new JoinVisitor (statistics , trackResultSize , tripleSource ));
101
100
}
102
101
103
- private static class JoinVisitor extends AbstractSimpleQueryModelVisitor <RuntimeException > {
102
+ /**
103
+ * This can be extended by subclasses to allow for adjustments to the optimization process.
104
+ */
105
+ @ SuppressWarnings ("InnerClassMayBeStatic" )
106
+ protected class JoinVisitor extends AbstractSimpleQueryModelVisitor <RuntimeException > {
104
107
105
108
private final EvaluationStatistics statistics ;
106
109
private final TripleSource tripleSource ;
@@ -405,16 +408,6 @@ protected <M extends Map<Var, Integer>> void fillVarFreqMap(List<Var> varList, M
405
408
}
406
409
}
407
410
408
- protected List <Extension > getExtensions (List <TupleExpr > expressions ) {
409
- List <Extension > extensions = new ArrayList <>();
410
- for (TupleExpr expr : expressions ) {
411
- if (expr instanceof Extension ) {
412
- extensions .add ((Extension ) expr );
413
- }
414
- }
415
- return extensions ;
416
- }
417
-
418
411
private List <TupleExpr > getExtensionTupleExprs (List <TupleExpr > expressions ) {
419
412
if (expressions .isEmpty ()) {
420
413
return List .of ();
@@ -436,6 +429,14 @@ private List<TupleExpr> getExtensionTupleExprs(List<TupleExpr> expressions) {
436
429
return extensions ;
437
430
}
438
431
432
+ /**
433
+ * This method returns all direct sub-selects in the given list of expressions.
434
+ * <p>
435
+ * This method is meant to be possible to override by subclasses.
436
+ *
437
+ * @param expressions
438
+ * @return
439
+ */
439
440
protected List <TupleExpr > getSubSelects (List <TupleExpr > expressions ) {
440
441
if (expressions .isEmpty ()) {
441
442
return List .of ();
@@ -795,7 +796,7 @@ private void mergeJoinForCrossJoin(Deque<TupleExpr> orderedJoinArgs, Set<Var> su
795
796
}
796
797
}
797
798
798
- private static class StatementPatternVarCollector extends StatementPatternVisitor {
799
+ private class StatementPatternVarCollector extends StatementPatternVisitor {
799
800
800
801
private final TupleExpr tupleExpr ;
801
802
private List <Var > vars ;
0 commit comments