Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2154

Custom SERVICE executors

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Done
    • Jena 4.1.0
    • Jena 4.2.0
    • ARQ
    • None

    Description

      While Jena features many extension points for SPARQL query processing, such as for custom functions and property functions, there is no dedicated extension point for custom SERVICE executors.

      The relevant classes are OpExecutor and QueryIterService:

      While it is possible to configure a custom OpExecutor's in a Context which provides SERVICE extensions, it is not possible to combine the functionality of two different OpExecutors.

      Concrete use case: The following two projects use their own OpExecutor implementation for providing service extensions:

      • RDF Processing Toolkit supports a service executor for doing binary search over remote sorted (bzip2 encoded) ntriples files
      • SPARQL Anything provides service extensions for ingesting non-RDF data as RDF

      Proposed solution:

      • Introduce a ServiceExecutorFactory that serves as the extension point for supplying custom QueryIterators if the request can be handled
        public interface ServiceExecutorFactory {
            Supplier<QueryIterator> createExecutor(OpService op, Binding binding, ExecutionContext context);
        }
        
      • Introduce a Symbol for referring to a List<ServiceExecutorFactory> in the Context
      • Extend QueryIterService such that it consults the Context for custom ServiceExecutorFactories - and invokes the first match from the list before falling back to the standard implementation.
      • Example usage:
        try (QueryExecution qe = QueryExecutionFactory.create(...)) {
          qe.getContext().put(ARQ.customServiceExecutors,
            Arrays.asList(/* ServiceExecutorFactories */));
        }
        

      This way, SERVICE extensions do not require custom OpExecutor implementations (because it would be handled by QueryIterService) - and conversely, such extensions would also work with any custom OpExecutor that yields the original QueryIterService implementation.

      I could provide my implementation as a PR.

      Attachments

        Activity

          People

            andy Andy Seaborne
            Aklakan Claus Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: