Interface Service


  • public interface Service

    Interface representing a Service that is capable of providing results due to the evaluation of a SPARQL query.

    Since:
    3.0
    Author:
    Michael Grove
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean answersSparqlQueries()
      Are queries against this service SPARQL queries? If so, we can perform reasoning, etc.
      boolean canEvaluate​(IRI iri)
      Return whether or not the Service can answer
      default boolean customTermReplacement()
      If this returns true, the service is expected to override replaceQueryTerms(PlanNodeVarReplacer, ServicePlanNode) to implement custom logic of replacing query terms.
      default java.util.function.BooleanSupplier getAvailability​(IRI serviceIri)
      Return a BooleanSupplier that indicates whether the service is available (not closed) and therefore still valid for use in the cache The purpose of using a BooleanSupplier rather than just calling an availability method is to account for the possibility that a Service may delegate to different virtual graphs over time.
      default boolean isAccessibleFrom​(java.lang.String database, IRI serviceIri)  
      default com.complexible.stardog.plan.PlanNode replaceQueryTerms​(com.complexible.stardog.plan.util.PlanNodeVarReplacer replacer, com.complexible.stardog.plan.ServicePlanNode serviceNode)
      Replaces query terms in the given ServicePlanNode.
      default boolean respectsNamedGraphSecurity()
      Is the service restricted to graphs accessible according to the named graph security constraints?
      default boolean supportsConstantReplacement()
      Does this service create queries which support constant replacement? If so, caching with constant canonicalization is performed.
      default com.complexible.stardog.plan.PlanNode translate​(com.complexible.stardog.plan.eval.ExecutionContext execCxt, IRI iri, com.complexible.stardog.plan.PlanNode body, com.complexible.stardog.plan.QueryTerm context, java.util.function.IntFunction<java.lang.String> varNames, java.util.function.Function<java.lang.String,​java.lang.Integer> varAllocator, boolean silent)  
      com.complexible.stardog.plan.PlanNode translate​(com.complexible.stardog.plan.eval.ExecutionContext execCxt, IRI iri, com.complexible.stardog.plan.PlanNode body, java.util.function.IntFunction<java.lang.String> varNames, java.util.function.Function<java.lang.String,​java.lang.Integer> varAllocator, boolean silent)
      Translate a query fragment to a call to this service
    • Method Detail

      • canEvaluate

        boolean canEvaluate​(IRI iri)
        Return whether or not the Service can answer
        Parameters:
        iri - the IRI of the service
        Returns:
        true if this service can evaluate the query, false otherwise
      • translate

        com.complexible.stardog.plan.PlanNode translate​(com.complexible.stardog.plan.eval.ExecutionContext execCxt,
                                                        IRI iri,
                                                        com.complexible.stardog.plan.PlanNode body,
                                                        java.util.function.IntFunction<java.lang.String> varNames,
                                                        java.util.function.Function<java.lang.String,​java.lang.Integer> varAllocator,
                                                        boolean silent)
        Translate a query fragment to a call to this service
      • translate

        default com.complexible.stardog.plan.PlanNode translate​(com.complexible.stardog.plan.eval.ExecutionContext execCxt,
                                                                IRI iri,
                                                                com.complexible.stardog.plan.PlanNode body,
                                                                com.complexible.stardog.plan.QueryTerm context,
                                                                java.util.function.IntFunction<java.lang.String> varNames,
                                                                java.util.function.Function<java.lang.String,​java.lang.Integer> varAllocator,
                                                                boolean silent)
      • respectsNamedGraphSecurity

        default boolean respectsNamedGraphSecurity()
        Is the service restricted to graphs accessible according to the named graph security constraints?
      • supportsConstantReplacement

        default boolean supportsConstantReplacement()
        Does this service create queries which support constant replacement? If so, caching with constant canonicalization is performed. If not, the service body will be added to the cache without canonicalization.
      • replaceQueryTerms

        default com.complexible.stardog.plan.PlanNode replaceQueryTerms​(com.complexible.stardog.plan.util.PlanNodeVarReplacer replacer,
                                                                        com.complexible.stardog.plan.ServicePlanNode serviceNode)
        Replaces query terms in the given ServicePlanNode. Most services would simply delegate to the PlanNodeVarReplacer but some may require custom logic for inlining constants etc.
      • answersSparqlQueries

        default boolean answersSparqlQueries()
        Are queries against this service SPARQL queries? If so, we can perform reasoning, etc.
      • getAvailability

        default java.util.function.BooleanSupplier getAvailability​(IRI serviceIri)
        Return a BooleanSupplier that indicates whether the service is available (not closed) and therefore still valid for use in the cache The purpose of using a BooleanSupplier rather than just calling an availability method is to account for the possibility that a Service may delegate to different virtual graphs over time. The BooleanSupplier will return the availability of the virtual graph that handled this serviceIri at the time this method is called, not when BooleanSupplier.getAsBoolean() is called. Important for plan cache invalidation.
      • isAccessibleFrom

        default boolean isAccessibleFrom​(java.lang.String database,
                                         IRI serviceIri)