Class SparqlEvaluationContext
Stores information about the Evaluation of a Query during its evaluation.
Inherited Members
Namespace: VDS.RDF.Query
Assembly: dotNetRdf.dll
Syntax
public class SparqlEvaluationContext : IPatternEvaluationContext, ISparqlDescribeContext
Constructors
| Edit this page View SourceSparqlEvaluationContext(SparqlQuery, ISparqlDataset, ISparqlQueryAlgebraProcessor<BaseMultiset, SparqlEvaluationContext>, LeviathanQueryOptions)
Creates a new Evaluation Context for the given Query over the given Dataset using a specific processor.
Declaration
public SparqlEvaluationContext(SparqlQuery q, ISparqlDataset data, ISparqlQueryAlgebraProcessor<BaseMultiset, SparqlEvaluationContext> processor, LeviathanQueryOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| SparqlQuery | q | Query. |
| ISparqlDataset | data | Dataset. |
| ISparqlQueryAlgebraProcessor<BaseMultiset, SparqlEvaluationContext> | processor | Query Processor. |
| LeviathanQueryOptions | options | The query processor options to use. |
SparqlEvaluationContext(SparqlQuery, ISparqlDataset, LeviathanQueryOptions)
Creates a new Evaluation Context for the given Query over the given Dataset.
Declaration
public SparqlEvaluationContext(SparqlQuery q, ISparqlDataset data, LeviathanQueryOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| SparqlQuery | q | Query. |
| ISparqlDataset | data | Dataset. |
| LeviathanQueryOptions | options | The query processor options to use. |
SparqlEvaluationContext(SparqlResultBinder, LeviathanQueryOptions)
Creates a new Evaluation Context which is a Container for the given Result Binder.
Declaration
public SparqlEvaluationContext(SparqlResultBinder binder, LeviathanQueryOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| SparqlResultBinder | binder | |
| LeviathanQueryOptions | options | The query processor options to use. |
Properties
| Edit this page View SourceBinder
Gets/Sets the Results Binder.
Declaration
public SparqlResultBinder Binder { get; set; }
Property Value
| Type | Description |
|---|---|
| SparqlResultBinder |
Data
Gets the Dataset the query is over.
Declaration
public ISparqlDataset Data { get; }
Property Value
| Type | Description |
|---|---|
| ISparqlDataset |
InputMultiset
Gets/Sets the Input Multiset.
Declaration
public BaseMultiset InputMultiset { get; set; }
Property Value
| Type | Description |
|---|---|
| BaseMultiset |
this[string]
Gets/Sets a Object that should be persisted over the entire Evaluation Context.
Declaration
public object this[string key] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key. |
Property Value
| Type | Description |
|---|---|
| object |
Remarks
May be used by parts of the Evaluation Process that need to ensure a persistent state across the entire Evaluation Query (e.g. the implementation of the BNODE() function).
NodeComparer
Get the comparer to use when ordering nodes during query processing.
Declaration
public ISparqlNodeComparer NodeComparer { get; }
Property Value
| Type | Description |
|---|---|
| ISparqlNodeComparer |
Options
Get the configured query options for this evaluation context.
Declaration
public LeviathanQueryOptions Options { get; }
Property Value
| Type | Description |
|---|---|
| LeviathanQueryOptions |
OrderingComparer
Get the comparer to use when sorting query results.
Declaration
public SparqlOrderingComparer OrderingComparer { get; }
Property Value
| Type | Description |
|---|---|
| SparqlOrderingComparer |
OutputMultiset
Gets/Sets the Output Multiset.
Declaration
public BaseMultiset OutputMultiset { get; set; }
Property Value
| Type | Description |
|---|---|
| BaseMultiset |
Processor
Gets the custom query processor that is in use (if any).
Declaration
public ISparqlQueryAlgebraProcessor<BaseMultiset, SparqlEvaluationContext> Processor { get; }
Property Value
| Type | Description |
|---|---|
| ISparqlQueryAlgebraProcessor<BaseMultiset, SparqlEvaluationContext> |
Query
Gets the Query that is being evaluated.
Declaration
public SparqlQuery Query { get; }
Property Value
| Type | Description |
|---|---|
| SparqlQuery |
QueryTime
Retrieves the Time in milliseconds the query took to evaluate.
Declaration
public long QueryTime { get; }
Property Value
| Type | Description |
|---|---|
| long |
QueryTimeTicks
Retrieves the Time in ticks the query took to evaluate.
Declaration
public long QueryTimeTicks { get; }
Property Value
| Type | Description |
|---|---|
| long |
QueryTimeout
Gets the Query Timeout used for the Query.
Declaration
public long QueryTimeout { get; }
Property Value
| Type | Description |
|---|---|
| long |
Remarks
This is taken either from the Timeout property of the SparqlQuery to which this evaluation context pertains (if any) or from the the processor-defined timeout value passed as a parameter to StartExecution(long) method. You cannot set the Query Timeout to be higher than the processor-defined timeout unless the processor-defined timeout is set to zero (i.e. no processor-defined timeout).
RemainingTimeout
Gets the Remaining Timeout i.e. the Timeout taking into account time already elapsed.
Declaration
public long RemainingTimeout { get; }
Property Value
| Type | Description |
|---|---|
| long |
Remarks
If there is no timeout then this is always zero, if there is a timeout this is always >= 1 since any operation that wants to respect the timeout must have a non-zero timeout to actually timeout properly.
RigorousEvaluation
Gets whether pattern evaluation should use rigorous evaluation mode.
Declaration
public bool RigorousEvaluation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TrimTemporaryVariables
Gets/Sets whether BGPs should trim temporary variables.
Declaration
public bool TrimTemporaryVariables { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
TripleIndex
Get the index that provides access to the underlying data being queried.
Declaration
public ITripleIndex TripleIndex { get; }
Property Value
| Type | Description |
|---|---|
| ITripleIndex |
UriFactory
Get the factory to use when creating URI instances.
Declaration
public IUriFactory UriFactory { get; }
Property Value
| Type | Description |
|---|---|
| IUriFactory |
Methods
| Edit this page View SourceCalculateTimeout(long)
Return the execution timeout to be applied to this evaluation context given the specified processor-defined maximum execution timeout.
Declaration
public long CalculateTimeout(long maxTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| long | maxTimeout |
Returns
| Type | Description |
|---|---|
| long | The execution timeout for the query in this context (if any). |
CheckTimeout()
Checks whether Execution should Time out.
Declaration
public void CheckTimeout()
Exceptions
| Type | Condition |
|---|---|
| RdfQueryTimeoutException | Thrown if the Query has exceeded the Execution Timeout. |
ContainsValue(string, INode)
Gets whether the evaluation context contains a binding of the specified value to the specified variable.
Declaration
public bool ContainsValue(string varName, INode value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | varName | The name of the variable to look for. |
| INode | value | The expected value. |
Returns
| Type | Description |
|---|---|
| bool | True if the evaluation context contains a binding for |
ContainsVariable(string)
Get whether the specified variable is found in the evaluation context.
Declaration
public bool ContainsVariable(string varName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | varName | The name of the variable to look for. |
Returns
| Type | Description |
|---|---|
| bool | True if the evaluation context contains a whose name matches |
EndExecution()
Ends the Execution Timer.
Declaration
public void EndExecution()
Evaluate(ISparqlAlgebra)
Evaluates an Algebra Operator in this Context using the current Query Processor (if any) or the default query processor.
Declaration
public BaseMultiset Evaluate(ISparqlAlgebra algebra)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparqlAlgebra | algebra | Algebra. |
Returns
| Type | Description |
|---|---|
| BaseMultiset |
Evaluate(TriplePattern)
Evaluate a triple pattern.
Declaration
public void Evaluate(TriplePattern triplePattern)
Parameters
| Type | Name | Description |
|---|---|---|
| TriplePattern | triplePattern |
GetHttpClient(Uri)
Return an HttpClient instance to use when connecting to a specific URI endpoint.
Declaration
public HttpClient GetHttpClient(Uri endpointUri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | endpointUri | The endpoint to connect to. |
Returns
| Type | Description |
|---|---|
| HttpClient | An HttpClient instance to use for connections to the specified endpoint. |
GetNodes(INodeFactory)
Get the nodes to be described.
Declaration
public IEnumerable<INode> GetNodes(INodeFactory factory)
Parameters
| Type | Name | Description |
|---|---|---|
| INodeFactory | factory |
Returns
| Type | Description |
|---|---|
| IEnumerable<INode> |
GetQuotedTriples(QuotedTriplePattern)
Return all quoted triples in the dataset that match the specified pattern.
Declaration
public IEnumerable<ITripleNode> GetQuotedTriples(QuotedTriplePattern qtp)
Parameters
| Type | Name | Description |
|---|---|---|
| QuotedTriplePattern | qtp |
Returns
| Type | Description |
|---|---|
| IEnumerable<ITripleNode> |
GetTriples(IMatchTriplePattern)
Gets the Enumeration of Triples that should be assessed for matching the pattern.
Declaration
public IEnumerable<Triple> GetTriples(IMatchTriplePattern triplePattern)
Parameters
| Type | Name | Description |
|---|---|---|
| IMatchTriplePattern | triplePattern | The pattern to be matched. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Triple> |
StartExecution(long)
Starts the Execution Timer.
Declaration
public void StartExecution(long maxTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| long | maxTimeout | The maximum time (in milliseconds) to allow the query to run for. This may be overridden by the timeout specified in the query itself. |
Remarks
A value of zero or less for maxTimeout indicates no timeout. If a finite timeout is specified both by maxTimeout and in the query, then the shorter of these two timeout values will be used.