Class InconsistencyDetector

java.lang.Object
edu.fiu.jtlex.algorithms.InconsistencyDetector
All Implemented Interfaces:
IInconsistencyDetector

public class InconsistencyDetector extends Object implements IInconsistencyDetector
Default implementation for inconsistency detection
Since:
jTLEX 1.0
  • Constructor Details

    • InconsistencyDetector

      public InconsistencyDetector()
      Creates a new indeterminacy detector with GraphTCSPSolver as default implementation.
      Since:
      jTLEX 1.0
    • InconsistencyDetector

      public InconsistencyDetector(IGraphTCSPSolver tcspSolver)
      Creates a new inconsistency detector with the given IGraphTCSPSolver implementation.
      Parameters:
      tcspSolver - An {}solver implementation
      Throws:
      NullPointerException - If the TCSP solver is null
      Since:
      jTLEX 1.0
  • Method Details

    • isConsistent

      public boolean isConsistent(ITimeMLGraph timeMLGraph)
      A method to determine a graph's consistency. This is done by creating a TCSP for the graph (TimeMLGraphTCSP) presented by the graphs links and nodes trying to solve it. Note that to produce a TimeMLGraphTCSP the given graph cannot contain any S-Link. Consider partitioning the graph before checking for consistency. If there is a solution to the TCSP then the graph is consistent, otherwise it is inconsistent.
      Specified by:
      isConsistent in interface IInconsistencyDetector
      Parameters:
      timeMLGraph - A timeML graph without S-Link.
      Returns:
      true if the graph is consistent, else false
      Throws:
      NullPointerException - If the graph is null
      IllegalStateException - If the timeMLGraph contains any S-Link
      Since:
      jTLEX 1.0
      See Also:
    • generateSelfLoopingSubGraphs

      public Set<ITimeMLGraph> generateSelfLoopingSubGraphs(Set<ITimeMLLink> links, Set<ITimeMLNode> nodes)
      Given a set of links, identifies which are inconsistent self references, and produces a subgraph for each instance.
      Specified by:
      generateSelfLoopingSubGraphs in interface IInconsistencyDetector
      Parameters:
      links - A set of links.
      nodes - A set of nodes.
      Returns:
      A set of IGraphs, each containing inconsistent self looping nodes.
      Throws:
      NullPointerException - If links is null.
      Since:
      jTLEX 1.0
    • generateInconsistentSubgraphs

      public Set<ITimeMLGraph> generateInconsistentSubgraphs(ITimeMLGraph timeMLGraph)
      Given a TimeML graph generates a set of subgraphs that contain all the links and nodes involved in the inconsistencies. This is done in a four steps process:
      1. Find the self looping links, generate a subgraph for each of them, and add it to the output set. For more details see: generateSelfLoopingSubGraphs(Set, Set)
      2. Separate links into two partitions: consistent and inconsistent ones. This is done by adding each non self looping link to an empty graph and testing its consistency. If the added link makes the graph inconsistent, it is added to the inconsistent partition, else to the consistent one.
      3. For each link in the inconsistent partition, complete its cycle by adding it along with links from the consistent partition to an empty graph until the graph becomes inconsistent. Once the cycle is produced, add it to the output set. For more details see: completeInconsistentCycle(ITimeMLGraph, List, ITimeMLGraph)
      4. Since some cycles can have shared edges, step 3 is repeated for each link in the inconsistent cycle that is not the initial inconsistent link.
      Specified by:
      generateInconsistentSubgraphs in interface IInconsistencyDetector
      Parameters:
      timeMLGraph - TimeML graph to evaluate.
      Returns:
      A set containing the inconsistent subgraphs.
      Throws:
      NullPointerException - If the graph is null
      Since:
      jTLEX 1.0