Class SparqlQuery
Represents a SPARQL Query.
Inheritance
Inherited Members
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public sealed class SparqlQuery
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Constructors
| Improve this Doc View SourceSparqlQuery(bool)
Creates a new SPARQL Query.
Declaration
public SparqlQuery(bool subQuery)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | subQuery | Whether this query is a sub-query. |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Properties
| Improve this Doc View SourceAlgebraOptimisers
Gets/Sets the locally scoped Algebra Optimisers that are used to optimise the Query Algebra in addition to (but before) any external (e.g. processor-provided) optimisers.
Declaration
public IEnumerable<IAlgebraOptimiser> AlgebraOptimisers { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IAlgebraOptimiser> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
BaseUri
Get or set the base URI used to resolve relative URI references.
Declaration
public Uri BaseUri { get; set; }
Property Value
Type | Description |
---|---|
System.Uri |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Bindings
Gets/Sets the VALUES Clause for the Query which are bindings that should be applied.
Declaration
public BindingsPattern Bindings { get; }
Property Value
Type | Description |
---|---|
BindingsPattern |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
ConstructTemplate
Gets/Sets the Construct Template for a Construct Query.
Declaration
public GraphPattern ConstructTemplate { get; }
Property Value
Type | Description |
---|---|
GraphPattern |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
DefaultGraphNames
Gets the names of the default graphs for the query.
Declaration
public IEnumerable<IRefNode> DefaultGraphNames { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IRefNode> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
DefaultGraphs
Gets the Default Graph URIs for the Query.
Declaration
[Obsolete("Replaced by DefaultGraphNames")]
public IEnumerable<Uri> DefaultGraphs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><System.Uri> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
DescribeVariables
Gets the Variables, QNames and URIs used in the Describe Query.
Declaration
public IEnumerable<IToken> DescribeVariables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IToken> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
ExpressionFactories
Gets/Sets the locally scoped Expression Factories that may be used if the query is using the CALL() function to do dynamic function invocation.
Declaration
public IEnumerable<ISparqlCustomExpressionFactory> ExpressionFactories { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><ISparqlCustomExpressionFactory> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
GroupBy
Gets/Sets the Grouping for the Query.
Declaration
public ISparqlGroupBy GroupBy { get; }
Property Value
Type | Description |
---|---|
ISparqlGroupBy |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
HasDistinctModifier
Gets whether a Query has a DISTINCT modifier.
Declaration
public bool HasDistinctModifier { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
HasSolutionModifier
Gets whether the Query has a Solution Modifier (a GROUP BY, HAVING, ORDER BY, LIMIT or OFFSET).
Declaration
public bool HasSolutionModifier { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Having
Gets/Sets the Having Clause for the Query.
Declaration
public ISparqlFilter Having { get; }
Property Value
Type | Description |
---|---|
ISparqlFilter |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
IsAggregate
Gets whether the Query has an Aggregate as its Result.
Declaration
public bool IsAggregate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
IsOptimised
Gets whether Optimisation has been applied to the query.
Declaration
public bool IsOptimised { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This only indicates that an Optimiser has been applied. You can always reoptimise the query using a different optimiser by using the relevant overload of the Optimise() method.
IsSubQuery
Gets whether this Query is a Sub-Query in another Query.
Declaration
public bool IsSubQuery { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Limit
Gets the Result Set Limit for the Query.
Declaration
public int Limit { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
Values less than zero are counted as -1 which indicates no limit.
NamedGraphNames
Gets the names of the named graphs for the query.
Declaration
public IEnumerable<IRefNode> NamedGraphNames { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IRefNode> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
NamedGraphs
Gets the Named Graph URIs for the Query.
Declaration
[Obsolete("Replaced by NamedGraphNames")]
public IEnumerable<Uri> NamedGraphs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><System.Uri> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
NamespaceMap
Gets the map of namespace prefixes to URIs.
Declaration
public INamespaceMapper NamespaceMap { get; }
Property Value
Type | Description |
---|---|
INamespaceMapper |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Offset
Gets/Sets the Result Set Offset for the Query.
Declaration
public int Offset { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
Values less than zero are treated as 0 which indicates no offset.
OrderBy
Gets/Sets the Ordering for the Query.
Declaration
public ISparqlOrderBy OrderBy { get; }
Property Value
Type | Description |
---|---|
ISparqlOrderBy |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
PartialResultsOnTimeout
Gets/Sets whether Partial Results should be returned in the event of Query Timeout.
Declaration
public bool PartialResultsOnTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Partial Results (typically) only applies when executing the Query in memory. If you have an instance of this class and pass its string representation (using ToString()) you will lose the partial results information as this is not serialisable in SPARQL syntax.
PropertyFunctionFactories
Gets/Sets the locally scoped Property Function factories that may be used by the PropertyFunctionOptimiser when generating the algebra for the query.
Declaration
public IEnumerable<IPropertyFunctionFactory> PropertyFunctionFactories { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IPropertyFunctionFactory> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
QueryExecutionTime
Gets the Time taken to execute a Query.
Declaration
public TimeSpan? QueryExecutionTime { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan? |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if you try and inspect the execution time before the Query has been executed. |
QueryType
Gets the type of the Query.
Declaration
public SparqlQueryType QueryType { get; }
Property Value
Type | Description |
---|---|
SparqlQueryType |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
RootGraphPattern
Gets the top level Graph Pattern of the Query.
Declaration
public GraphPattern RootGraphPattern { get; }
Property Value
Type | Description |
---|---|
GraphPattern |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
SpecialType
Gets the Special Type of the Query (if any).
Declaration
public SparqlSpecialQueryType SpecialType { get; }
Property Value
Type | Description |
---|---|
SparqlSpecialQueryType |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Timeout
Gets/Sets the Query Execution Timeout in milliseconds.
Declaration
public long Timeout { get; set; }
Property Value
Type | Description |
---|---|
long |
Remarks
This Timeout (typically) only applies when executing the Query in memory. If you have an instance of this class and pass its string representation (using ToString()) you will lose the timeout information as this is not serialisable in SPARQL syntax.
UsesDefaultDataset
Gets whether a Query uses the Default Dataset against which it is evaluated.
Declaration
public bool UsesDefaultDataset { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If the value is true then the Query will use whatever dataset is it evaluated against. If the value is false then the query changes the dataset at one/more points during its evaluation.
Things that may change the dataset and cause a query not to use the Default Dataset are as follows:.
- FROM clauses (but not FROM NAMED)
- GRAPH clauses
- Subqueries which do not use the default dataset
Variables
Gets the Variables used in the Query.
Declaration
public IEnumerable<SparqlVariable> Variables { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><SparqlVariable> |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
VirtualCount
The number of results that would be returned without any limit clause to a query or -1 if not supported. Defaults to the same value as the Count member.
Declaration
[Obsolete("This property is obsolete and is no longer set when a query is processed")]
public int VirtualCount { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Methods
| Improve this Doc View SourceAddDefaultGraph(Uri)
Adds a Default Graph URI.
Declaration
[Obsolete("Replaced by AddDefaultGraph(IRefNode)")]
public void AddDefaultGraph(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | Graph URI. |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
AddDefaultGraph(IRefNode)
Adds a graph to the default graph of the query.
Declaration
public void AddDefaultGraph(IRefNode n)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | n |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
AddNamedGraph(Uri)
Adds a Named Graph URI.
Declaration
[Obsolete("Replaced by AddNamedGraph(IRefNode)")]
public void AddNamedGraph(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | Graph URI. |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
AddNamedGraph(IRefNode)
Adds a named graph to the query.
Declaration
public void AddNamedGraph(IRefNode n)
Parameters
Type | Name | Description |
---|---|---|
IRefNode | n |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
ClearDefaultGraphs()
Removes all Default Graph URIs.
Declaration
public void ClearDefaultGraphs()
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
ClearNamedGraphs()
Removes all Named Graph URIs.
Declaration
public void ClearNamedGraphs()
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Copy()
Creates a copy of the query.
Declaration
public SparqlQuery Copy()
Returns
Type | Description |
---|---|
SparqlQuery |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
FromServiceQuery(GraphPattern, int)
Create a query instance that can be passed to remote endpoint when processing a SERVICE clause in a SPARQL Query.
Declaration
public static SparqlQuery FromServiceQuery(GraphPattern serviceGraphPattern, int limit)
Parameters
Type | Name | Description |
---|---|---|
GraphPattern | serviceGraphPattern | The root graph pattern of the SERVICE query. |
int | limit | The limit on the number of results requested. |
Returns
Type | Description |
---|---|
SparqlQuery |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Optimise()
Applies optimisation to a Query using the default global optimiser.
Declaration
public void Optimise()
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Optimise(IQueryOptimiser)
Applies optimisation to a Query using the specific optimiser.
Declaration
public void Optimise(IQueryOptimiser optimiser)
Parameters
Type | Name | Description |
---|---|---|
IQueryOptimiser | optimiser | Query Optimiser. |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
Process(ISparqlQueryProcessor)
Processes the Query using the given Query Processor.
Declaration
public object Process(ISparqlQueryProcessor processor)
Parameters
Type | Name | Description |
---|---|---|
ISparqlQueryProcessor | processor | SPARQL Query Processor. |
Returns
Type | Description |
---|---|
System.Object |
Remarks
Note: This class is purposefully sealed and most setters are private/protected internal since generally you create a query by using the SparqlQueryParser to parse a query string/file.
To build a query programmatically you can use the QueryBuilder class to generate a new query and then various extension methods to modify that query using a fluent style API. A query is not immutable so if you use that API you are modifying the query, if you want to generate new queries by modifying an existing query consider using the Copy() method to take a copy of the existing query.
ToAlgebra(bool, IEnumerable<IAlgebraOptimiser>)
Converts the Query into it's SPARQL Algebra representation (as represented in the Leviathan API).
Declaration
public ISparqlAlgebra ToAlgebra(bool optimise = true, IEnumerable<IAlgebraOptimiser> optimisers = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | optimise | Boolean flag indicating whether to apply algebra optimisation. |
System.Collections.Generic.IEnumerable<T><IAlgebraOptimiser> | optimisers | The external algebra optimisers to apply. |
Returns
Type | Description |
---|---|
ISparqlAlgebra |
Remarks
If optimisers
is null, only any locally defined optimisation will be applied.
ToString()
Generates a String representation of the Query.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
This method may not return a complete representation of the Query depending on the Query it is called on as not all the classes which can be included in a Sparql query currently implement ToString methods.