11
11
12
12
package org .eclipse .rdf4j .sail .shacl .ast .planNodes ;
13
13
14
- import java .util .ArrayDeque ;
15
- import java .util .LinkedHashMap ;
16
- import java .util .List ;
17
- import java .util .Objects ;
18
- import java .util .function .Function ;
19
-
20
14
import org .apache .commons .text .StringEscapeUtils ;
21
15
import org .eclipse .rdf4j .common .iteration .CloseableIteration ;
22
16
import org .eclipse .rdf4j .model .Resource ;
31
25
import org .eclipse .rdf4j .sail .shacl .ast .constraintcomponents .ConstraintComponent ;
32
26
import org .eclipse .rdf4j .sail .shacl .wrapper .data .ConnectionsGroup ;
33
27
28
+ import java .util .ArrayDeque ;
29
+ import java .util .LinkedHashMap ;
30
+ import java .util .List ;
31
+ import java .util .Objects ;
32
+ import java .util .function .Function ;
33
+
34
34
/**
35
35
* @author Håvard Ottestad
36
- * <p>
37
- * This inner join algorithm assumes the left iterator is unique for tuple[0], eg. no two tuples have the same
38
- * value at index 0. The right iterator is allowed to contain duplicates.
39
- * <p>
40
- * External means that this plan node can join the iterator from a plan node with an external source (Repository
41
- * or SailConnection) based on a query or a predicate.
36
+ * <p>
37
+ * This inner join algorithm assumes the left iterator is unique for tuple[0], eg. no two tuples have the same
38
+ * value at index 0. The right iterator is allowed to contain duplicates.
39
+ * <p>
40
+ * External means that this plan node can join the iterator from a plan node with an external source (Repository
41
+ * or SailConnection) based on a query or a predicate.
42
42
*/
43
43
public class BulkedExternalInnerJoin extends AbstractBulkJoinPlanNode {
44
44
@@ -59,10 +59,10 @@ public class BulkedExternalInnerJoin extends AbstractBulkJoinPlanNode {
59
59
private boolean printed = false ;
60
60
61
61
public BulkedExternalInnerJoin (PlanNode leftNode , SailConnection connection , Resource [] dataGraph ,
62
- SparqlFragment query ,
63
- boolean skipBasedOnPreviousConnection , SailConnection previousStateConnection ,
64
- Function <BindingSet , ValidationTuple > mapper , ConnectionsGroup connectionsGroup ,
65
- List <StatementMatcher .Variable > vars ) {
62
+ SparqlFragment query ,
63
+ boolean skipBasedOnPreviousConnection , SailConnection previousStateConnection ,
64
+ Function <BindingSet , ValidationTuple > mapper , ConnectionsGroup connectionsGroup ,
65
+ List <StatementMatcher .Variable > vars ) {
66
66
super (vars );
67
67
assert !skipBasedOnPreviousConnection || previousStateConnection != null ;
68
68
@@ -79,7 +79,7 @@ public BulkedExternalInnerJoin(PlanNode leftNode, SailConnection connection, Res
79
79
}
80
80
81
81
public static Function <BindingSet , ValidationTuple > getMapper (String a , String c , ConstraintComponent .Scope scope ,
82
- Resource [] dataGraph ) {
82
+ Resource [] dataGraph ) {
83
83
assert a .equals ("a" );
84
84
assert c .equals ("c" );
85
85
if (scope == ConstraintComponent .Scope .nodeShape && dataGraph .length == 0 ) {
@@ -159,6 +159,13 @@ public void localClose() {
159
159
160
160
@ Override
161
161
protected boolean localHasNext () {
162
+ if (isClosed ()) {
163
+ return false ;
164
+ }
165
+ if (Thread .currentThread ().isInterrupted ()) {
166
+ close ();
167
+ return false ;
168
+ }
162
169
calculateNext ();
163
170
return !joined .isEmpty ();
164
171
}
0 commit comments