Package edu.fiu.jtlex.data
Interface IGraph
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
Graph
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 ClassesModifier and TypeInterfaceDescriptionstatic classDetermines whether the graph is the main graph, or a subordination graph. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddLink(int NodeOneID, int NodeTwoID, ILink.LinkTag linktag, ILinkType linkType, String syntax, ISignal signal, ILink.Origintype orig)Adds aLinkinto the graph, givenNodeidentification numbers.booleanAdds aLinkinto the graph.booleanaddLink(INode one, INode two, ILink.LinkTag linktag, ILinkType linkType, String syntax, ISignal signal, ILink.Origintype orig)Adds aLinkinto the graph, givenNodeobjects.booleanAdds a node to the graph.booleancontainsLink(ILink link)Return true if the given link exists in the graph.booleanReturns the set of consistent subordinate subgraphs.Returns the type of graph.Returns the set of inconsistent subordinate subgraphs.Returns a list of Indeterminant Time Pairs.getLinks()Returns a set with all the Links in the TimeML graph, (null) if the TimeML graph is empty.intReturns the number of links.Returns the count of each type of links, formatted as a string.getNodeByID(int NodeID)Returns a INode reference if a node with ID NodeID exists in the graph returns null otherwise.getNodes()Returns a set with all the Nodes in the TimeML graph, (null) if the TimeML graph is empty.intReturns the number of nodes.Returns the set of subordination links.Returns the set of subordinate subgraphs.Return the string representations of timeline solututions viaGraphTCSP.stringTimeLine().Returns the computed timeline.booleanReturns true if the graph is consistent.removeLink(ILink link)Removes the given link from the graph.removeNode(INode node)Removes a node object from the graph.removeNodeByID(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.SubbordinationGraphvoidsetIndeterminantTimePairs(ArrayList<String> list)Sets the Indeterminant Time Pairs for the current Graph.voidsetTimeline(Timeline newTimeline)Sets the Timeline of the current Graph.toJSON()Returns the JSON (RFC 8259) representation of 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, 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- TODO: (document) explain the necessity of both ILinkType and linktag as parameters in this method.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, 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- TODO: (document) explain the necessity of both ILinkType and linktag as parameters in this method.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.
-
setConsistency
void setConsistency(boolean consistency)Sets the consistency of the graph.- Parameters:
consistency- the consistency of the graph.
-
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
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
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
Returns the set of subordinate subgraphs.- Returns:
- the set of subordinate subgraphs.
- See Also:
Partitioner.partitionGraph(IGraph)
-
getConsistentPartitions
Returns the set of consistent subordinate subgraphs.- Returns:
- the set of consistent subordinate subgraphs.
- See Also:
InconsistencyDetector
-
getInconsistentPartitions
Returns the set of inconsistent subordinate subgraphs.- Returns:
- the set of inconsistent subordinate subgraphs.
- See Also:
InconsistencyDetector
-
getSolutionList
Return the string representations of timeline solututions viaGraphTCSP.stringTimeLine().- Returns:
- the string representations of timeline solututions
via
GraphTCSP.stringTimeLine().
-
getPartitionlinks
Returns the set of subordination links.- Returns:
- the set of subordination links.
-
getTimeline
Timeline getTimeline()Returns the computed timeline.- Returns:
- the computed timeline.
- See Also:
GraphTCSP
-
getIndeterminantTimePairs
Returns a list of Indeterminant Time Pairs.- Returns:
- a list of Indeterminant Time Pairs.
-
setTimeline
Sets the Timeline of the current Graph.- Parameters:
newTimeline- the new Timeline.
-
setIndeterminantTimePairs
Sets the Indeterminant Time Pairs for the current Graph.- Parameters:
list- the list of Indeterminant Time Pairs.- See Also:
IndeterminacyDetector.detect(IGraph),IndeterminacyDetector.indeterminantTimePairs()
-
isConsistent
boolean isConsistent()Returns true if the graph is consistent.- Returns:
- true if the graph is consistent.
-
setGraphType
Sets the type of graph toIGraph.GraphType.MainGraphorIGraph.GraphType.SubbordinationGraph- Parameters:
graphtype- the type of graph.- See Also:
IGraph.GraphType
-
equals
-
toJSON
String toJSON()Returns the JSON (RFC 8259) representation of the Graph.- Returns:
- the JSON (RFC 8259) representation of the Graph.
-