Skip to content

Commit f7d69a1

Browse files
authored
GH-5151: use VALUES clause for FedX bind join with no free vars (#5165)
2 parents 8563132 + 095d478 commit f7d69a1

9 files changed

Lines changed: 49 additions & 8 deletions

File tree

tools/federation/src/main/java/org/eclipse/rdf4j/federated/evaluation/FederationEvalStrategy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,10 @@ public abstract CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern
935935
* @param bindings
936936
* @return the result iteration
937937
* @throws QueryEvaluationException
938+
* @deprecated with VALUES implementation, control flow goes via
939+
* {@link #evaluateBoundJoinStatementPattern(StatementTupleExpr, List)}
938940
*/
941+
@Deprecated(forRemoval = true)
939942
public abstract CloseableIteration<BindingSet> evaluateGroupedCheck(
940943
CheckStatementPattern stmt, final List<BindingSet> bindings) throws QueryEvaluationException;
941944

tools/federation/src/main/java/org/eclipse/rdf4j/federated/evaluation/SparqlFederationEvalStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ public CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern(
118118
/**
119119
* Alternative evaluation implementation using UNION. Nowadays we use a VALUES clause based implementation
120120
*
121-
* @deprecated
121+
* @deprecated no longer used
122122
*/
123+
@Deprecated(forRemoval = true)
123124
protected CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern_UNION(
124125
StatementTupleExpr stmt, List<BindingSet> bindings)
125126
throws QueryEvaluationException {

tools/federation/src/main/java/org/eclipse/rdf4j/federated/evaluation/join/ControlledWorkerBindJoin.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ protected TaskCreator determineTaskCreator(TupleExpr expr, BindingSet bs) {
4545
final TaskCreator taskCreator;
4646
if (expr instanceof StatementTupleExpr) {
4747
StatementTupleExpr stmt = (StatementTupleExpr) expr;
48-
if (stmt.hasFreeVarsFor(bs)) {
49-
taskCreator = new BoundJoinTaskCreator(strategy, stmt);
50-
} else {
51-
expr = new CheckStatementPattern(stmt, queryInfo);
52-
taskCreator = new CheckJoinTaskCreator(strategy, (CheckStatementPattern) expr);
53-
}
48+
taskCreator = new BoundJoinTaskCreator(strategy, stmt);
5449
} else if (expr instanceof FedXService) {
5550
taskCreator = new FedXServiceJoinTaskCreator(strategy, (FedXService) expr);
5651
} else {
@@ -77,6 +72,7 @@ public ParallelTask<BindingSet> getTask(ParallelExecutor<BindingSet> control, Li
7772
}
7873
}
7974

75+
@Deprecated(forRemoval = true)
8076
protected class CheckJoinTaskCreator implements TaskCreator {
8177
protected final FederationEvalStrategy _strategy;
8278
protected final CheckStatementPattern _expr;

tools/federation/src/main/java/org/eclipse/rdf4j/federated/evaluation/join/ParallelCheckJoinTask.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
* {@link FederationEvalStrategy#evaluateGroupedCheck(CheckStatementPattern, List)} for further details.
2525
*
2626
* @author Andreas Schwarte
27+
* @deprecated now integrated in {@link ParallelBoundJoinTask} (with VALUES clause)
2728
*/
29+
@Deprecated(forRemoval = true)
2830
public class ParallelCheckJoinTask extends ParallelTaskBase<BindingSet> {
2931

3032
protected final FederationEvalStrategy strategy;

tools/federation/src/test/java/org/eclipse/rdf4j/federated/BoundJoinTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,12 @@ public void testBoundJoin_FailingEndpoint() throws Exception {
4545
execute("/tests/boundjoin/query01.rq", "/tests/boundjoin/query01.srx", false, true);
4646
});
4747
}
48+
49+
@Test
50+
public void testBoundCheck() throws Exception {
51+
52+
/* test with VALUES clause based bound join, check join */
53+
prepareTest(Arrays.asList("/tests/data/data1.ttl", "/tests/data/data2.ttl"));
54+
execute("/tests/boundjoin/query02_checkJoin.rq", "/tests/boundjoin/query02_checkJoin.srx", false, true);
55+
}
4856
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# bound join query (where in the bind join all variables are bound)
2+
PREFIX ns1: <http://namespace1.org/>
3+
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
4+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
5+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
6+
7+
SELECT ?person ?name WHERE {
8+
?person rdf:type foaf:Person .
9+
?person foaf:age 25 .
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
3+
<head>
4+
<variable name='person'/>
5+
<variable name='name'/>
6+
<variable name='publication'/>
7+
</head>
8+
<results>
9+
<result>
10+
<binding name='person'>
11+
<uri>http://namespace1.org/Person_4</uri>
12+
</binding>
13+
</result>
14+
<result>
15+
<binding name='person'>
16+
<uri>http://namespace2.org/Person_6</uri>
17+
</binding>
18+
</result>
19+
</results>
20+
</sparql>

tools/federation/src/test/resources/tests/data/data1.ttl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
:Person_4 rdf:type foaf:Person .
2525
:Person_4 rdf:type :Person .
2626
:Person_4 foaf:name "Person4" .
27+
:Person_4 foaf:age "25"^^xsd:integer .
2728

2829
:Person_5 rdf:type foaf:Person .
2930
:Person_5 rdf:type :Person .

tools/federation/src/test/resources/tests/data/data2.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:Person_6 rdf:type foaf:Person .
1010
:Person_6 rdf:type :Person .
1111
:Person_6 foaf:name "Person6" .
12-
:Person_1 foaf:age "25"^^xsd:integer .
12+
:Person_6 foaf:age "25"^^xsd:integer .
1313

1414
:Person_7 rdf:type foaf:Person .
1515
:Person_7 rdf:type :Person .

0 commit comments

Comments
 (0)