ImplicitJoinOptimiser Class |
Namespace: VDS.RDF.Query.Optimisation
The ImplicitJoinOptimiser type exposes the following members.
Name | Description | |
---|---|---|
ImplicitJoinOptimiser | Initializes a new instance of the ImplicitJoinOptimiser class |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsApplicable(SparqlQuery) |
Returns that this optimiser is applicable to all queries.
| |
IsApplicable(SparqlUpdateCommandSet) |
Returns that this optimiser is applicable to all updates.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Optimise |
Optimises the Algebra to use implict joins where applicable.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.