Class Link

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

public class Link
extends java.lang.Object
implements ILink
Default implementation of ILink.
Author:
Pablo Maldonado
  • Constructor Details

    • Link

      public Link​(ILink.LinkTag linktag, int linkID, java.lang.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:
      java.lang.NullPointerException - if TLinkRelType argument is null
      java.lang.IllegalArgumentException - throw error if linktag != LinkTag.TLINK
    • Link

      public Link​(ILink.LinkTag linktag, int linkID, java.lang.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:
      java.lang.NullPointerException - if ALinkRelType argument is null
      java.lang.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
      Specified by:
      getLinkID in interface ILink
      Returns:
      the ID of the link.
    • getLinkTag

      public ILink.LinkTag getLinkTag()
      Returns the type of Link.
      Specified by:
      getLinkTag in interface ILink
      Returns:
      ILink.LinkTag.TLINK / ILink.LinkTag.ALINK / ILink.LinkTag.SLINK
    • getSyntax

      public java.lang.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).
      Specified by:
      getSyntax in interface ILink
      Returns:
      the syntax of the link.
    • getEventInstance

      public INode getEventInstance()
      Returns the ID of the event instance involved in the link. OBLIGATORY
      Specified by:
      getEventInstance in interface ILink
      Returns:
      the ID of the event instance involved in the link.
    • 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.
      Specified by:
      getSignal in interface ILink
      Returns:
      the optional ID of the relation signal.
    • getOrigin

      public ILink.Origintype getOrigin()
      Returns whether a TLINK was generated MANUALLY or by CLOSURE.
      THIS IS ONLY FOR TLINK
      Specified by:
      getOrigin in interface ILink
      Returns:
      Whether link was generated MANUALLY or by CLOSURE
    • 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.
      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.
    • 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.
      Specified by:
      getRelType in interface ILink
      Returns:
      ALinkRelType / SLinkRelType / TLinkRelType
      See Also:
      ILink.ALinkType, ILink.SLinkType, ILink.TLinkType
    • hashCode

      public int hashCode()
      Gets the links hash code
      Specified by:
      hashCode in interface ILink
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashcode
    • toString

      public java.lang.String toString()
      Converts the Link to a String
      Overrides:
      toString in class java.lang.Object
      Returns:
      String
    • toJSON

      public java.lang.String toJSON()
      Returns the JSON (RFC 8259) representation of the Link.
      Specified by:
      toJSON in interface ILink
      Returns:
      the JSON (RFC 8259) representation of the Link.
    • clone

      public Link clone()
      Returns a deep copy of the Link.
      Specified by:
      clone in interface ILink
      Returns:
      a deep copy of the Link.