Class FederatedSparqlQueryClient
A class for connecting to multiple remote SPARQL endpoints and federating queries over them with the results merged locally.
Inheritance
Inherited Members
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public class FederatedSparqlQueryClient : ISparqlQueryClient, IConfigurationSerializable
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
Constructors
| Improve this Doc View SourceFederatedSparqlQueryClient(IEnumerable<SparqlQueryClient>)
Create a new federated client that connects to a number of remote SPARQL endpoints.
Declaration
public FederatedSparqlQueryClient(IEnumerable<SparqlQueryClient> endpointClients)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><SparqlQueryClient> | endpointClients | The remote endpoint clients to be federated. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
FederatedSparqlQueryClient(HttpClient, params Uri[])
Create a new federated client connecting to a number of remote SPARQL endpoints.
Declaration
public FederatedSparqlQueryClient(HttpClient httpClient, params Uri[] endpointUris)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Http.HttpClient | httpClient | The HTTP client to use for all connections. |
System.Uri[] | endpointUris | The URIs to connect to. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
FederatedSparqlQueryClient(params SparqlQueryClient[])
Create a new federated client that connects to a number of remote SPARQL endpoints.
Declaration
public FederatedSparqlQueryClient(params SparqlQueryClient[] endpointClients)
Parameters
Type | Name | Description |
---|---|---|
SparqlQueryClient[] | endpointClients | The remote endpoint clients to be federated. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
Properties
| Improve this Doc View SourceIgnoreFailedRequests
Get or set whether a failed request on one endpoint should cause the entire request to fail.
Declaration
public bool IgnoreFailedRequests { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
MaxSimultaneousRequests
Get or set the maximum number of endpoints that this client will issue queries to at any one time.
Declaration
public int MaxSimultaneousRequests { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
Timeout
Get or set the period of time to wait for a response from any given endpoint.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
Methods
| Improve this Doc View SourceAddEndpoint(SparqlQueryClient)
Add a remote endpoint using the specified client instance.
Declaration
public void AddEndpoint(SparqlQueryClient endpointClient)
Parameters
Type | Name | Description |
---|---|---|
SparqlQueryClient | endpointClient | The client to use to connect to the remote endpoint. |
Remarks
This method allows callers to use a specific HttpClient for certain remote endpoints by first constructing a SparqlQueryClient instance and then passing it to this method.
QueryWithResultGraphAsync(string, CancellationToken)
Execute a SPARQL query that is intended to return an RDF Graph.
Declaration
public Task<IGraph> QueryWithResultGraphAsync(string sparqlQuery, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | The query to be executed. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><IGraph> | An RDF Graph. |
Remarks
This method should be used when processing SPARQL CONSTRUCT or DESCRIBE queries.
QueryWithResultGraphAsync(string, IRdfHandler, CancellationToken)
Execute a SPARQL query where the expected result is a graph - i.e. a CONSTRUCT or DESCRIBE query.
Declaration
public Task QueryWithResultGraphAsync(string sparqlQuery, IRdfHandler handler, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | The SPARQL query string. |
IRdfHandler | handler | The handler to use when parsing the graph data returned by the server. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An RDF graph containing the combined results received from all remote endpoints. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
QueryWithResultGraphAsync(string, IRdfHandler)
Execute a SPARQL query where the expected result is a graph - i.e. a CONSTRUCT or DESCRIBE query.
Declaration
public Task QueryWithResultGraphAsync(string sparqlQuery, IRdfHandler handler)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | The SPARQL query string. |
IRdfHandler | handler | The handler to use when parsing the graph data returned by the server. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An RDF graph containing the combined results received from all remote endpoints. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
QueryWithResultGraphAsync(string)
Execute a SPARQL query where the expected result is a graph - i.e. a CONSTRUCT or DESCRIBE query.
Declaration
public Task<IGraph> QueryWithResultGraphAsync(string sparqlQuery)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | The SPARQL query string. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><IGraph> | An RDF graph containing the combined results received from all remote endpoints. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
QueryWithResultSetAsync(string, CancellationToken)
Run a federated query asynchronously.
Declaration
public Task<SparqlResultSet> QueryWithResultSetAsync(string sparqlQuery, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | The query to be executed. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><SparqlResultSet> | The Task object representing the asynchronous operation. |
Remarks
The query results are returned as a result of the task.
QueryWithResultSetAsync(string, ISparqlResultsHandler, CancellationToken)
Run a federated query asynchronously.
Declaration
public Task QueryWithResultSetAsync(string sparqlQuery, ISparqlResultsHandler handler, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | sparqlQuery | |
ISparqlResultsHandler | handler | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The Task object representing the asynchronous operation. |
Remarks
The query results are reported through the specified ISparqlResultsHandler.
RemoveEndpoint(Uri)
Remove a remote endpoint.
Declaration
public void RemoveEndpoint(Uri endpointUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | endpointUri | The URI of the endpoint to be removed. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
RemoveEndpoint(SparqlQueryClient)
Remove a remote endpoint.
Declaration
public void RemoveEndpoint(SparqlQueryClient endpointClient)
Parameters
Type | Name | Description |
---|---|---|
SparqlQueryClient | endpointClient | The endpoint client to be removed from the federation. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.
SerializeConfiguration(ConfigurationSerializationContext)
Serializes the Endpoint's Configuration.
Declaration
public void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
Type | Name | Description |
---|---|---|
ConfigurationSerializationContext | context | Configuration Serialization Context. |
Remarks
Queries are federated by executing multiple requests simultaneously and asynchronously against the endpoints in question with the data then merged locally. The merging process does not attempt to remove duplicate data it just naively merges the data.