Show / Hide Table of Contents

Class FederatedSparqlQueryClient

A class for connecting to multiple remote SPARQL endpoints and federating queries over them with the results merged locally.

Inheritance
object
FederatedSparqlQueryClient
Implements
ISparqlQueryClient
IConfigurationSerializable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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

| Edit this page View Source

FederatedSparqlQueryClient(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
IEnumerable<SparqlQueryClient> endpointClients

The remote endpoint clients to be federated.

| Edit this page View Source

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
HttpClient httpClient

The HTTP client to use for all connections.

Uri[] endpointUris

The URIs to connect to.

| Edit this page View Source

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.

Properties

| Edit this page View Source

IgnoreFailedRequests

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
bool
| Edit this page View Source

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
| Edit this page View Source

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

Methods

| Edit this page View Source

AddEndpoint(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.

| Edit this page View Source

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
Task<IGraph>

An RDF graph containing the combined results received from all remote endpoints.

| Edit this page View Source

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.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<IGraph>

An RDF Graph.

Remarks

This method should be used when processing SPARQL CONSTRUCT or DESCRIBE queries.

| Edit this page View Source

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
Task

An RDF graph containing the combined results received from all remote endpoints.

| Edit this page View Source

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.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task

An RDF graph containing the combined results received from all remote endpoints.

| Edit this page View Source

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.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<SparqlResultSet>

The Task object representing the asynchronous operation.

Remarks

The query results are returned as a result of the task.

| Edit this page View Source

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
CancellationToken cancellationToken
Returns
Type Description
Task

The Task object representing the asynchronous operation.

Remarks

The query results are reported through the specified ISparqlResultsHandler.

| Edit this page View Source

RemoveEndpoint(Uri)

Remove a remote endpoint.

Declaration
public void RemoveEndpoint(Uri endpointUri)
Parameters
Type Name Description
Uri endpointUri

The URI of the endpoint to be removed.

| Edit this page View Source

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.

| Edit this page View Source

SerializeConfiguration(ConfigurationSerializationContext)

Serializes the Endpoint's Configuration.

Declaration
public void SerializeConfiguration(ConfigurationSerializationContext context)
Parameters
Type Name Description
ConfigurationSerializationContext context

Configuration Serialization Context.

Implements

ISparqlQueryClient
IConfigurationSerializable

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • FederatedSparqlQueryClient(IEnumerable<SparqlQueryClient>)
    • FederatedSparqlQueryClient(HttpClient, params Uri[])
    • FederatedSparqlQueryClient(params SparqlQueryClient[])
  • Properties
    • IgnoreFailedRequests
    • MaxSimultaneousRequests
    • Timeout
  • Methods
    • AddEndpoint(SparqlQueryClient)
    • QueryWithResultGraphAsync(string)
    • QueryWithResultGraphAsync(string, CancellationToken)
    • QueryWithResultGraphAsync(string, IRdfHandler)
    • QueryWithResultGraphAsync(string, IRdfHandler, CancellationToken)
    • QueryWithResultSetAsync(string, CancellationToken)
    • QueryWithResultSetAsync(string, ISparqlResultsHandler, CancellationToken)
    • RemoveEndpoint(Uri)
    • RemoveEndpoint(SparqlQueryClient)
    • SerializeConfiguration(ConfigurationSerializationContext)
  • Implements
  • Extension Methods
Back to top Generated by DocFX