Linked Data & Semantic Web Technology Development of Twitter Applications Part 4. Timeline and Tweet Dr. Myungjin Lee.

Slides:



Advertisements
Similar presentations
Overview of Twitter API Nathan Liu. Twitter API Essentials Twitter API is a Representational State Transfer(REST) style web services exposed over HTTP(S).
Advertisements

MOD III. Input / Output Streams Byte streams Programs use byte streams to perform input and output of 8-bit bytes. This Stream handles the 8-bit.
Twitter New way of communicating Like a conference Telling everyone Broadcasting to all This file works best with Internet Explorer.
Twitter The Basics. What is Twitter? Tweets are: 140 characters or less Quick to follow and view updates Used to share links, photos, videos, music,hot.
Chapter 5 Queues Modified. Chapter Scope Queue processing Comparing queue implementations 5 - 2Java Software Structures, 4th Edition, Lewis/Chase.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
1 More on Arrays Arrays of objects Command line arguments The ArrayList class Javadoc Review Lecture 8 notes and L&L 7.1 – 7.2 Reading for this lecture:
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Java Unit 9: Arrays Declaring and Processing Arrays.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
JSP Standard Tag Library
PSRC Technology Integration Team Twitter 101.  Twitter is a social networking tool or microblog.  It is composed of short text, pictures, and URLs called.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Application Protocols: HTTP CSNB534 Semester 2, 2007/2008 Asma Shakil.
More Object Concepts Chapter 4.  Our class is made up of several students and each student has a name and test grades  How do we assign the variables.
Navigating Twitter for Developing a LSMN starfishexpo 2012 Presenter: Gunnar Simonsen.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
PHP meets MySQL.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Writing JavaDocs Mimi Opkins CECS 274 Copyright (c) Pearson All rights reserved.
Using Client-Side Scripts to Enhance Web Applications 1.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
Arrays Chapter 8. What if we need to store test scores for all students in our class. We could store each test score as a unique variable: int score1.
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
Meridium EPiServer Premium Partner EPiMore Partner EPiServer is a major focus area Founded in employees 2.
Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge
Jargon Busters Presented by Katie Munton and Natalie Dawson.
Javadoc Comments.  Java API has a documentation tool called javadoc  The javadoc tool is used on the source code embedded with javadoc-style comments.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
ArrayList Class An ArrayList is an object that contains a sequence of elements that are ordered by position. An ArrayList is an object that contains a.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Lecture 101 CS110 Lecture 10 Thursday, February Announcements –hw4 due tonight –Exam next Tuesday (sample posted) Agenda –questions –what’s on.
XP Tutorial 8 Adding Interactivity with ActionScript.
UoS Libraries 2011 EndNote X5 - basic graduate session.
Greenstone Internals How to Build a Digital Library Ian H. Witten and David Bainbridge.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Text Files and String Processing
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
©2003 Paula Matuszek GOOGLE API l Search requests: submit a query string and a set of parameters to the Google Web APIs service and receive in return a.
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Social Media Apps Programming Min-Yuh Day, Ph.D. Assistant Professor Department of Information Management Tamkang University
Puzzle 2 1  what does the following program print? public class Puzzle02 { public static void main(String[] args) { final long MICROS_PER_DAY = 24 * 60.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of CHAPTER 15: Sets and Maps Java Software Structures: Designing and Using.
Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee.
Decom North Sea Late Life Planning Portal (L2P2) Design Workshop – Follow-up 13 January
APICS QUICK GUIDE TO TWITTER January 19, 2016 This presentation was created by the APICS Marketing Team for members, chapters, and partners who want to.
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
16BIT IITR Data Collection Module A web crawler (also known as a web spider or web robot) is a program or automated script which browses the World Wide.
Linked Data & Semantic Web Technology Development of Twitter Applications Part 6. Trends Dr. Myungjin Lee.
Linked Data & Semantic Web Technology Development of Twitter Applications Part 2. Twitter for Websites Dr. Myungjin Lee.
Development of Twitter Applications Part 7. Search API
JavaScript, Sixth Edition
Ed Ferrara, MSIA, CISSP MIS 5208 Week 13: Twitter API Ed Ferrara, MSIA, CISSP
Development of Twitter Applications Part 5. Users
Twitter Overview of today’s presentation: how to tweet
Turning Real-Time Data in Real-Time Insight
All about social networking
class PrintOnetoTen { public static void main(String args[]) {
Development of Twitter Applications Part 3. OAuth
Presentation transcript:

Linked Data & Semantic Web Technology Development of Twitter Applications Part 4. Timeline and Tweet Dr. Myungjin Lee

Linked Data & Semantic Web Technology Timeline Home Timeline – a long stream showing all Tweets from those you have chosen to follow on Twitter home timeline 2

Linked Data & Semantic Web Technology Timeline user timeline mentions timeline retweets of me 3

Linked Data & Semantic Web Technology REST API related to Timeline Timelines – Timelines are collections of Tweets, ordered with the most recent first. ResourceDescription GET statuses/mentions_timeline Returns the 20 most recent mentions (tweets containing a for the authenticating user GET statuses/user_timeline Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters GET statuses/home_timeline Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow GET statuses/retweets_of_me Returns the most recent tweets authored by the authenticating user that have been retweeted by others 4

Linked Data & Semantic Web Technology Responses of Timeline REST API 1.[ 2. { 3. "created_at": "Mon Mar 25 08:47: ", 4. "id": , 5. "id_str": " ", 6. "text": 이 협동조합국제회의에는...", 7. "source": "web", 8. "truncated": false, 9. "in_reply_to_status_id": null, 10. "in_reply_to_status_id_str": null, 11. "in_reply_to_user_id": null, 12. "in_reply_to_user_id_str": null, 13. "in_reply_to_screen_name": null, 14. "user": { 15. "id": , 16. "id_str": " " 17. }, 18. "geo": null, 19. "coordinates": null, 20. "place": null, 21. "contributors": null, 22. "retweeted_status": { skip }, 25. "retweet_count": 27, 26. "favorite_count": 0, 27. "entities": { 28. "hashtags": [], 29. "urls": [], 30. "user_mentions": [ 31. { 32. "screen_name": "wonsoonpark", 33. "name": " 박원순 ", 34. "id": , 35. "id_str": " ", 36. "indices": [ 37. 3, ] 40. } 41. ] 42. }, 43. "favorited": false, 44. "retweeted": false, 45. "lang": "ko" 46. } 47.] 5

Linked Data & Semantic Web Technology Tweets Primary Field Guide 6 FieldTypeDescription coordinatesCoordinates Nullable. Represents the geographic location of this Tweet as reported by the user or client application. created_atStringUTC time when this Tweet was created. entitiesEntities Entities which have been parsed out of the text of the Tweet. favorite_countInteger Nullable. Indicates approximately how many times this Tweet has been "favorited" by Twitter users. idInt64 The integer representation of the unique identifier for this Tweet. id_strString The string representation of the unique identifier for this Tweet. in_reply_to_screen_nameString Nullable. If the represented Tweet is a reply, this field will contain the screen name of the original Tweet's author. in_reply_to_status_id_strString Nullable. If the represented Tweet is a reply, this field will contain the string representation of the original Tweet's ID. in_reply_to_user_id_strString Nullable. If the represented Tweet is a reply, this field will contain the string representation of the original Tweet's author ID. placePlaces Nullable. When present, indicates that the tweet is associated a Place. retweet_countIntNumber of times this Tweet has been retweeted. textStringThe actual UTF-8 text of the status update. userUsersThe user who posted this Tweet.

Linked Data & Semantic Web Technology Twitter4J Classes for Timeline API TimelinesResources Interface – interface to support REST API related to timeline – Methods ResponseList getHomeTimeline() ResponseList getHomeTimeline(Paging paging) ResponseList getMentionsTimeline() ResponseList getMentionsTimeline(Paging paging) ResponseList getRetweetsOfMe() ResponseList getRetweetsOfMe(Paging paging) ResponseList getUserTimeline() ResponseList getUserTimeline(Paging paging) ResponseList getUserTimeline(long userId) ResponseList getUserTimeline(java.lang.String screenName) Paging Class – controls pagination – Constructors Paging(int page, int count, long sinceId, long maxId) ResponseList Interface – list of Twitter Response Status Interface – a data interface representing one single status of a user – Methods java.util.Date getCreatedAt() long getId() Status getRetweetedStatus() java.lang.String getText() User getUser() 7

Linked Data & Semantic Web Technology GET statuses/home_timeline Resource URL – Parameters Other Information – Requests per rate limit window: 15/user – Authentication: Requires user context – Response Object: Tweets – API Version: v1.1 count optional Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20. since_id optional Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. max_id optional Returns results with an ID less than (that is, older than) or equal to the specified ID. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. exclude_replies optional This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets — this is because the count parameter retrieves that many tweets before filtering out retweets and replies. contributor_details optional This parameter enhances the contributors element of the status response to include the screen_name of the contributor. By default only the user_id of the contributor is included. include_entities optional The entities node will be disincluded when set to false. 8

Linked Data & Semantic Web Technology Getting Home Timeline 1.import java.util.List; 2.import twitter4j.Twitter; 3.import twitter4j.TwitterException; 4.import twitter4j.TwitterFactory; 5.import twitter4j.Status; 6.public class TwitterTimeline { 7.Twitter twitter = null; 8.public TwitterTimeline() { 9.this.twitter = TwitterFactory.getSingleton(); 10.this.twitter.setOAuthConsumer(TwitterAccessToken.consumerKey, 11.TwitterAccessToken.consumerSecret); 12.this.twitter.setOAuthAccessToken(TwitterAccessToken.loadAccessToken()); 13.} 14.public static void main(String args[]) throws TwitterException { 15.TwitterTimeline tt = new TwitterTimeline(); 16.List tweets = tt.twitter.getHomeTimeline(); 17.for (int i = 0; i < tweets.size(); i++) { 18.Status tweet = tweets.get(i); 19.System.out.println("tweet: " + tweet.getText()); 20.} 21.} 22.} 9

Linked Data & Semantic Web Technology Setting Pagination Constructors of Paging Class – Paging() – Paging(int page) – Paging(int page, int count) – Paging(int page, int count, long sinceId) – Paging(int page, int count, long sinceId, long maxId) – Paging(int page, long sinceId) – Paging(long sinceId) 1.public static void main(String args[]) throws TwitterException { 2.TwitterTimeline tt = new TwitterTimeline(); 3.List tweets = tt.twitter.getHomeTimeline(new Paging(1, 5)); 4.for (int i = 0; i < tweets.size(); i++) { 5.Status tweet = tweets.get(i); 6.System.out.println("tweet: " + tweet.getText()); 7.} 8.} 9.private List getHomeTimeline() throws TwitterException { 10.return this.twitter.getHomeTimeline(); 11.} 10

Linked Data & Semantic Web Technology Getting Status of Tweets 1.public static void main(String args[]) throws TwitterException { 2.TwitterTimeline tt = new TwitterTimeline(); 3.List tweets = tt.twitter.getHomeTimeline(); 4.for (int i = 0; i < tweets.size(); i++) { 5.Status tweet = tweets.get(i); 6.System.out.println(i + " tweet:"); 7.System.out.println("\tcreated at: " + tweet.getCreatedAt()); 8.System.out.println("\tid: " + tweet.getId()); 9.System.out.println("\tretweet count: " + tweet.getRetweetCount()); 10.System.out.println("\ttext: " + tweet.getText()); 11.System.out.println("\tuser: " + tweet.getUser()); 12.} 13.} 11

Linked Data & Semantic Web Technology GET statuses/user_timeline Resource URL – Parameters Other Information – Requests per rate limit window: 180/user, 300/app – Authentication: Required – Response Object: Tweets – API Version: v1.1 user_id optional The ID of the user for whom to return results for. screen_name optional The screen name of the user for whom to return results for. count optional Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20. since_id optional Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. max_id optional Returns results with an ID less than (that is, older than) or equal to the specified ID. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. exclude_replies optional This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets — this is because the count parameter retrieves that many tweets before filtering out retweets and replies. contributor_details optional This parameter enhances the contributors element of the status response to include the screen_name of the contributor. By default only the user_id of the contributor is included. include_rts optional When set to false, the timeline will strip any native retweets (though they will still count toward both the maximal length of the timeline and the slice selected by the count parameter). Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will still contain a full user object. 12

Linked Data & Semantic Web Technology Getting User Timeline 1.public static void main(String args[]) throws TwitterException { 2.TwitterTimeline tt = new TwitterTimeline(); 3.List tweets = tt.twitter.getUserTimeline( ); 4.//List tweets = tt.twitter.getUserTimeline("linked_data"); 5.for (int i = 0; i < tweets.size(); i++) { 6.Status tweet = tweets.get(i); 7.System.out.println("text: " + tweet.getText()); 8.} 9.} 13

Linked Data & Semantic Web Technology GET statuses/mentions_timeline Resource URL – Parameters Other Information – Requests per rate limit window: 15/user – Authentication: Requires user context – Response Object: Tweets – API Version: v1.1 count optional Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20. since_id optional Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. max_id optional Returns results with an ID less than (that is, older than) or equal to the specified ID. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. contributor_details optional This parameter enhances the contributors element of the status response to include the screen_name of the contributor. By default only the user_id of the contributor is included. include_entities optional The entities node will be disincluded when set to false. 14

Linked Data & Semantic Web Technology GET statuses/retweet_of_me Resource URL – Parameters Other Information – Requests per rate limit window: 15/user – Authentication: Requires user context – Response Object: Tweets – API Version: v1.1 count optional Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20. since_id optional Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. max_id optional Returns results with an ID less than (that is, older than) or equal to the specified ID. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. include_entities optional The entities node will be disincluded when set to false. include_user_entities optional The user entities node will be disincluded when set to false 15

Linked Data & Semantic Web Technology Mentions Timeline and Retweets 1.public static void main(String args[]) throws TwitterException { 2.TwitterTimeline tt = new TwitterTimeline(); 3.//List tweets = tt.twitter.getMentionsTimeline(); 4.List tweets = tt.twitter.getRetweetsOfMe(); 5.for (int i = 0; i < tweets.size(); i++) { 6.Status tweet = tweets.get(i); 7.System.out.println("text: " + tweet.getText()); 8.} 9.} 16

Linked Data & Semantic Web Technology Tweets What is tweets? – the atomic building blocks of Twitter – 140-character status updates with additional associated metadata – for a variety of reasons about a multitude of topics tweet retweets count retweet 17

Linked Data & Semantic Web Technology REST API related to Tweets 18 ResourceDescription GET statuses/retweets/:id Returns up to 100 of the first retweets of a given tweet. GET statuses/show/:id Returns a single Tweet, specified by the id parameter. The Tweet's author will also be embedded within the tweet. See Embeddable Timelines, Embeddable Tweets, and GET statuses/oembed for tools to render Tweets according to Display Requirements.

Linked Data & Semantic Web Technology Twitter4J Classes for Tweet TweetsResources Interface – Methods ResponseList getRetweets(long statusId) Status retweetStatus(long statusId) Status showStatus(long id) 19

Linked Data & Semantic Web Technology GET statuses/show/:id Resource URL – Parameters Other Information – Requests per rate limit window: 180/user, 180/app – Authentication: Required – Response Object: Tweets – API Version: v1.1 id required The numerical ID of the desired Tweet. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. include_my_retweet optional When set to either true, t or 1, any Tweets returned that have been retweeted by the authenticating user will include an additional current_user_retweet node, containing the ID of the source status for the retweet. include_entities optional The entities node will be disincluded when set to false. 20

Linked Data & Semantic Web Technology Getting the Tweet 1.import java.util.List; 2.import twitter4j.Status; 3.import twitter4j.Twitter; 4.import twitter4j.TwitterException; 5.import twitter4j.TwitterFactory; 6.public class TwitterTweet { 7.Twitter twitter = null; 8.public TwitterTweet() { 9.this.twitter = TwitterFactory.getSingleton(); 10.this.twitter.setOAuthConsumer(TwitterAccessToken.consumerKey, 11.TwitterAccessToken.consumerSecret); 12.this.twitter.setOAuthAccessToken(TwitterAccessToken.loadAccessToken()); 13.} 14.public static void main(String args[]) throws TwitterException { 15. TwitterTweet tt = new TwitterTweet(); 16.Status status = tt.twitter.showStatus(Long.parseLong(" ")); 17.System.out.println("text: " + status.getText()); 18.} 19.} 21

Linked Data & Semantic Web Technology GET statuses/retweets/:id Resource URL – Parameters Other Information – Requests per rate limit window: 15/user, 60/app – Authentication: Required – Response Object: Tweets – API Version: v1.1 id required The numerical ID of the desired status. count optional Specifies the number of records to retrieve. Must be less than or equal to 100. trim_user optional When set to either true, t or 1, each tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object. 22

Linked Data & Semantic Web Technology Getting Retweets 1.import java.util.List; 2.import twitter4j.Status; 3.import twitter4j.Twitter; 4.import twitter4j.TwitterException; 5.import twitter4j.TwitterFactory; 6.public class TwitterTweet { 7.Twitter twitter = null; 8.public TwitterTweet() { 9.this.twitter = TwitterFactory.getSingleton(); 10.this.twitter.setOAuthConsumer(TwitterAccessToken.consumerKey, 11.TwitterAccessToken.consumerSecret); 12.this.twitter.setOAuthAccessToken(TwitterAccessToken.loadAccessToken()); 13.} 14.public static void main(String args[]) throws TwitterException { 15. TwitterTweet tt = new TwitterTweet(); 16.List list = tt.twitter.getRetweets(Long 17..parseLong(" ")); 18.for (int i = 0; i < list.size(); i++) { 19.Status status = list.get(i); 20.System.out.println("retweet user: " + status.getUser().getName()); 21.} 22.} 23.} 23

Linked Data & Semantic Web Technology Tweet’s Entities Entities – to provide metadata and additional contextual information about content posted on Twitter Types of Entity – hashtags Represents hashtags which have been parsed out of the Tweet text – media Represents media elements uploaded with the Tweet – urls Represents URLs included in the text of a Tweet or within textual fields of a user object – user mentions Represents other Twitter users mentioned in the text of the Tweet 24

Linked Data & Semantic Web Technology Entities’ Field Guide Hashtag Media 25 FieldTypeDescription indicesArray of Int An array of integers indicating the offsets within the Tweet text where the hashtag begins and ends. textStringName of the hashtag, minus the leading '#' character. FieldTypeDescription display_urlStringURL of the media to display to clients. expanded_urlString An expanded version of display_url. Links to the media display page. idInt64ID of the media expressed as a 64-bit integer. id_strStringID of the media expressed as a string. indices Array of Int An array of integers indicating the offsets within the Tweet text where the URL begins and ends. media_urlStringAn URL pointing directly to the uploaded media file. media_url_httpsString An URL pointing directly to the uploaded media file, for embedding on https pages. sizesObjectAn object showing available sizes for the media file. source_status_idInt64 For Tweets containing media that was originally associated with a different tweet, this ID points to the original Tweet. source_status_id_strInt64 For Tweets containing media that was originally associated with a different tweet, this string-based ID points to the original Tweet. typeStringType of uploaded media. urlStringWrapped URL for the media link.

Linked Data & Semantic Web Technology Entities’ Field Guide URL User Mention 26 FieldTypeDescription display_urlStringVersion of the URL to display to clients. expanded_urlStringExpanded version of display_url. indicesArray of Int An array of integers representing offsets within the Tweet text where t he URL begins and ends. urlString Wrapped URL, corresponding to the value embedded directly into the raw Tweet text, and the values for the indices parameter. FieldTypeDescription idInt64ID of the mentioned user, as an integer. id_strStringIf of the mentioned user, as a string. indices Array of Int An array of integers representing the offsets within the Tweet text w here the user reference begins and ends. nameStringDisplay name of the referenced user. screen_nameStringScreen name of the referenced user.

Linked Data & Semantic Web Technology Twitter4J Classes for Entities Status Interface – Methods HashtagEntity[] getHashtagEntities() MediaEntity[] getMediaEntities() URLEntity[] getURLEntities() UserMentionEntity[] getUserMentionEntities() HashtagEntity Interface – A data interface representing one single Hashtag entity – Methods String getText() MediaEntity Interface – Methods long getId() String getMediaURL() String getType() URLEntity Interface – A data interface representing one single URL entity. – Methods String getDisplayURL() String getExpandedURL() String getURL() UserMentionEntity Interface – A data interface representing one single user mention entity. – Methods long getId() String getScreenName() 27

Linked Data & Semantic Web Technology Getting Entities 1.public static void main(String args[]) throws TwitterException { 2. TwitterTweet tt = new TwitterTweet(); 3.List tweets = tt.twitter.getHomeTimeline(); 4.for (int i = 0; i < tweets.size(); i++) { 5.Status tweet = tweets.get(i); 6.System.out.println("tweet id: " + tweet.getId()); 7.if(tweet.getHashtagEntities().length != 0) { 8.System.out.println("\thastags:"); 9.HashtagEntity[] hes = tweet.getHashtagEntities(); 10.for(int j = 0; j < hes.length; j++) { 11.System.out.println("\t\t" + hes[j].getText()); 12.} 13.} 14.if(tweet.getMediaEntities().length != 0) { 15.System.out.println("\tmedia:"); 16.MediaEntity[] mes = tweet.getMediaEntities(); 17.for(int j = 0; j < mes.length; j++) { 18.System.out.println("\t\t" + mes[j].getType() + ", " + mes[j].getMediaURL()); 19.} 20.} 21.if(tweet.getURLEntities().length != 0) { 22.System.out.println("\tURLs:"); 23.URLEntity[] urls = tweet.getURLEntities(); 24.for(int j = 0; j < urls.length; j++) { 25.System.out.println("\t\t" + urls[j].getExpandedURL()); 26.} 27.} 28.if(tweet.getUserMentionEntities().length != 0) { 29.System.out.println("\tmentions:"); 30.UserMentionEntity[] umes = tweet.getUserMentionEntities(); 31.for(int j = 0; j < umes.length; j++) { 32.System.out.println("\t\t" + umes[j].getScreenName()); 33.} 34.} 35.} 36.} 28