Aklakan commented on issue #1314:
URL: https://github.com/apache/jena/issues/1314#issuecomment-1143889131

   Yes, that's what I am doing already for configuration of bulk sizes or 
caching as in 
[ChainingServiceExecutorBulkSpecial.java#L132](https://github.com/Aklakan/jena/blob/322c4d9c9873e867bf9c986951d468edf05b9ee0/jena-arq/src/main/java/org/apache/jena/sparql/service/impl/ChainingServiceExecutorBulkSpecial.java#L132).
   
   What I meant is, that the chaining API allows for passing arguments to 
whatever service executors remain in the two service executor registries (bulk 
and non-bulk).
   
   I added a new example to the [CustomServiceExecutor 
examples](https://github.com/Aklakan/jena/blob/gh-1314/jena-examples/src/main/java/arq/examples/service/CustomServiceExecutor.java#L107)
 which uses the chaining API - just below the non-chaining version:
   
   In summary:
   
   "Old" approach:
   ```java
   ServiceExecutorFactory relaySef = (opExecute, original, binding, execCxt) -> 
{
           if (opExecute.getService().equals(WIKIDATA)) {
               opExecute = new OpService(DBPEDIA, opExecute.getSubOp(), 
opExecute.getSilent());
               // ISSUE: We cannot easily forward the new OpExecute to the 
remainder of the registered service executors
               // We would have to check at which index 'relaySef' is 
registered and then manually do the forwarding
               return 
ServiceExecutorRegistry.httpService.createExecutor(opExecute, original, 
binding, execCxt);
           }
           return null;
       };
   ```
   
   Improved API:
   ```
   ChainingServiceExecutor relaySef = (opExecute, original, binding, execCxt, 
chain) -> {
       if (opExecute.getService().equals(WIKIDATA)) {
           opExecute = new OpService(DBPEDIA, opExecute.getSubOp(), 
opExecute.getSilent());
       }
       return chain.createExecution(opExecute, original, binding, execCxt);
   };
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to