Class VariableSubstitutionTransformer
An optimiser for walking algebra and expression trees and replacing a Variable with another Variable or a Constant.
Inherited Members
Namespace: VDS.RDF.Query.Optimisation
Assembly: dotNetRdf.dll
Syntax
public class VariableSubstitutionTransformer : PrimaryExpressionSubstituter, IExpressionTransformer, IAlgebraOptimiser
Constructors
| Edit this page View SourceVariableSubstitutionTransformer(string, string)
Create a transform that replaces one variable with another.
Declaration
public VariableSubstitutionTransformer(string findVar, string replaceVar)
Parameters
Type | Name | Description |
---|---|---|
string | findVar | Find Variable. |
string | replaceVar | Replace Variable. |
VariableSubstitutionTransformer(string, INode)
Create a transform that replaces a variable with a constant.
Declaration
public VariableSubstitutionTransformer(string findVar, INode replaceTerm)
Parameters
Type | Name | Description |
---|---|---|
string | findVar | Find Variable. |
INode | replaceTerm | Replace Constant. |
Properties
| Edit this page View SourceCanReplaceObjects
Gets/Sets whethe the Transformer is allowed to replace objects.
Declaration
public bool CanReplaceObjects { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The transformer will intelligently select this depending on whether it is replacing with a constant (defaults to true) or a variable (defaults to false), when replacing a variable the behaviour changes automatically. If you set it explicitly the transformer will respect your setting regardless.
UnsafeOptimisation
Determines whether an Optimiser will perform algebra optimizations that are potentially unsafe at execution time.
Declaration
public bool UnsafeOptimisation { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceIsApplicable(SparqlQuery)
Returns false because this optimiser is never globally applicable.
Declaration
public bool IsApplicable(SparqlQuery q)
Parameters
Type | Name | Description |
---|---|---|
SparqlQuery | q | Query. |
Returns
Type | Description |
---|---|
bool |
IsApplicable(SparqlUpdateCommandSet)
Returns false because this optimiser is never globally applicable.
Declaration
public bool IsApplicable(SparqlUpdateCommandSet cmds)
Parameters
Type | Name | Description |
---|---|---|
SparqlUpdateCommandSet | cmds | Update Commands. |
Returns
Type | Description |
---|---|
bool |
Optimise(ISparqlAlgebra)
Attempts to do variable substitution within the given algebra.
Declaration
public ISparqlAlgebra Optimise(ISparqlAlgebra algebra)
Parameters
Type | Name | Description |
---|---|---|
ISparqlAlgebra | algebra | Algebra. |
Returns
Type | Description |
---|---|
ISparqlAlgebra |
SubstitutePrimaryExpression(ISparqlExpression)
Tries to substitute variables within primary expressions.
Declaration
protected override ISparqlExpression SubstitutePrimaryExpression(ISparqlExpression expr)
Parameters
Type | Name | Description |
---|---|---|
ISparqlExpression | expr | Expression. |
Returns
Type | Description |
---|---|
ISparqlExpression |