Skip to content

Commit

Permalink
some code cleanup in the bind join algos
Browse files Browse the repository at this point in the history
  • Loading branch information
hartig committed Nov 21, 2024
1 parent 02cb699 commit a928d12
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* The implementation is generic in the sense that it works with any type of
* request operator. Each concrete implementation that extends this base class
* needs to implement the {@link #createExecutableRequestOperator(Iterable)}
* needs to implement the {@link #createExecutableReqOp(Iterable)}
* function to create the request operators with the types of requests that
* are specific to that concrete implementation.
*
Expand Down Expand Up @@ -159,7 +159,7 @@ protected void _processWithoutSplittingInputFirst( final List<SolutionMapping> j
final IntermediateResultElementSink sink,
final ExecutionContext execCxt ) throws ExecOpExecutionException
{
final NullaryExecutableOp reqOp = createExecutableRequestOperator(joinableInputSMs);
final NullaryExecutableOp reqOp = createExecutableReqOp(joinableInputSMs);

if ( reqOp != null ) {
numberOfRequestOpsUsed++;
Expand Down Expand Up @@ -214,10 +214,14 @@ protected boolean reduceRequestBlockSize() {
}

/**
* The returned operator should be created such that it throws exceptions
* instead of collecting them.
* Implementations of this function should create an executable operator
* that can perform a bind join request in which the query of this bind
* join operator is combined with the given solution mappings.
*
* The operator created by this function should throws exceptions instead
* of collecting them.
*/
protected abstract NullaryExecutableOp createExecutableRequestOperator( Iterable<SolutionMapping> solMaps );
protected abstract NullaryExecutableOp createExecutableReqOp( Iterable<SolutionMapping> solMaps );

/**
* Splits the given collection of solution mappings into two such that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ExecOpBindJoinBRTPF( final TriplePattern tp,
}

@Override
protected NullaryExecutableOp createExecutableRequestOperator( final Iterable<SolutionMapping> inputSolMaps ) {
protected NullaryExecutableOp createExecutableReqOp( final Iterable<SolutionMapping> inputSolMaps ) {
final Set<SolutionMapping> restrictedSMs = restrictSolMaps(inputSolMaps, varsInPatternForFM);

if ( restrictedSMs == null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

import se.liu.ida.hefquin.base.data.SolutionMapping;
import se.liu.ida.hefquin.base.data.utils.SolutionMappingUtils;
import se.liu.ida.hefquin.base.query.BGP;
import se.liu.ida.hefquin.base.query.SPARQLGraphPattern;
import se.liu.ida.hefquin.base.query.TriplePattern;
import se.liu.ida.hefquin.base.query.impl.GenericSPARQLGraphPatternImpl2;
import se.liu.ida.hefquin.base.query.impl.QueryPatternUtils;
import se.liu.ida.hefquin.engine.federation.SPARQLEndpoint;
Expand Down Expand Up @@ -48,20 +46,6 @@
*/
public class ExecOpBindJoinSPARQLwithFILTER extends BaseForExecOpBindJoinSPARQL
{
public ExecOpBindJoinSPARQLwithFILTER( final TriplePattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, useOuterJoinSemantics, collectExceptions);
}

public ExecOpBindJoinSPARQLwithFILTER( final BGP query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, useOuterJoinSemantics, collectExceptions);
}

public ExecOpBindJoinSPARQLwithFILTER( final SPARQLGraphPattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
Expand All @@ -70,7 +54,7 @@ public ExecOpBindJoinSPARQLwithFILTER( final SPARQLGraphPattern query,
}

@Override
protected NullaryExecutableOp createExecutableRequestOperator( final Iterable<SolutionMapping> solMaps ) {
protected NullaryExecutableOp createExecutableReqOp( final Iterable<SolutionMapping> solMaps ) {
final Op op = createFilter(solMaps);
if ( op == null ) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

import se.liu.ida.hefquin.base.data.SolutionMapping;
import se.liu.ida.hefquin.base.data.utils.SolutionMappingUtils;
import se.liu.ida.hefquin.base.query.BGP;
import se.liu.ida.hefquin.base.query.SPARQLGraphPattern;
import se.liu.ida.hefquin.base.query.TriplePattern;
import se.liu.ida.hefquin.base.query.impl.GenericSPARQLGraphPatternImpl2;
import se.liu.ida.hefquin.base.query.impl.QueryPatternUtils;
import se.liu.ida.hefquin.engine.federation.SPARQLEndpoint;
Expand All @@ -27,27 +25,22 @@
import se.liu.ida.hefquin.engine.queryplan.executable.NullaryExecutableOp;

/**
* Implementation of (a batching version of) the bind join algorithm that uses UNION.
* Implementation of (a batching version of) the bind join algorithm
* that uses UNION clauses with FILTERs inside.
*
* The current algorithm should to be changed.
* See: https://github.com/LiUSemWeb/HeFQUIN/issues/344
*/
public class ExecOpBindJoinSPARQLwithUNION extends BaseForExecOpBindJoinSPARQL
{
public ExecOpBindJoinSPARQLwithUNION( final TriplePattern query, final SPARQLEndpoint fm, final boolean collectExceptions ) {
super(query, fm, false, collectExceptions);
}

public ExecOpBindJoinSPARQLwithUNION( final BGP query, final SPARQLEndpoint fm, final boolean collectExceptions ) {
super(query, fm, false, collectExceptions);
}

public ExecOpBindJoinSPARQLwithUNION( final SPARQLGraphPattern query, final SPARQLEndpoint fm, final boolean collectExceptions ) {
public ExecOpBindJoinSPARQLwithUNION( final SPARQLGraphPattern query,
final SPARQLEndpoint fm,
final boolean collectExceptions ) {
super(query, fm, false, collectExceptions);
}

@Override
protected NullaryExecutableOp createExecutableRequestOperator( final Iterable<SolutionMapping> solMaps ) {
protected NullaryExecutableOp createExecutableReqOp( final Iterable<SolutionMapping> solMaps ) {
final Op op = createUnion(solMaps);
if ( op == null ) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import se.liu.ida.hefquin.base.data.SolutionMapping;
import se.liu.ida.hefquin.base.data.utils.SolutionMappingUtils;
import se.liu.ida.hefquin.base.query.BGP;
import se.liu.ida.hefquin.base.query.SPARQLGraphPattern;
import se.liu.ida.hefquin.base.query.TriplePattern;
import se.liu.ida.hefquin.base.query.impl.GenericSPARQLGraphPatternImpl2;
import se.liu.ida.hefquin.base.query.impl.QueryPatternUtils;
import se.liu.ida.hefquin.engine.federation.SPARQLEndpoint;
Expand Down Expand Up @@ -47,20 +45,6 @@
*/
public class ExecOpBindJoinSPARQLwithVALUES extends BaseForExecOpBindJoinSPARQL
{
public ExecOpBindJoinSPARQLwithVALUES( final TriplePattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, useOuterJoinSemantics, collectExceptions);
}

public ExecOpBindJoinSPARQLwithVALUES( final BGP query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, useOuterJoinSemantics, collectExceptions);
}

public ExecOpBindJoinSPARQLwithVALUES( final SPARQLGraphPattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
Expand All @@ -69,7 +53,7 @@ public ExecOpBindJoinSPARQLwithVALUES( final SPARQLGraphPattern query,
}

@Override
protected NullaryExecutableOp createExecutableRequestOperator( final Iterable<SolutionMapping> solMaps ) {
protected NullaryExecutableOp createExecutableReqOp( final Iterable<SolutionMapping> solMaps ) {
final Set<Binding> bindings = new HashSet<>();
final Set<Var> joinVars = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import java.util.Collections;
import java.util.List;
import se.liu.ida.hefquin.base.query.BGP;
import se.liu.ida.hefquin.base.query.SPARQLGraphPattern;
import se.liu.ida.hefquin.base.query.TriplePattern;
import se.liu.ida.hefquin.engine.federation.SPARQLEndpoint;
import se.liu.ida.hefquin.engine.queryplan.executable.ExecOpExecutionException;
import se.liu.ida.hefquin.engine.queryplan.executable.IntermediateResultBlock;
Expand All @@ -28,22 +26,6 @@ public class ExecOpBindJoinSPARQLwithVALUESorFILTER extends BaseForExecOpBindJoi
// will be initialized when processing the first input block of solution mappings
protected BaseForExecOpBindJoinSPARQL currentInstance = null;

public ExecOpBindJoinSPARQLwithVALUESorFILTER( final TriplePattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, collectExceptions);
this.useOuterJoinSemantics = useOuterJoinSemantics;
}

public ExecOpBindJoinSPARQLwithVALUESorFILTER( final BGP query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
final boolean collectExceptions ) {
super(query, fm, collectExceptions);
this.useOuterJoinSemantics = useOuterJoinSemantics;
}

public ExecOpBindJoinSPARQLwithVALUESorFILTER( final SPARQLGraphPattern query,
final SPARQLEndpoint fm,
final boolean useOuterJoinSemantics,
Expand Down

0 comments on commit a928d12

Please sign in to comment.