Interface QueryUnifier

All Known Implementing Classes:
QueryUnifierImpl

public interface QueryUnifier
A unifier of a query Q with a rule R is a triple u(Q', H', P) where Q' is a subset of Q H' is a subset of head(R) P is a partition of the terms of Q' and H'
It describes how to unify a piece of a query with a part of a head FORule in order to rewrite the fact according to the FORule
Author:
Guillaume Pérution-Kihli, Florent Tornil
  • Method Details

    • getQuery

      FOQuery<?> getQuery()
      Not used yet
      Returns:
      the query unified by this unifier
    • getRule

      FORule getRule()
      Not used yet
      Returns:
      the FORule where the unifier applies
    • getUnifiedQueryPart

      FOFormula getUnifiedQueryPart()
      Returns the part of the query unified by this unifier.
      Returns:
      the part of the query that is unified by this unifier
    • getPartition

      TermPartition getPartition()
      Returns the term partition that realizes the unification.
      Returns:
      the partition that unify the piece and a part of the head FORule
    • getInitialFORules

      Set<FORule> getInitialFORules()
      Not used yet
      Returns:
      the initial FORules (before aggregation) where the unifier apply
    • getImageOf

      FOFormula getImageOf(FOFormula f)
      Returns the image of a formula under this unifier substitution.
      Parameters:
      f - a fact
      Returns:
      the image of a given fact by the substitution associated to this unifier
    • getAssociatedSubstitution

      Substitution getAssociatedSubstitution()
      Returns the substitution associated to this unifier.
      Returns:
      the substitution associated to this unifier
    • safeAggregate

      Optional<QueryUnifier> safeAggregate(QueryUnifier u)
      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
      Parameters:
      u - unifier to aggregate
      Returns:
      the aggregation of the given unifier and the receiving unifier
    • aggregate

      QueryUnifier aggregate(QueryUnifier u)
      Creates a new unifier corresponding to the aggregation of this unifier and the given one
      Parameters:
      u - unifier to aggregate
      Returns:
      the aggregation of the given unifier and the receiving unifier
    • isCompatible

      boolean isCompatible(QueryUnifier u)
      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
      Parameters:
      u - unifier to check compatibility with
      Returns:
      true iff this unifier is compatible with the given unifier
    • apply

      default FOQuery<?> apply(FOQuery<?> query)
      Rewrite the query with the unifier
      Parameters:
      query - to rewrite
      Returns:
      the given query rewritten by the given unifier