Package org.eclipse.rdf4j.query.algebra.evaluation.federation

## Interface FederatedService

- All Known Implementing Classes:
    `RepositoryFederatedService`, `RepositoryFederatedService`, `SPARQLFederatedService`, `SPARQLFederatedService`, `TupleFunctionFederatedService`

      public interface FederatedService

  FederatedService to allow for customized evaluation of SERVICE expression. By default `SPARQLFederatedService` is used.
  Author:
    Andreas Schwarte, James Leigh
  See Also:
    `SPARQLFederatedService`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `ask​(Service service, BindingSet bindings, String baseUri)` | Evaluate the provided SPARQL ASK query at this federated service.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `evaluate​(Service service, CloseableIteration<BindingSet,​QueryEvaluationException> bindings, String baseUri)` | Evaluate the provided SPARQL query at this federated service, possibilities for vectored evaluation.
    `void` | `initialize()` | Method to perform any initializations, invoked after construction.
    `boolean` | `isInitialized()` | Method to check if `initialize()` had been called.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `select​(Service service, Set<String> projectionVars, BindingSet bindings, String baseUri)` | Evaluate the provided SPARQL query at this federated service.
    `void` | `shutdown()` | Method to perform any shutDown code, invoked at unregistering.

- - ### Method Detail

    - #### ask

          boolean ask​(Service service,
                      BindingSet bindings,
                      String baseUri)
               throws QueryEvaluationException

      Evaluate the provided SPARQL ASK query at this federated service.

           Expected behavior: evaluate boolean query using the bindings as constraints

      Parameters:
        `service` - the reference to the service node, contains additional meta information (vars, prefixes)
        `bindings` - the bindings serving as additional constraints
        `baseUri` -
      Returns:
        `true` if at least one result exists
      Throws:
        `QueryEvaluationException` - If there was an exception generated while evaluating the query.

    - #### select

          CloseableIteration<BindingSet,​QueryEvaluationException> select​(Service service,
                                                                               Set<String> projectionVars,
                                                                               BindingSet bindings,
                                                                               String baseUri)
                                                                        throws QueryEvaluationException

      Evaluate the provided SPARQL query at this federated service.

      Important: The original bindings need to be inserted into the result.

           Expected behavior: evaluate the given SPARQL query using the bindings as constraints

      Parameters:
        `service` - the reference to the service node, contains additional meta information (vars, prefixes)
        `projectionVars` - The variables with unknown value that should be projected from this evaluation
        `bindings` - the bindings serving as additional constraints
        `baseUri` -
      Returns:
        an iteration over the results of the query
      Throws:
        `QueryEvaluationException` - If there was an exception generated while evaluating the query.

    - #### evaluate

          CloseableIteration<BindingSet,​QueryEvaluationException> evaluate​(Service service,
                                                                                 CloseableIteration<BindingSet,​QueryEvaluationException> bindings,
                                                                                 String baseUri)
                                                                          throws QueryEvaluationException

      Evaluate the provided SPARQL query at this federated service, possibilities for vectored evaluation.

      Contracts:

      - The original bindings need to be inserted into the result
      - SILENT service must be dealt with in the method

      Compare `SPARQLFederatedService` for a reference implementation

      Parameters:
        `service` - the reference to the service node, contains information to construct the query
        `bindings` - the bindings serving as additional constraints (for vectored evaluation)
        `baseUri` - the baseUri
      Returns:
        the result of evaluating the query using bindings as constraints, the original bindings need to be inserted into the results!
      Throws:
        `QueryEvaluationException` - If there was an exception generated while evaluating the query.

    - #### isInitialized

          boolean isInitialized()

      Method to check if `initialize()` had been called.

    - #### initialize

          void initialize()
                   throws QueryEvaluationException

      Method to perform any initializations, invoked after construction.
      Throws:
        `QueryEvaluationException` - If there was an exception generated while initializing the service.

    - #### shutdown

          void shutdown()
                 throws QueryEvaluationException

      Method to perform any shutDown code, invoked at unregistering.
      Throws:
        `QueryEvaluationException` - If there was an exception generated while shutting down the service.