public class RemoteSparqlBuilderFactory extends Object
The matter of interpretation is staightforward when the BINDINGS clause is accepted by the remote end point and there are no variables which are correlated within a solution through shared blank nodes.
Query generation and solution interpretation is significantly more complex when any of those things is not true. There are several strategies which may be used in these cases, including:
If there is only one source solution and it does not have any bindings, then we send the original SERVICE clause and DO NOT use the BINDINGS clause. This pattern works whether or not the the service end point supports bindings and covers the case where the service is run without vectoring in any solutions.
When there one or more non-empty solutions to be vectored and variable correlation is not present (or it is present but there is only one solution), and the service end point supports the BINDINGS clause, then we use the BINDINGS clause to vector the query against the remote SERVICE end point.
If there are multiple solutions and correlated variables -or- if the service does not support BINDINGS, then we use the UNION rewrite approach and BIND() the bindings within each alternative of the UNION (as a special case, no UNION is required if there is only one source solution (we can just BIND() the bindings) or if the source solution has no bound variables (we do not need to send any bindings).
Note: We do not need to use a rowId to correlate the source solutions and the service's solution. We will always do a hash join of the service solutions with the source solutions. The only time the hash join could be a problem is when there are blank nodes and multiple source solutions. However, we are already required to rewrite the SERVICE clause using a UNION pattern in this case so we can maintain the correlation of the blank nodes through the unique variable names in each alternative of the UNION. TODO ASK query optimization when there is a single triple pattern which is fully bound AND there is only one solution flowing into the service. (This is a pretty minor optimization and a very special case since we are more likely to have a vector of fully bound soltuions.) TODO If any of the source solutions is fully unbound, then the other source solutions could be eliminated since we will be running the service fully unbound anyway.
|Constructor and Description|
|Modifier and Type||Method and Description|
public static IRemoteSparqlQueryBuilder get(IServiceOptions serviceOptions, ServiceNode serviceNode, org.openrdf.query.BindingSet bindingSets)
serviceOptions- The configuration options for the service.
serviceNode- The SERVICE clause.
bindingSets- The source solutions. These will be used to create a BINDINGS clause for the query.
Copyright © 2006–2016 SYSTAP, LLC DBA Blazegraph. All rights reserved.