Class Link

java.lang.Object
edu.fiu.jtlex.data.Link
All Implemented Interfaces:
ILink

public class Link extends Object implements ILink
Default implementation of ILink.
Since:
Revision 42
Author:
Pablo Maldonado
  • Constructor Details

    • Link

      public Link(ILink.LinkTag linktag, int linkID, String syntax, INode eventInstance, ISignal signal, INode relatedToNode, ILinkType relType, ILink.Origintype orig)
      This is the constructor for Tlink.
      Parameters:
      linktag - linkTag is the type of Link: TLINK
      linkID - Link ID gives each TimeML link an identification number
      syntax - syntax holds any syntactic pattern that was used in generating the link
      eventInstance - Obligatory attribute (one or the other of these needs to be present). This is the ID of the eventInstance or the timeID involved in the temporal link.
      signal - Optional attribute. If the temporal relation holding between the entities is explicitly signaled in the text, then the ID of that signal needs to be supplied here.
      relatedToNode - Obligatory attribute (one or the other of these needs to be present). This is the ID of the entity that is being related to the event instance with ID=eventInstanceID or time expression with ID=timeID.
      relType - Obligatory attribute. This is the temporal relation holding between the entities.
      orig - Optional attribute. This attribute shows whether a TLINK was generated manually or by closure.
      Throws:
      NullPointerException - if TLinkRelType argument is null
      IllegalArgumentException - throw error if linktag != LinkTag.TLINK
    • Link

      public Link(ILink.LinkTag linktag, int linkID, String syntax, INode eventInstance, ISignal signal, INode relatedToNode, ILinkType relType)
      This is the constructor for Alink and SLink
      Parameters:
      linktag - linkTag is the type of Link: SLINK or ALINK
      linkID - Link ID gives each TimeML link an identification number
      syntax - syntax holds any syntactic pattern that was used in generating the link
      eventInstance - Obligatory attribute. This is the ID of the (aspectual) eventInstance involved in the aspectual link.
      signal - Optional attribute. If the aspectual relation holding between the events is explicitly signaled in the text, then the ID of that signal needs to be filled in here
      relatedToNode - Obligatory attribute. This is the ID of the event instance related to the aspectual event.
      relType - Obligatory attribute. This is the temporal relation holding between the entities for Alink
      Throws:
      NullPointerException - if ALinkRelType argument is null
      IllegalArgumentException - throw error if linktag == LinkTag.TLINK
  • Method Details

    • getLinkID

      public int getLinkID()
      Returns the ID of the link.
      Link ID gives each TimeML link an identification number Can be null.
      Specified by:
      getLinkID in interface ILink
      Returns:
      the ID of the link.
      Since:
      Revision 42
    • getLinkTag

      public ILink.LinkTag getLinkTag()
      Returns the type of Link. Will never return null due to constructor.
      Specified by:
      getLinkTag in interface ILink
      Returns:
      ILink.LinkTag.TLINK / ILink.LinkTag.ALINK / ILink.LinkTag.SLINK
      Since:
      Revision 42
    • getSyntax

      public String getSyntax()
      Returns the syntax of the link.
      Syntax holds any syntactic pattern that was used in generating the link (e.g. from an automatic annotation tool).
      Can be null.
      Specified by:
      getSyntax in interface ILink
      Returns:
      the syntax of the link.
      Since:
      Revision 42
    • getEventInstance

      public INode getEventInstance()
      Returns the ID of the event instance involved in the link. OBLIGATORY, cannot be null
      Specified by:
      getEventInstance in interface ILink
      Returns:
      the ID of the event instance involved in the link.
      Since:
      Revision 42
    • getSignal

      public ISignal getSignal()
      Returns the ID of the relation signal.
      If the temporal relation holding between the entities is explicitly signaled in the text, then the ID of that signal needs to be supplied here.
      Can be null.
      Specified by:
      getSignal in interface ILink
      Returns:
      the optional ID of the relation signal.
      Since:
      Revision 42
    • getOrigin

      public ILink.Origintype getOrigin()
      Returns whether a TLINK was generated MANUALLY or by CLOSURE.
      THIS IS ONLY FOR TLINK Can be null.
      Specified by:
      getOrigin in interface ILink
      Returns:
      Whether link was generated MANUALLY or by CLOSURE
      Since:
      Revision 42
    • getRelatedToNode

      public INode getRelatedToNode()
      Returns the ID of the entity that is being related to the event instance with ID=eventInstanceID or time expression with ID=timeID.
      relatedToEventInstance or relatedToTime needs to be present. Cannot be null due to constructor.
      Specified by:
      getRelatedToNode in interface ILink
      Returns:
      the ID of the entity that is being related to the event instance with ID=eventInstanceID or time expression with ID=timeID.
      Since:
      Revision 394
    • getRelType

      public ILinkType getRelType()
      This is the temporal relation holding between the entities.
      These are represented by 3 different enums:
      • ALinkRelType
      • SLinkRelType
      • TLinkRelType

      The returned type depends on the linkTag. Cannot be null due to constructor.
      Specified by:
      getRelType in interface ILink
      Returns:
      ALinkRelType / SLinkRelType / TLinkRelType
      Since:
      Revision 42
      See Also:
    • hashCode

      public int hashCode()
      Gets the links hash code Cannot return null due to grabbing from variables required in constructor.
      Specified by:
      hashCode in interface ILink
      Overrides:
      hashCode in class Object
      Returns:
      hashcode
      Since:
      Revision 141
    • toString

      public String toString()
      Converts the Link to a String Cannot be null due to requiring items from constructor.
      Specified by:
      toString in interface ILink
      Overrides:
      toString in class Object
      Returns:
      String
      Since:
      Revision 385
    • toJSON

      public String toJSON()
      Returns the JSON (RFC 8259) representation of the Link. Cannot be null due to requiring items from constructor.
      Specified by:
      toJSON in interface ILink
      Returns:
      the JSON (RFC 8259) representation of the Link.
      Since:
      Revision 391
    • clone

      public Link clone()
      Returns a deep copy of the Link. Cannot be null due to requiring items from constructor.
      Specified by:
      clone in interface ILink
      Returns:
      a deep copy of the Link.
      Since:
      Revision 394