Class QueryUnifierImpl

java.lang.Object
fr.inria.rules.integraal.unifier.QueryUnifierImpl
All Implemented Interfaces:
QueryUnifier

public class QueryUnifierImpl extends Object implements QueryUnifier
Basic implementation for the query unifier
  • Constructor Details

    • QueryUnifierImpl

      public QueryUnifierImpl(FOQuery<?> query, FOFormula unifiedQueryPart, TermPartition partition, FORule rule)
      Creates a new QueryUnifier using the given parameters
      Parameters:
      query - the query that is unified
      unifiedQueryPart - the part of the query that is unified
      partition - the partition of the terms of the rule and the query
      rule - the rule that is unified
    • QueryUnifierImpl

      public QueryUnifierImpl(FOQuery<?> query, FOFormula unifiedQueryPart, TermPartition partition, FORule rule, Set<FORule> initialFORules)
      Creates a new QueryUnifier using the given parameters
      Parameters:
      query - the query that is unified
      unifiedQueryPart - the part of the query that is unified
      partition - the partition of the terms of the rule and the query
      rule - the rule that is unified
      initialFORules - the initial rules that created the rule
  • Method Details

    • getRule

      public FORule getRule()
      Description copied from interface: QueryUnifier
      Not used yet
      Specified by:
      getRule in interface QueryUnifier
      Returns:
      the FORule where the unifier applies
    • getUnifiedQueryPart

      public FOFormula getUnifiedQueryPart()
      Description copied from interface: QueryUnifier
      Returns the part of the query unified by this unifier.
      Specified by:
      getUnifiedQueryPart in interface QueryUnifier
      Returns:
      the part of the query that is unified by this unifier
    • getQuery

      public FOQuery<?> getQuery()
      Description copied from interface: QueryUnifier
      Not used yet
      Specified by:
      getQuery in interface QueryUnifier
      Returns:
      the query unified by this unifier
    • getPartition

      public TermPartition getPartition()
      Description copied from interface: QueryUnifier
      Returns the term partition that realizes the unification.
      Specified by:
      getPartition in interface QueryUnifier
      Returns:
      the partition that unify the piece and a part of the head FORule
    • getInitialFORules

      public Set<FORule> getInitialFORules()
      Description copied from interface: QueryUnifier
      Not used yet
      Specified by:
      getInitialFORules in interface QueryUnifier
      Returns:
      the initial FORules (before aggregation) where the unifier apply
    • getAssociatedSubstitution

      public Substitution getAssociatedSubstitution()
      Description copied from interface: QueryUnifier
      Returns the substitution associated to this unifier.
      Specified by:
      getAssociatedSubstitution in interface QueryUnifier
      Returns:
      the substitution associated to this unifier
    • getImageOf

      public FOFormula getImageOf(FOFormula f)
      Description copied from interface: QueryUnifier
      Returns the image of a formula under this unifier substitution.
      Specified by:
      getImageOf in interface QueryUnifier
      Parameters:
      f - a fact
      Returns:
      the image of a given fact by the substitution associated to this unifier
    • safeAggregate

      public Optional<QueryUnifier> safeAggregate(QueryUnifier u)
      Description copied from interface: QueryUnifier
      Creates a new unifier corresponding to the aggregation of this unifier and the given one Also assure that the unifiers are on a different set of variables, renaming the given one if necessary Return the aggregated unifier if possible or an empty optional if the unifiers are not compatible
      Specified by:
      safeAggregate in interface QueryUnifier
      Parameters:
      u - unifier to aggregate
      Returns:
      the aggregation of the given unifier and the receiving unifier
    • aggregate

      public QueryUnifier aggregate(QueryUnifier other)
      Description copied from interface: QueryUnifier
      Creates a new unifier corresponding to the aggregation of this unifier and the given one
      Specified by:
      aggregate in interface QueryUnifier
      Parameters:
      other - unifier to aggregate
      Returns:
      the aggregation of the given unifier and the receiving unifier
    • isCompatible

      public boolean isCompatible(QueryUnifier other)
      Description copied from interface: QueryUnifier
      If the pieces of the two unifiers have atom in common the unifiers are not compatible Otherwise check if the two partition of the unifiers are possible to join
      Specified by:
      isCompatible in interface QueryUnifier
      Parameters:
      other - unifier to check compatibility with
      Returns:
      true iff this unifier is compatible with the given unifier
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object