Interface IGraph

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
Graph

public interface IGraph
extends java.lang.Cloneable
Represents a TimeML Graph.

A TimeML temporal graph is a graph T = (V,E) where: V is a set of temporal events and time expressions. E is a set of TimeML links: a tuple (u,v,w) where u, v belong to V and w is a link type. There are 25 link types, refer to TLinkType, ALinkType, and SLinkType.

A graph is represented with two Hash Tables, one for Nodes and one for Links.

Author:
Luis Robaina
  • Method Details

    • addLink

      boolean addLink​(ILink link)
      Adds a Link into the graph.
      Parameters:
      link - the Link to add.
      Returns:
      True on successful addition, False if node already exists.
    • addLink

      boolean addLink​(INode one, INode two, ILink.LinkTag linktag, ILinkType linkType, java.lang.String syntax, ISignal signal, ILink.Origintype orig)
      Adds a Link into the graph, given Node objects.
      Parameters:
      one - The first Node. This is referred to as the Event Instance.
      two - The second Node. This is referred to as the Related to Event.
      linktag - The type of link (TLink, ALink, SLink)
      linkType - The type of link (TLink, ALink, SLink)
      syntax - the syntactic pattern that was used in generating the link
      signal - ID of the signal, if the temporal relation is explicitly signaled in the text.
      orig - whether a TLink was generated manually or by closure.
      Returns:
      True on successful insertion, False if link already exists.
    • addLink

      boolean addLink​(int NodeOneID, int NodeTwoID, ILink.LinkTag linktag, ILinkType linkType, java.lang.String syntax, ISignal signal, ILink.Origintype orig)
      Adds a Link into the graph, given Node identification numbers.
      Parameters:
      NodeOneID - The first Node ID. This is referred to as the Event Instance.
      NodeTwoID - The second Node ID. This is referred to as the Related to Event.
      linktag - The type of link (TLink, ALink, SLink)
      linkType - The type of link (TLink, ALink, SLink)
      syntax - the syntactic pattern that was used in generating the link
      signal - ID of the signal, if the temporal relation is explicitly signaled in the text.
      orig - whether a TLink was generated manually or by closure.
      Returns:
      True on successful insertion, False if link already exists.
    • containsLink

      boolean containsLink​(ILink link)
      Return true if the given link exists in the graph.
      Parameters:
      link - the link to find.
      Returns:
      true if the given link exists in the graph.
    • removeLink

      ILink removeLink​(ILink link)
      Removes the given link from the graph.
      Parameters:
      link - the link to remove.
      Returns:
      the link that was removed, Null if link was not found.
    • addNode

      boolean addNode​(INode node)
      Adds a node to the graph.
      Parameters:
      node - the node to add.
      Returns:
      True on successful addition, False if node already exists.
    • removeNode

      INode removeNode​(INode node)
      Removes a node object from the graph.
      Parameters:
      node - the node object to remove.
      Returns:
      the node that was removed, Null if node was not found.
    • removeNodeByID

      INode removeNodeByID​(int ID)
      Removes a node from the graph, by node identification number.
      Parameters:
      ID - the identification number of the node to be removed.
      Returns:
      the node that was removed, Null if node was not found.
    • getLinks

      java.util.Set<ILink> getLinks()
      Returns a set with all the Links in the TimeML graph, (null) if the TimeML graph is empty.
      Returns:
      a set with all the Links in the TimeML graph, (null) if the TimeML graph is empty.
    • getNodeByID

      INode getNodeByID​(int NodeID)
      Returns a INode reference if a node with ID NodeID exists in the graph returns null otherwise.
      Parameters:
      NodeID - : An Integer ID for a given node.
      Returns:
      A INode reference if a node with ID NodeID exists in the graph returns null otherwise.
    • getNodes

      java.util.Set<INode> getNodes()
      Returns a set with all the Nodes in the TimeML graph, (null) if the TimeML graph is empty.
      Returns:
      a set with all the Nodes in the TimeML graph, (null) if the TimeML graph is empty.
    • getLinksCount

      int getLinksCount()
      Returns the number of links.
      Returns:
      the number of links.
    • getNodesCount

      int getNodesCount()
      Returns the number of nodes.
      Returns:
      the number of nodes.
    • getLinkTypesCount

      java.util.HashMap<java.lang.String,​java.lang.Integer> getLinkTypesCount()
      Returns the count of each type of links, formatted as a string.
      Returns:
      the count of each type of links, formatted as a string.
    • getGraphType

      IGraph.GraphType getGraphType()
      Returns the type of graph.
      Returns:
      the type of graph.
      See Also:
      IGraph.GraphType
    • getPartitions

      java.util.ArrayList<IGraph> getPartitions()
      Returns the set of subordinate subgraphs.
      Returns:
      the set of subordinate subgraphs.
      See Also:
      Partitioner.partitionGraph(IGraph)
    • getConsistentPartitions

      java.util.ArrayList<IGraph> getConsistentPartitions()
      Returns the set of consistent subordinate subgraphs.
      Returns:
      the set of consistent subordinate subgraphs.
      See Also:
      InconsistencyDetector
    • getInconsistentPartitions

      java.util.ArrayList<IGraph> getInconsistentPartitions()
      Returns the set of inconsistent subordinate subgraphs.
      Returns:
      the set of inconsistent subordinate subgraphs.
      See Also:
      InconsistencyDetector
    • getSolutionList

      java.util.ArrayList<java.util.List<java.lang.String>> getSolutionList()
      Return the string representations of timeline solututions via GraphTCSP.stringTimeLine().
      Returns:
      the string representations of timeline solututions via GraphTCSP.stringTimeLine().
    • getPartitionlinks

      java.util.Set<ILink> getPartitionlinks()
      Returns the set of subordination links.
      Returns:
      the set of subordination links.
    • setTimeline

      void setTimeline​(Timeline newTimeline)
      Sets the Timeline of the current Graph.
      Parameters:
      newTimeline - the new Timeline.
    • getTimeline

      Timeline getTimeline()
      Returns the computed timeline.
      Returns:
      the computed timeline.
      See Also:
      GraphTCSP
    • getTimelineLength

      int getTimelineLength()
      Returns the length of the main timeline.
      Returns:
      the length of the main timeline, -1 if graph is inconsistent.
    • getIndeterminantTimePairs

      java.util.ArrayList<java.lang.String> getIndeterminantTimePairs()
      Returns a list of Indeterminant Time Pairs.
      Returns:
      a list of Indeterminant Time Pairs.
    • getIndeterminacyScore

      java.lang.Double getIndeterminacyScore()
      Returns a percent value representing the indeterminacy score.
      Returns:
      a percent value representing the indeterminacy score.
    • setIndeterminancyScore

      void setIndeterminancyScore​(double indeterminacyScore)
      Sets the percent value representing the indeterminacy score.
      Parameters:
      indeterminacyScore - the percent value representing the indeterminacy score.
    • isConsistent

      boolean isConsistent()
      Returns true if the graph is consistent.
      Returns:
      true if the graph is consistent.
    • setConsistency

      void setConsistency​(boolean consistency)
      Sets the consistency of the graph.
      Parameters:
      consistency - the consistency of the graph.
    • getConsistency

      boolean getConsistency()
      Returns true if the graph is consistent.
      Returns:
      true if the graph is consistent.
    • setIndeterminantTimePairs

      void setIndeterminantTimePairs​(java.util.ArrayList<java.lang.String> list)
      Sets the Indeterminant Time Pairs for the current Graph.
      Parameters:
      list - the list of Indeterminant Time Pairs.
      See Also:
      IndeterminacyDetector.detect(), IndeterminacyDetector.indeterminantTimePairs()
    • setGraphType

      void setGraphType​(IGraph.GraphType graphtype)
      Parameters:
      graphtype - the type of graph.
      See Also:
      IGraph.GraphType
    • getInconsistentSubgraphs

      java.util.Set<IGraph> getInconsistentSubgraphs()
      Returns the set of inconsistent subgraphs.
      Returns:
      the set of inconsistent subgraphs.
    • equals

      boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • clone

      IGraph clone()
      Returns a deep-copy of the current Graph object. Only contains the nodes and links.
      Returns:
      a deep-copy of the current Graph object.
    • getText

      java.lang.String getText()
      Returns the article text without TimeML tags.
      Returns:
      the article text without TimeML tags.
    • toJSON

      java.lang.String toJSON()
      Returns the JSON (RFC 8259) representation of the Graph.
      Returns:
      the JSON (RFC 8259) representation of the Graph.
    • hasSelfLoops

      java.lang.Boolean hasSelfLoops()
      Returns whether the graph has self loops or not.
      Returns:
      true if graph contains self loops.
    • totalSelfLoops

      int totalSelfLoops()
      Returns the number of self loops in the graph.
      Returns:
      the number of self loops in the graph.