Click or drag to resize

ImplicitJoinOptimiser Class

An Algebra Optimiser which implements the Implicit Join optimisation.
Inheritance Hierarchy
SystemObject
  VDS.RDF.Query.OptimisationImplicitJoinOptimiser

Namespace:  VDS.RDF.Query.Optimisation
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
Syntax
public class ImplicitJoinOptimiser : IAlgebraOptimiser

The ImplicitJoinOptimiser type exposes the following members.

Constructors
  NameDescription
Public methodImplicitJoinOptimiser
Initializes a new instance of the ImplicitJoinOptimiser class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsApplicable(SparqlQuery)
Returns that this optimiser is applicable to all queries.
Public methodIsApplicable(SparqlUpdateCommandSet)
Returns that this optimiser is applicable to all updates.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOptimise
Optimises the Algebra to use implict joins where applicable.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

An implict join is implied by a query like the following:

            SELECT *
            WHERE
            {
              ?x a ?type .
              ?y a ?type .
              FILTER (?x = ?y) .
            }
            

Such queries can be very expensive to calculate, the implict join optimisation attempts to substitute one variable for the other and use a BIND to ensure both variables are visible outside of the graph pattern affected i.e. the resulting query looks like the following:

            SELECT *
            WHERE
            {
              ?x a ?type .
              ?x a ?type .
              BIND (?x AS ?y)
            }
            

Under normal circumstances this optimisation is only used when the implict join is denoted by a SAMETERM expression or the optimiser is sure the variables don't represent literals (they never occur in the Object position) since when value equality is involved substituing one variable for another changes the semantics of the query and may lead to unexpected results. Since this optimisation may offer big performance benefits for some queries (at the cost of potentially incorrect results) this form of the optimisation is allowed when you set UnsafeOptimisation to true.

This optimiser is also capable of generating special algebra to deal with the case where there is an implicit join but the substitution based optimisation does not apply because variables cannot be substituted into the inner algebra, in this case a FilteredProduct is generated instead.

See Also