Class Annotation

java.lang.Object
org.opensextant.annotations.DeepEyeData
org.opensextant.annotations.Annotation

public class Annotation extends DeepEyeData
An annotation is at least a typed name/value pair created by something.

Creator is called "contributor" because lots of parties can contribute annotations to this pool.

Every annotation belongs to some record (ident by rec_id)
Every annotation instance has an ID itself.

Offset and attributes are optional, as some annotations apply to entire records, rather than data at a certain offset.

Author:
ubaldino
  • Field Details

    • rec_id

      public String rec_id
    • name

      public String name
    • source_id

      public String source_id
      Source ID here is very much optional Currently it is useful for SQLite usage.
    • offset

      public long offset
      optional offset
    • contrib

      public String contrib
    • OFFSETS_FLD

      public static String OFFSETS_FLD
  • Constructor Details

  • Method Details

    • getAttribute

      public String getAttribute(String k)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setLength

      public void setLength(int l)
    • hasLength

      public boolean hasLength()
    • getLength

      public int getLength()
      Compute length, as logic is related to defaults, if value is set or not. etc.
      Returns:
    • getEndOffset

      public long getEndOffset()
      Compute span end offset.
      Returns:
      end offset (long)
    • addOffsetTo

      protected void addOffsetTo(Map<String,Object> repr)
      Add offset information (offset, len, offsets, etc ) into the representation of this annotation. Some annotations may have a more complex view of offset, e.g., EntityAnnotation overrides this.
    • addOffset

      public void addOffset(int x)
    • getOffsets

      public Collection<Integer> getOffsets()
    • addOffsetAttribute

      public void addOffsetAttribute()
      add annot.offset = x or annot.attrs.offsets = "x1;x2;x3"... a string list, not a JSON obj.
    • resetOffsets

      public void resetOffsets()
      This is provided mainly for testing. The EntityAnnotation class is not intended for reuse e.g., populate an instance and then reset offsets alone. Use sparingly.
    • getMap

      public Map<String,Object> getMap()
      Generate a key-value representation of the object with its current values.
      Specified by:
      getMap in class DeepEyeData
      Returns:
      Map