Package edu.fiu.jtlex.data
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
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIGraph.GraphTypeDetermines whether the graph is the main graph, or a subordination graph. -
Method Summary
Modifier and Type Method Description booleanaddLink(int NodeOneID, int NodeTwoID, ILink.LinkTag linktag, ILinkType linkType, java.lang.String syntax, ISignal signal, ILink.Origintype orig)Adds aLinkinto the graph, givenNodeidentification numbers.booleanaddLink(ILink link)Adds aLinkinto the graph.booleanaddLink(INode one, INode two, ILink.LinkTag linktag, ILinkType linkType, java.lang.String syntax, ISignal signal, ILink.Origintype orig)Adds aLinkinto the graph, givenNodeobjects.booleanaddNode(INode node)Adds a node to the graph.IGraphclone()Returns a deep-copy of the current Graph object.booleancontainsLink(ILink link)Return true if the given link exists in the graph.booleanequals(java.lang.Object o)booleangetConsistency()Returns true if the graph is consistent.java.util.ArrayList<IGraph>getConsistentPartitions()Returns the set of consistent subordinate subgraphs.IGraph.GraphTypegetGraphType()Returns the type of graph.java.util.ArrayList<IGraph>getInconsistentPartitions()Returns the set of inconsistent subordinate subgraphs.java.util.Set<IGraph>getInconsistentSubgraphs()Returns the set of inconsistent subgraphs.java.lang.DoublegetIndeterminacyScore()Returns a percent value representing the indeterminacy score.java.util.ArrayList<java.lang.String>getIndeterminantTimePairs()Returns a list of Indeterminant Time Pairs.java.util.Set<ILink>getLinks()Returns a set with all the Links in the TimeML graph, (null) if the TimeML graph is empty.intgetLinksCount()Returns the number of links.java.util.HashMap<java.lang.String,java.lang.Integer>getLinkTypesCount()Returns the count of each type of links, formatted as a string.INodegetNodeByID(int NodeID)Returns a INode reference if a node with ID NodeID exists in the graph returns null otherwise.java.util.Set<INode>getNodes()Returns a set with all the Nodes in the TimeML graph, (null) if the TimeML graph is empty.intgetNodesCount()Returns the number of nodes.java.util.Set<ILink>getPartitionlinks()Returns the set of subordination links.java.util.ArrayList<IGraph>getPartitions()Returns the set of subordinate subgraphs.java.util.ArrayList<java.util.List<java.lang.String>>getSolutionList()Return the string representations of timeline solututions viaGraphTCSP.stringTimeLine().java.lang.StringgetText()Returns the article text without TimeML tags.TimelinegetTimeline()Returns the computed timeline.intgetTimelineLength()Returns the length of the main timeline.java.lang.BooleanhasSelfLoops()Returns whether the graph has self loops or not.booleanisConsistent()Returns true if the graph is consistent.ILinkremoveLink(ILink link)Removes the given link from the graph.INoderemoveNode(INode node)Removes a node object from the graph.INoderemoveNodeByID(int ID)Removes a node from the graph, by node identification number.voidsetConsistency(boolean consistency)Sets the consistency of the graph.voidsetGraphType(IGraph.GraphType graphtype)Sets the type of graph toIGraph.GraphType.MainGraphorIGraph.GraphType.SubbordinationGraphvoidsetIndeterminancyScore(double indeterminacyScore)Sets the percent value representing the indeterminacy score.voidsetIndeterminantTimePairs(java.util.ArrayList<java.lang.String> list)Sets the Indeterminant Time Pairs for the current Graph.voidsetTimeline(Timeline newTimeline)Sets the Timeline of the current Graph.java.lang.StringtoJSON()Returns the JSON (RFC 8259) representation of the Graph.inttotalSelfLoops()Returns the number of self loops in the graph.
-
Method Details
-
addLink
Adds aLinkinto the graph.- Parameters:
link- theLinkto 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 aLinkinto the graph, givenNodeobjects.- Parameters:
one- The firstNode. This is referred to as theEvent Instance.two- The secondNode. This is referred to as theRelated 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 linksignal- 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 aLinkinto the graph, givenNodeidentification numbers.- Parameters:
NodeOneID- The firstNodeID. This is referred to as theEvent Instance.NodeTwoID- The secondNodeID. This is referred to as theRelated 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 linksignal- 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
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
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
Adds a node to the graph.- Parameters:
node- the node to add.- Returns:
- True on successful addition, False if node already exists.
-
removeNode
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
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
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 viaGraphTCSP.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
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
Sets the type of graph toIGraph.GraphType.MainGraphorIGraph.GraphType.SubbordinationGraph- 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:
equalsin classjava.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.
-