Class Rules

java.lang.Object
fr.lirmm.graphik.integraal.core.Rules

public final class Rules extends Object
A set of tests and utilities for manipulating rules.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Method Details

    • hasAtomicBody

      public static boolean hasAtomicBody(Rule rule)
      Test if the body of the rule is atomic.
      Parameters:
      rule - the rule to inspect
      Returns:
      true if and only if the body of the specified rule contains only one atom.
    • hasAtomicHead

      public static boolean hasAtomicHead(Rule rule)
      Test if the head of the rule is atomic.
      Parameters:
      rule - the rule to inspect
      Returns:
      true if and only if the head of the specified rule contains only one atom.
    • isThereOneAtomThatContainsAllVars

      public static boolean isThereOneAtomThatContainsAllVars(CloseableIterableWithoutException<Atom> atomset, Collection<Variable> terms)
      Checks whether one atom in the given atom set contains all specified variables.
      Parameters:
      atomset - the atom set to inspect
      terms - the variables that must all occur in a single atom
      Returns:
      true if one atom contains all specified variables
    • getPieces

      public static Collection<InMemoryAtomSet> getPieces(Rule rule)
      Compute and return the set of pieces of the head according to the frontier. On Rules with Existential Variables: Walking the Decidability Line Jean-François Baget, Michel Leclère, Marie-Laure Mugnier, Eric Salvat
      Parameters:
      rule - the rule whose head must be split into pieces
      Returns:
      a Collection ofInMemoryAtomSet representing the set of pieces of the head of the specified rule.
    • computeSinglePiece

      public static fr.lirmm.graphik.integraal.core.Rules.SinglePieceRulesIterator computeSinglePiece(Iterator<Rule> rules)
      Generate an iterator of mono-piece rules from an iterator of rules.
      Parameters:
      rules - a set of rules
      Returns:
      The equivalent set of mono-piece rules.
    • computeAtomicHead

      public static Iterator<Rule> computeAtomicHead(Iterator<Rule> rules)
      Generate an iterator of atomic head rules from an iterator of rules.
      Parameters:
      rules - a set of rules
      Returns:
      The equivalent set of atomic head rules.
    • computeSinglePiece

      public static Collection<Rule> computeSinglePiece(Rule rule)
      Generate a set of mono-piece rules equivalent of the specified rule.
      Parameters:
      rule - the rule to decompose
      Returns:
      a Collection of Rule which is a decomposition of the specified rule to single piece rules.
    • computeAtomicHead

      public static Collection<Rule> computeAtomicHead(Rule rule)
      Generate a set of atomic head rules equivalent of the specified rule.
      Parameters:
      rule - the rule to decompose
      Returns:
      a Collection of Rule which is a decomposition of the specified rule to atomic head rules.
    • isConcept

      public static boolean isConcept(Atom a)
      Checks whether the given atom is unary.
      Parameters:
      a - the atom to inspect
      Returns:
      true if the atom is a concept atom
    • isRole

      public static boolean isRole(Atom a)
      Checks whether the given atom is binary.
      Parameters:
      a - the atom to inspect
      Returns:
      true if the atom is a role atom
    • isInclusion

      public static boolean isInclusion(Rule r)
      Checks whether the rule is an inclusion rule.
      Parameters:
      r - the rule to inspect
      Returns:
      true if both body and head are atomic
    • isConceptInclusion

      public static boolean isConceptInclusion(Rule r)
      Checks whether the rule is a concept inclusion.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a concept inclusion
    • isRoleInclusion

      public static boolean isRoleInclusion(Rule r)
      Checks whether the rule is a role inclusion.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a role inclusion
    • isInverseRole

      public static boolean isInverseRole(Rule r)
      Checks whether the rule expresses an inverse role inclusion.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the head role is the inverse of the body role
    • isSignature

      public static boolean isSignature(Rule r)
      Checks whether the rule maps a role to a concept.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a signature rule
    • isDomain

      public static boolean isDomain(Rule r)
      Checks whether the rule expresses a domain constraint.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the head concept is attached to the first role argument
    • isRange

      public static boolean isRange(Rule r)
      Checks whether the rule expresses a range constraint.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the head concept is attached to the second role argument
    • isMandatoryRole

      public static boolean isMandatoryRole(Rule r)
      Checks whether the rule introduces a mandatory outgoing role.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a mandatory role rule
    • isInvMandatoryRole

      public static boolean isInvMandatoryRole(Rule r)
      Checks whether the rule introduces a mandatory incoming role.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is an inverse mandatory role rule
    • isExistRC

      public static boolean isExistRC(Rule r)
      Checks whether the rule matches an existential role-concept pattern.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is of the form C(x) -> R(x,y), D(y)
    • isInvExistRC

      public static boolean isInvExistRC(Rule r)
      Checks whether the rule matches an inverse existential role-concept pattern.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is of the form C(x) -> R(y,x), D(y)
    • isRoleComposition

      public static boolean isRoleComposition(Rule r)
      Checks whether the rule expresses a composition of two roles.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule body composes into the head role
    • isTransitivity

      public static boolean isTransitivity(Rule r)
      Checks whether the rule expresses transitivity of one role.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a transitivity rule
    • isFunctional

      public static boolean isFunctional(Rule r)
      Checks whether the rule encodes functionality.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule head is the equality predicate
    • isNegativeConstraint

      public static boolean isNegativeConstraint(Rule r)
      Checks whether the rule is a negative constraint.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule head is bottom
    • isDisjointConcept

      public static boolean isDisjointConcept(Rule r)
      Checks whether the rule states the disjointness of two concepts.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a disjoint concept rule
    • isDisjointRole

      public static boolean isDisjointRole(Rule r)
      Checks whether the rule states the disjointness of two roles.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the rule is a disjoint role rule
    • isDisjointInverseRole

      public static boolean isDisjointInverseRole(Rule r)
      Checks whether the rule states the disjointness of a role and its inverse.
      Parameters:
      r - the rule to inspect
      Returns:
      true if the disjointness is expressed on inverse roles
    • criticalInstance

      public static InMemoryAtomSet criticalInstance(Iterable<Rule> rules)
      Builds the critical instance associated with the given rules.
      Parameters:
      rules - the rules used to derive predicates and constants
      Returns:
      the generated critical instance
    • criticalInstance

      public static void criticalInstance(Iterable<Rule> rules, InMemoryAtomSet A)
      The skolem chase on the critical instance of R halts iff the skolem chase of R halts universally. The critical instance for a set of rules R contains all facts that can be constructed using all predicates occuring in R, all constants occurring in the body of a rule in R, and one special fresh constant.
      Parameters:
      rules - the rules used to derive predicates and constants
      A - the target atom set receiving the critical instance facts