org.eclipse.rdf4j.federated.evaluation

## Class TripleSourceBase

- java.lang.Object
- - org.eclipse.rdf4j.federated.evaluation.TripleSourceBase

- All Implemented Interfaces:
    TripleSource
  Direct Known Subclasses:
    SailTripleSource, SparqlTripleSource

      public abstract class TripleSourceBase
      extends Object
      implements TripleSource

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static interface` | `TripleSourceBase.ConnectionOperation<T>` Interface defining the operation to be perform on the connection
    `protected static class` | `TripleSourceBase.ResultHolder<T>` Holder for a result iteration to be used with `withConnection(ConnectionOperation)`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Endpoint` | `endpoint`
    `protected FederationContext` | `federationContext`
    `protected Monitoring` | `monitoringService`
    `protected FederationEvalStrategy` | `strategy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TripleSourceBase(FederationContext federationContext, Endpoint endpoint)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `applyMaxExecutionTimeUpperBound(Operation operation)` Apply an upper bound of the maximum execution time using `FedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext)`.
    `protected void` | `configureInference(Query query, QueryInfo queryInfo)` Set includeInferred depending on `QueryInfo.getIncludeInferred()`
    `CloseableIteration<BindingSet,QueryEvaluationException>` | `getStatements(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo)` Evaluate the prepared query (SPARQL query as String) on the provided endpoint.
    `CloseableIteration<BindingSet,QueryEvaluationException>` | `getStatements(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo)` Evaluate a given SPARQL query of the provided query type at the given source.
    `boolean` | `hasStatements(ExclusiveTupleExpr group, BindingSet bindings)` Check if the repository can return results for the given `ExclusiveTupleExpr`, e.g.
    `boolean` | `hasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts)` Check if the repository can return results for the given triple pattern represented by subj, pred and obj
    `protected void` | `monitorRemoteRequest()`
    `protected <T> CloseableIteration<T,QueryEvaluationException>` | `withConnection(TripleSourceBase.ConnectionOperation<T> operation)` Convenience method to perform an operation on a `RepositoryConnection`.

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

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

    - ### Methods inherited from interface org.eclipse.rdf4j.federated.evaluation.TripleSource

      `getStatements, getStatements, getStatements, getStatements, hasStatements, usePreparedQuery, usePreparedQuery`

- - ### Field Detail

    - #### federationContext

          protected final FederationContext federationContext

    - #### monitoringService

          protected final Monitoring monitoringService

    - #### endpoint

          protected final Endpoint endpoint

    - #### strategy

          protected final FederationEvalStrategy strategy

  - ### Constructor Detail

    - #### TripleSourceBase

          public TripleSourceBase(FederationContext federationContext,
                                  Endpoint endpoint)

  - ### Method Detail

    - #### getStatements

          public CloseableIteration<BindingSet,QueryEvaluationException> getStatements(String preparedQuery,
                                                                                       BindingSet queryBindings,
                                                                                       QueryType queryType,
                                                                                       QueryInfo queryInfo)
                                                                                throws RepositoryException,
                                                                                       MalformedQueryException,
                                                                                       QueryEvaluationException

      Description copied from interface: `TripleSource`
      Evaluate a given SPARQL query of the provided query type at the given source.
      Specified by:
        `getStatements` in interface `TripleSource`
        `queryBindings` - optional query bindings, use `EmptyBindingSet` if there are none
      Returns:
        the statements
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### getStatements

          public CloseableIteration<BindingSet,QueryEvaluationException> getStatements(String preparedQuery,
                                                                                       BindingSet bindings,
                                                                                       FilterValueExpr filterExpr,
                                                                                       QueryInfo queryInfo)
                                                                                throws RepositoryException,
                                                                                       MalformedQueryException,
                                                                                       QueryEvaluationException

      Description copied from interface: `TripleSource`
      Evaluate the prepared query (SPARQL query as String) on the provided endpoint.
      Specified by:
        `getStatements` in interface `TripleSource`
      Parameters:
        `preparedQuery` - a prepared query to evaluate (SPARQL query as String)
        `bindings` - the bindings to use
        `filterExpr` - the filter expression to apply or null if there is no filter or if it is evaluated already
      Returns:
        the resulting iteration
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### hasStatements

          public boolean hasStatements(Resource subj,
                                       IRI pred,
                                       Value obj,
                                       QueryInfo queryInfo,
                                       Resource... contexts)
                                throws RepositoryException

      Description copied from interface: `TripleSource`
      Check if the repository can return results for the given triple pattern represented by subj, pred and obj
      Specified by:
        `hasStatements` in interface `TripleSource`
      Returns:
        whether the source can provide results
      Throws:
        `RepositoryException`

    - #### hasStatements

          public boolean hasStatements(ExclusiveTupleExpr group,
                                       BindingSet bindings)
                                throws RepositoryException,
                                       MalformedQueryException,
                                       QueryEvaluationException

      Description copied from interface: `TripleSource`
      Check if the repository can return results for the given `ExclusiveTupleExpr`, e.g. for an `ExclusiveGroup` with a list of Statements.
      Specified by:
        `hasStatements` in interface `TripleSource`
      Returns:
        whether the repository can return results
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### monitorRemoteRequest

          protected void monitorRemoteRequest()

    - #### configureInference

          protected void configureInference(Query query,
                                            QueryInfo queryInfo)

      Set includeInferred depending on `QueryInfo.getIncludeInferred()`
      Parameters:
        `query` -
        `queryInfo` -

    - #### applyMaxExecutionTimeUpperBound

          protected void applyMaxExecutionTimeUpperBound(Operation operation)

      Apply an upper bound of the maximum execution time using `FedXUtil.applyMaxQueryExecutionTime(Operation, FederationContext)`.
      Parameters:
        `operation` - the operation

    - #### withConnection

          protected <T> CloseableIteration<T,QueryEvaluationException> withConnection(TripleSourceBase.ConnectionOperation<T> operation)

      Convenience method to perform an operation on a `RepositoryConnection`. This method takes care for closing resources as well error handling. The resulting iteration has to be supplied to the `TripleSourceBase.ResultHolder`.
      Parameters:
        `operation` - the `TripleSourceBase.ConnectionOperation`
      Returns:
        the resulting iteration

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.