Class QueryOptimizer.AddTypeToRolePlayer

java.lang.Object
net.ontopia.topicmaps.query.impl.utils.QueryOptimizer.AbstractQueryOptimizer
net.ontopia.topicmaps.query.impl.utils.QueryOptimizer.AddTypeToRolePlayer
All Implemented Interfaces:
QueryOptimizerIF
Enclosing class:
QueryOptimizer

public static class QueryOptimizer.AddTypeToRolePlayer extends QueryOptimizer.AbstractQueryOptimizer
INTERNAL:

Optimizes the role-player() predicate when the type of the role is known from a type() predicate in the same query. Typical usage is:

 role-player($R1, fixed-point),
 association-role($A, $R1),
 association-role($A, $R2),
 $R1 /= $R2,
 role-player($R2, $OTHER),
 type($R1, required-type)?
 

What's really needed for the optimization to kick in is two things:

  • In the role-player($A, $B) predicate $A must be unbound and $B must be bound
  • In the type($C, $D) predicate the $C must match $A, and $D must be bound when the role-player() runs, and not by the type() predicate