Package org.opensextant.data.social
Class Message
- java.lang.Object
-
- org.opensextant.data.social.Message
-
- Direct Known Subclasses:
Tweet
public class Message extends java.lang.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 Summary
Fields Modifier and Type Field Description java.lang.String
authorCC
raw country codeGeocoding
authorGeo
Author's profile location -- If country and actual location is set, use Geocoding object, or opensextant.Place to capture the full metadata.java.lang.String
authorID
Author ID is screen_name, user_id, user.name, etc.java.lang.String
authorLatLonText
raw XY val, if present on author profile.java.lang.String
authorLocation
raw location stringjava.lang.String
authorName
A plain language Name, display name, native language name for the authorjava.lang.String
authorProfileID
the numeric ID for a user/author profile.java.util.Date
date
Date object for the message timestampjava.lang.String
dateText
Original text of the date, if givenjava.lang.String
id
Message IDboolean
isASCII
True if text is purely ASCIIboolean
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.boolean
isEnglish
True if processing of text determines tweet is nearly all English.java.lang.String
lang
Language of the message; not usually given unless inferred by someone or something.java.lang.String
locationCC
Location Country Code if inferred or given.static int
OFFSET_HALF
long
rawbytes
Character count of the message.java.lang.String
sourceID
optional Source ID fieldGeocoding
statusGeo
the origination of the message -- Country from which the item was sent.protected java.lang.String
text
The text of the message.protected java.lang.String
textNatural
The natural language version of the text.java.lang.String
timezone
Timezone label of the timestamp, e.g., Europe/London, or just London or "Canada and Atlantic (EST)".static int
UNSET_UTC_OFFSET
java.lang.String
userLang
Language declared by the user.int
utcOffset
UTC offset in seconds (as given by Twitter and other sources).int
utcOffsetHours
utcOffset is in seconds, UTC offset hours is in hours.
-
Method Summary
Modifier and Type Method Description java.lang.String
getText()
get the message text.java.lang.String
getTextNatural()
Get the natural language version of the raw text.void
setText(java.lang.String t)
Set the text, if not null, isASCII and rawbytes length are calculated.void
setTextNatural(java.lang.String t)
void
setUTCOffset(int utc)
Set UTC and TZ after date is set.static double
toUTCOffsetHours(int o)
UTC offset as hours.static boolean
validateUTCOffset(int o)
static boolean
validTZ(Tweet t)
detect if Tweet has UTC offset or TZ
-
-
-
Field Detail
-
authorID
public java.lang.String authorID
Author ID is screen_name, user_id, user.name, etc.
-
authorName
public java.lang.String authorName
A plain language Name, display name, native language name for the author
-
authorProfileID
public java.lang.String authorProfileID
the numeric ID for a user/author profile. As users are able to change display names at-will.
-
authorCC
public java.lang.String authorCC
raw country code
-
authorLocation
public java.lang.String authorLocation
raw location string
-
authorLatLonText
public java.lang.String authorLatLonText
raw XY val, if present on author profile.
-
locationCC
public java.lang.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 java.util.Date date
Date object for the message timestamp
-
dateText
public java.lang.String dateText
Original text of the date, if given
-
timezone
public java.lang.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:
- Constant Field Values
-
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 java.lang.String id
Message ID
-
text
protected java.lang.String text
The text of the message.
-
textNatural
protected java.lang.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 java.lang.String userLang
Language declared by the user.
-
lang
public java.lang.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 java.lang.String sourceID
optional Source ID field
-
OFFSET_HALF
public static final int OFFSET_HALF
- See Also:
- Constant Field Values
-
-
Method Detail
-
setText
public final void setText(java.lang.String t)
Set the text, if not null, isASCII and rawbytes length are calculated.
-
getText
public java.lang.String getText()
get the message text.
-
getTextNatural
public java.lang.String getTextNatural()
Get the natural language version of the raw text.- Returns:
-
setTextNatural
public void setTextNatural(java.lang.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:
-
-