Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-5151: use VALUES clause for FedX bind join with no free vars #5165

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,10 @@ public abstract CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern
* @param bindings
* @return the result iteration
* @throws QueryEvaluationException
* @deprecated with VALUES implementation, control flow goes via
* {@link #evaluateBoundJoinStatementPattern(StatementTupleExpr, List)}
*/
@Deprecated(forRemoval = true)
public abstract CloseableIteration<BindingSet> evaluateGroupedCheck(
CheckStatementPattern stmt, final List<BindingSet> bindings) throws QueryEvaluationException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ public CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern(
/**
* Alternative evaluation implementation using UNION. Nowadays we use a VALUES clause based implementation
*
* @deprecated
* @deprecated no longer used
*/
@Deprecated(forRemoval = true)
protected CloseableIteration<BindingSet> evaluateBoundJoinStatementPattern_UNION(
StatementTupleExpr stmt, List<BindingSet> bindings)
throws QueryEvaluationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ protected TaskCreator determineTaskCreator(TupleExpr expr, BindingSet bs) {
final TaskCreator taskCreator;
if (expr instanceof StatementTupleExpr) {
StatementTupleExpr stmt = (StatementTupleExpr) expr;
if (stmt.hasFreeVarsFor(bs)) {
taskCreator = new BoundJoinTaskCreator(strategy, stmt);
} else {
expr = new CheckStatementPattern(stmt, queryInfo);
taskCreator = new CheckJoinTaskCreator(strategy, (CheckStatementPattern) expr);
}
taskCreator = new BoundJoinTaskCreator(strategy, stmt);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the relevant functional change: the VALUES based implementation can also be used for bind joins without free variables without functional change.

Note that in very early versions (where the bind join was implemented with a UNION construct) there was a need to distinguish the cases. This is a left over

} else if (expr instanceof FedXService) {
taskCreator = new FedXServiceJoinTaskCreator(strategy, (FedXService) expr);
} else {
Expand All @@ -77,6 +72,7 @@ public ParallelTask<BindingSet> getTask(ParallelExecutor<BindingSet> control, Li
}
}

@Deprecated(forRemoval = true)
protected class CheckJoinTaskCreator implements TaskCreator {
protected final FederationEvalStrategy _strategy;
protected final CheckStatementPattern _expr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
* {@link FederationEvalStrategy#evaluateGroupedCheck(CheckStatementPattern, List)} for further details.
*
* @author Andreas Schwarte
* @deprecated now integrated in {@link ParallelBoundJoinTask} (with VALUES clause)
*/
@Deprecated(forRemoval = true)
public class ParallelCheckJoinTask extends ParallelTaskBase<BindingSet> {

protected final FederationEvalStrategy strategy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@ public void testBoundJoin_FailingEndpoint() throws Exception {
execute("/tests/boundjoin/query01.rq", "/tests/boundjoin/query01.srx", false, true);
});
}

@Test
public void testBoundCheck() throws Exception {

/* test with VALUES clause based bound join, check join */
prepareTest(Arrays.asList("/tests/data/data1.ttl", "/tests/data/data2.ttl"));
execute("/tests/boundjoin/query02_checkJoin.rq", "/tests/boundjoin/query02_checkJoin.srx", false, true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# bound join query (where in the bind join all variables are bound)
PREFIX ns1: <http://namespace1.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT ?person ?name WHERE {
?person rdf:type foaf:Person .
?person foaf:age 25 .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
<head>
<variable name='person'/>
<variable name='name'/>
<variable name='publication'/>
</head>
<results>
<result>
<binding name='person'>
<uri>http://namespace1.org/Person_4</uri>
</binding>
</result>
<result>
<binding name='person'>
<uri>http://namespace2.org/Person_6</uri>
</binding>
</result>
</results>
</sparql>
1 change: 1 addition & 0 deletions tools/federation/src/test/resources/tests/data/data1.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
:Person_4 rdf:type foaf:Person .
:Person_4 rdf:type :Person .
:Person_4 foaf:name "Person4" .
:Person_4 foaf:age "25"^^xsd:integer .

:Person_5 rdf:type foaf:Person .
:Person_5 rdf:type :Person .
Expand Down
2 changes: 1 addition & 1 deletion tools/federation/src/test/resources/tests/data/data2.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:Person_6 rdf:type foaf:Person .
:Person_6 rdf:type :Person .
:Person_6 foaf:name "Person6" .
:Person_1 foaf:age "25"^^xsd:integer .
:Person_6 foaf:age "25"^^xsd:integer .

:Person_7 rdf:type foaf:Person .
:Person_7 rdf:type :Person .
Expand Down
Loading