Class Message

java.lang.Object
org.opensextant.data.social.Message
Direct Known Subclasses:
Tweet

public class Message extends Object
Micro Message is the basis for any sort microblog message, SMS, or tweet or other social media post. These attributes have some conventions:
  • Author data (author* attributes) are synonmous with User Profile, Poster, etc. Otherwise the attribute is more related to the message itself.
  • This structure represents data which maybe given or raw; or which may be processed or inferred. it is up to the developer to decide how to navigate the differences between such differences.
Author:
ubaldino
  • Field Details

    • authorID

      public String authorID
      Author ID is screen_name, user_id, user.name, etc.
    • authorName

      public String authorName
      A plain language Name, display name, native language name for the author
    • authorProfileID

      public String authorProfileID
      the numeric ID for a user/author profile. As users are able to change display names at-will.
    • authorCC

      public String authorCC
      raw country code
    • authorLocation

      public String authorLocation
      raw location string
    • authorLatLonText

      public String authorLatLonText
      raw XY val, if present on author profile.
    • locationCC

      public String locationCC
      Location Country Code if inferred or given.
    • authorGeo

      public Geocoding authorGeo
      Author's profile location -- If country and actual location is set, use Geocoding object, or opensextant.Place to capture the full metadata.
    • statusGeo

      public Geocoding statusGeo
      the origination of the message -- Country from which the item was sent. If the location is set also as a coordinate use that.
    • date

      public Date date
      Date object for the message timestamp
    • dateText

      public String dateText
      Original text of the date, if given
    • timezone

      public String timezone
      Timezone label of the timestamp, e.g., Europe/London, or just London or "Canada and Atlantic (EST)". There are some standard labels, but these labels do not always line up with well-known TZ databases.
    • UNSET_UTC_OFFSET

      public static final int UNSET_UTC_OFFSET
      See Also:
    • utcOffset

      public int utcOffset
      UTC offset in seconds (as given by Twitter and other sources). Default is UNSET_UTC_OFFSET
    • isDST

      public boolean isDST
      isDST = is Daylight Savings Time = true if we think the message timestamp is in a period of DST recognized by the country of origin, or UTC offset.
    • utcOffsetHours

      public int utcOffsetHours
      utcOffset is in seconds, UTC offset hours is in hours. Duh. Default is UNSET_UTC_OFFSET
    • id

      public String id
      Message ID
    • text

      protected String text
      The text of the message.
    • textNatural

      protected String textNatural
      The natural language version of the text.
    • rawbytes

      public long rawbytes
      Character count of the message. Or if you choose to store byte count....
    • userLang

      public String userLang
      Language declared by the user.
    • lang

      public String lang
      Language of the message; not usually given unless inferred by someone or something.
    • isASCII

      public boolean isASCII
      True if text is purely ASCII
    • isEnglish

      public boolean isEnglish
      True if processing of text determines tweet is nearly all English.
    • sourceID

      public String sourceID
      optional Source ID field
    • OFFSET_HALF

      public static final int OFFSET_HALF
      See Also:
  • Constructor Details

    • Message

      public Message()
      Trivial constructor.
    • Message

      public Message(String _id, String text, Date tm)
      A simple message with an ID, text and a timestamp.
      Parameters:
      _id - ID
      text - message
      tm - timestamp
  • Method Details

    • setText

      public final void setText(String t)
      Set the text, if not null, isASCII and rawbytes length are calculated.
    • getText

      public String getText()
      get the message text.
    • getTextNatural

      public String getTextNatural()
      Get the natural language version of the raw text.
      Returns:
    • setTextNatural

      public void setTextNatural(String t)
    • setUTCOffset

      public void setUTCOffset(int utc)
      Set UTC and TZ after date is set.
      Parameters:
      utc - UTC offset in SECONDS
    • validateUTCOffset

      public static final boolean validateUTCOffset(int o)
    • toUTCOffsetHours

      public static final double toUTCOffsetHours(int o)
      UTC offset as hours. Convert from seconds
      Parameters:
      o -
      Returns:
    • validTZ

      public static boolean validTZ(Tweet t)
      detect if Tweet has UTC offset or TZ
      Parameters:
      t - tweet obj
      Returns: