Package org.eclipse.rdf4j.federated.optimizer

## Class SourceSelection

- java.lang.Object
- - org.eclipse.rdf4j.federated.optimizer.SourceSelection

-     public class SourceSelection
      extends Object

  Perform source selection during optimization
  Author:
    Andreas Schwarte

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected class` | `SourceSelection.CheckTaskPair` |
    `protected static class` | `SourceSelection.ParallelCheckTask` | Task for sending an ASK request to the endpoints (for source selection)
    `protected static class` | `SourceSelection.SourceSelectionExecutorWithLatch` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected SourceSelectionCache` | `cache` |
    `protected List<Endpoint>` | `endpoints` |
    `protected QueryInfo` | `queryInfo` |
    `protected Map<StatementPattern,​List<StatementSource>>` | `stmtToSources` | Map statements to their sources.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SourceSelection​(List<Endpoint> endpoints, SourceSelectionCache cache, QueryInfo queryInfo)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `addSource​(StatementPattern stmt, StatementSource source)` | Add a source to the given statement in the map (synchronized through map)
    `void` | `doSourceSelection​(List<StatementPattern> stmts)` | Perform source selection for the provided statements using cache or remote ASK queries.
    `Set<Endpoint>` | `getRelevantSources()` | Retrieve a set of relevant sources for this query.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### endpoints

          protected final List<Endpoint> endpoints

    - #### cache

          protected final SourceSelectionCache cache

    - #### queryInfo

          protected final QueryInfo queryInfo

    - #### stmtToSources

          protected Map<StatementPattern,​List<StatementSource>> stmtToSources

      Map statements to their sources. Use synchronized access!

  - ### Constructor Detail

    - #### SourceSelection

          public SourceSelection​(List<Endpoint> endpoints,
                                 SourceSelectionCache cache,
                                 QueryInfo queryInfo)

  - ### Method Detail

    - #### doSourceSelection

          public void doSourceSelection​(List<StatementPattern> stmts)

      Perform source selection for the provided statements using cache or remote ASK queries. Remote ASK queries are evaluated in parallel using the concurrency infrastructure of FedX. Note, that this method is blocking until every source is resolved. The statement patterns are replaced by appropriate annotations in this optimization.
      Parameters:
        `stmts` -

    - #### getRelevantSources

          public Set<Endpoint> getRelevantSources()

      Retrieve a set of relevant sources for this query.
      Returns:
        the relevant sources

    - #### addSource

          protected void addSource​(StatementPattern stmt,
                                   StatementSource source)

      Add a source to the given statement in the map (synchronized through map)
      Parameters:
        `stmt` -
        `source` -