SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Linked Data &
Semantic Web
Technology
Development of
Twitter Applications
Part 5. Users
Dr. Myungjin Lee
Linked Data & Semantic Web Technology
Users
• Users in Twitter
– anyone or anything who tweets, follows, creates
lists, has a home_timeline, can be mentioned, and can
be looked up in bulk
2
followers: another
Twitter user who has
followed you
following (frineds): the
quantity of other Twitter users
you have chosen to follow
name: a name that can be
different from your username and
is used to locate you on Twitter
scree name (user name): unique and
fewer than 15 characters to identify you
on Twitter for replies and mentions
location description
url
profile image
Linked Data & Semantic Web Technology
REST API related to Users
3
Resource Description
GET
users/lookup
Returns fully-hydrated user objects for up to 100 users per
request, as specified by comma-separated values passed to
the user_id and/or screen_name parameters. This method is
especially useful when used in conjunction with collections
of user IDs returned from GET friends/ids and GET
followers/...
GET
users/show
Returns a variety of information about the user specified by
the required user_id or screen_name parameter. The
author's most recent Tweet will be returned inline when
possible. GET users/lookup is used to retrieve a bulk
collection of user objects.
GET
users/search
Provides a simple, relevance-based search interface to
public user accounts on Twitter. Try querying by topical
interest, full name, company name, location, or other
criteria. Exact match searches are not supported. Only the
first 1,000 matching results are available.
Linked Data & Semantic Web Technology
Users Primary Field Guide
4
Field Type Description
created_at String The UTC datetime that the user account was created on Twitter
description String Nullable. The user-defined UTF-8 string describing their account.
entities Entities
Entities which have been parsed out of the url or description fields
defined by the user.
favourites_count Int The number of tweets this user has favorited in the account's lifetime.
followers_count Int The number of followers this account currently has.
friends_count Int
The number of users this account is following (AKA their
"followings").
id Int64 The integer representation of the unique identifier for this User.
id_str String The string representation of the unique identifier for this Tweet.
lang String The BCP 47 code for the user's self-declared user interface language.
listed_count Int The number of public lists that this user is a member of.
location String Nullable. The user-defined location for this account's profile.
name String The name of the user, as they've defined it.
protected Boolean When true, indicates that this user has chosen to protect their Tweets.
screen_name String
The screen name, handle, or alias that this user identifies themselves
with.
status Tweets Nullable. If possible, the user's most recent tweet or retweet.
statuses_count Int The number of tweets (including retweets) issued by the user.
url String
Nullable. A URL provided by the user in association with their
profile.
Linked Data & Semantic Web Technology
Twitter4J Classes for Users
• UsersResources Interface
– Methods
• ResponseList<User> lookupUsers(long[] ids)
• ResponseList<User> searchUsers(String query, int page)
• User showUser(long userId)
• User showUser(String screenName)
• User Interface
– A data interface representing Basic user information
element
– Methods
• Date getCreatedAt()
• String getDescription()
• int getFavouritesCount()
• int getFollowersCount()
• int getFriendsCount()
• long getId()
• String getLang()
• int getListedCount()
• String getLocation()
• String getName()
• String getProfileImageURL()
• String getScreenName()
• int getStatusesCount()
• String getURL()
5
Linked Data & Semantic Web Technology
GET users/show
• Resource URL
– http://api.twitter.com/1.1/users/show.json
• Parameters
• Other Information
– Requests per rate limit window: 180/user, 180/app
– Authentication: Required
– Response Object: Users
– API Version: v1.1
user_id
required
The ID of the user for whom to return results for. Either an id or
screen_name is required for this method.
screen_name
required
The screen name of the user for whom to return results for. Either a id
or screen_name is required for this method.
include_entities
optional
The entities node will be disincluded when set to false.
6
Linked Data & Semantic Web Technology
Getting the User
1. import java.util.List;
2. import twitter4j.Twitter;
3. import twitter4j.TwitterException;
4. import twitter4j.TwitterFactory;
5. import twitter4j.User;
6. public class TwitterUser {
7. Twitter twitter = null;
8. public TwitterUser() {
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. TwitterUser tt = new TwitterUser ();
16. User user = tt.twitter.showUser("ACSpressroom");
17. System.out.println(user.getId());
18. System.out.println(user.getName());
19. System.out.println(user.getScreenName());
20. System.out.println(user.getDescription());
21. System.out.println(user.getLocation());
22. System.out.println(user.getURL());
23. System.out.println(user.getProfileBackgroundImageURL());
24. }
25. }
7
Linked Data & Semantic Web Technology
GET users/lookup
• Resource URL
– https://api.twitter.com/1.1/users/lookup.json
• Parameters
• Other Information
– Requests per rate limit window: 180/user, 60/app
– Authentication: Required
– Response Object: Users
– API Version: v1.1
user_id
optional
The ID of the user for whom to return results for. Either an id or
screen_name is required for this method.
screen_name
optional
The screen name of the user for whom to return results for. Either a id
or screen_name is required for this method.
include_entities
optional
The entities node will be disincluded when set to false.
8
Linked Data & Semantic Web Technology
Getting Users
1. public static void main(String args[]) throws TwitterException {
2. TwitterUser tt = new TwitterUser ();
3. String[] users = {"ACSpressroom", "AIP_Publishing", "PLoSNTDs"};
4. List<User> userList = tt.twitter.lookupUsers(users);
5. for(int i = 0; i < userList.size(); i++) {
6. User user = userList.get(i);
7. System.out.println(user.getId());
8. }
9. }
9
Linked Data & Semantic Web Technology
GET users/search
• Resource URL
– https://api.twitter.com/1.1/users/search.json
• Parameters
• Other Information
– Requests per rate limit window: 180/user, 60/app
– Authentication: Required
– Response Object: Users
– API Version: v1.1
q
required
The search query to run against people search.
page
optional
Specifies the page of results to retrieve.
count
optional
The number of potential user results to retrieve per page. This value
has a maximum of 20.
include_entities
optional
The entities node will be disincluded when set to false.
10
Linked Data & Semantic Web Technology
Searching Users
1. public static void main(String args[]) throws TwitterException {
2. TwitterUser tt = new TwitterUser ();
3. List<User> userList = tt.twitter.searchUsers("journal", 1);
4. for(int i = 0; i < userList.size(); i++) {
5. User user = userList.get(i);
6. System.out.println(user.getId() + ", " + user.getName());
7. }
8. }
11
Linked Data & Semantic Web Technology
REST API related to Friends & Followers
12
Resource Description
GET friends/ids
Returns a cursored collection of user IDs for every user the specified
user is following (otherwise known as their "friends"). At this time,
results are ordered with the most recent following first — however,
this ordering is subject to unannounced change and eventual
consistency issues....
GET followers/ids
Returns a cursored collection of user IDs for every user following the
specified user. At this time, results are ordered with the most recent
following first — however, this ordering is subject to unannounced
change and eventual consistency issues. Results are given in groups
of 5,000 user...
GET friendships/lookup
Returns the relationships of the authenticating user to the comma-
separated list of up to 100 screen_names or user_ids provided. Values
for connections can be: following, following_requested, followed_by,
none.
GET friendships/show
Returns detailed information about the relationship between two
arbitrary users.
Linked Data & Semantic Web Technology
Twitter4J Classes for Friends & Followers
• FriendsFollowersResources Interface
– Methods
• IDs getFollowersIDs(long cursor)
• IDs getFollowersIDs(long userId, long cursor)
• IDs getFollowersIDs(String screenName, long cursor)
• IDs getFriendsIDs(long cursor)
• IDs getFriendsIDs(long userId, long cursor)
• IDs getFriendsIDs(String screenName, long cursor)
• IDs
– A data interface representing array of numeric IDs.
– Methods
• long[] getIDs()
13
Linked Data & Semantic Web Technology
GET friends/ids & followers/ids
• Resource URL
– https://api.twitter.com/1.1/friends/ids.json
– https://api.twitter.com/1.1/followers/ids.json
• Parameters
• Other Information
– Requests per rate limit window: 180/user, 60/app
– Authentication: Required
– Response Object: Users
– 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.
cursor
semi-optional
Causes the list of connections to be broken into pages of no more than 5000
IDs at a time. The number of IDs returned is not guaranteed to be 5000 as
suspended users are filtered out after connections are queried. If no cursor
is provided, a value of -1 will be assumed, which is the first "page."
stringify_ids
optional
Many programming environments will not consume our Tweet ids due to
their size. Provide this option to have ids returned as strings instead.
count
optional
Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000
per distinct request. The value of count is best thought of as a limit to the
number of results to return. When using the count parameter with this
method, it is wise to use a consistent count value across all requests to the
same user's collection. Usage of this parameter is encouraged in
environments where all 5,000 IDs constitutes too large of a response.
14
Linked Data & Semantic Web Technology
Getting Friends and Followers
1. public static void main(String args[]) throws TwitterException {
2. TwitterUser tt = new TwitterUser ();
3. IDs friends = tt.twitter.getFriendsIDs("ACSpressroom", -1);
4. System.out.println("friends:");
5. long[] ids = friends.getIDs();
6. for(int i = 0; i < ids.length; i++) {
7. System.out.println("t" + ids[i]);
8. }
9. IDs followers = tt.twitter.getFollowersIDs("ACSpressroom", -1);
10. ids = followers.getIDs();
11. System.out.println("followers:");
12. for(int i = 0; i < ids.length; i++) {
13. System.out.println("t" + ids[i]);
14. }
15. }
15

Weitere ähnliche Inhalte

Ähnlich wie Development of Twitter Application #5 - Users

How to measure Twitter
How to measure TwitterHow to measure Twitter
How to measure TwitterTriptease
 
Development of Twitter Application #7 - Search
Development of Twitter Application #7 - SearchDevelopment of Twitter Application #7 - Search
Development of Twitter Application #7 - SearchMyungjin Lee
 
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docxCopyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docxbobbywlane695641
 
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...IRJET Journal
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesAshish Saxena
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & DatabasesMuhammad Sajid
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using pythonKe Jiang
 
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...IIIT Hyderabad
 
1How To Scrape Tweets From Twitter (2).pdf
1How To Scrape Tweets From Twitter (2).pdf1How To Scrape Tweets From Twitter (2).pdf
1How To Scrape Tweets From Twitter (2).pdfAqsaBatool21
 
MongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day OneMongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day OneMongoDB
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using pythonKe Jiang
 
Five steps to search and store tweets by keywords
Five steps to search and store tweets by keywordsFive steps to search and store tweets by keywords
Five steps to search and store tweets by keywordsWeiai Wayne Xu
 
.NET Core, ASP.NET Core Course, Session 19
 .NET Core, ASP.NET Core Course, Session 19 .NET Core, ASP.NET Core Course, Session 19
.NET Core, ASP.NET Core Course, Session 19aminmesbahi
 
E_BLOODBANK PROJECT PRESENTATION REPORT.pptx
E_BLOODBANK PROJECT PRESENTATION REPORT.pptxE_BLOODBANK PROJECT PRESENTATION REPORT.pptx
E_BLOODBANK PROJECT PRESENTATION REPORT.pptxss1sumitsatish
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Federated Authentication in a Campus System
Federated Authentication in a Campus SystemFederated Authentication in a Campus System
Federated Authentication in a Campus SystemMatthew Hanlon
 

Ähnlich wie Development of Twitter Application #5 - Users (20)

Social Aggregator Paper
Social Aggregator PaperSocial Aggregator Paper
Social Aggregator Paper
 
How to measure Twitter
How to measure TwitterHow to measure Twitter
How to measure Twitter
 
Development of Twitter Application #7 - Search
Development of Twitter Application #7 - SearchDevelopment of Twitter Application #7 - Search
Development of Twitter Application #7 - Search
 
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docxCopyright © 2017, 2018 Sinclair Community College. All Right.docx
Copyright © 2017, 2018 Sinclair Community College. All Right.docx
 
Subj3ct
Subj3ctSubj3ct
Subj3ct
 
Metadata.pptx
Metadata.pptxMetadata.pptx
Metadata.pptx
 
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
A SECURED AUDITING PROTOCOL FOR TRANSFERRING DATA AND PROTECTED DISTRIBUTED S...
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
 
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...
What Sets Verified Users apart? Insights Into, Analysis of and Prediction of ...
 
1How To Scrape Tweets From Twitter (2).pdf
1How To Scrape Tweets From Twitter (2).pdf1How To Scrape Tweets From Twitter (2).pdf
1How To Scrape Tweets From Twitter (2).pdf
 
MongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day OneMongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day One
 
what is-twitter
what is-twitterwhat is-twitter
what is-twitter
 
Collect twitter data using python
Collect twitter data using pythonCollect twitter data using python
Collect twitter data using python
 
Five steps to search and store tweets by keywords
Five steps to search and store tweets by keywordsFive steps to search and store tweets by keywords
Five steps to search and store tweets by keywords
 
.NET Core, ASP.NET Core Course, Session 19
 .NET Core, ASP.NET Core Course, Session 19 .NET Core, ASP.NET Core Course, Session 19
.NET Core, ASP.NET Core Course, Session 19
 
E_BLOODBANK PROJECT PRESENTATION REPORT.pptx
E_BLOODBANK PROJECT PRESENTATION REPORT.pptxE_BLOODBANK PROJECT PRESENTATION REPORT.pptx
E_BLOODBANK PROJECT PRESENTATION REPORT.pptx
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Federated Authentication in a Campus System
Federated Authentication in a Campus SystemFederated Authentication in a Campus System
Federated Authentication in a Campus System
 

Mehr von Myungjin Lee

지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)Myungjin Lee
 
JSP 프로그래밍 #05 HTML과 JSP
JSP 프로그래밍 #05 HTML과 JSPJSP 프로그래밍 #05 HTML과 JSP
JSP 프로그래밍 #05 HTML과 JSPMyungjin Lee
 
JSP 프로그래밍 #04 JSP 의 기본
JSP 프로그래밍 #04 JSP 의 기본JSP 프로그래밍 #04 JSP 의 기본
JSP 프로그래밍 #04 JSP 의 기본Myungjin Lee
 
JSP 프로그래밍 #03 서블릿
JSP 프로그래밍 #03 서블릿JSP 프로그래밍 #03 서블릿
JSP 프로그래밍 #03 서블릿Myungjin Lee
 
JSP 프로그래밍 #02 서블릿과 JSP 시작하기
JSP 프로그래밍 #02 서블릿과 JSP 시작하기JSP 프로그래밍 #02 서블릿과 JSP 시작하기
JSP 프로그래밍 #02 서블릿과 JSP 시작하기Myungjin Lee
 
JSP 프로그래밍 #01 웹 프로그래밍
JSP 프로그래밍 #01 웹 프로그래밍JSP 프로그래밍 #01 웹 프로그래밍
JSP 프로그래밍 #01 웹 프로그래밍Myungjin Lee
 
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)Myungjin Lee
 
오픈 데이터와 인공지능
오픈 데이터와 인공지능오픈 데이터와 인공지능
오픈 데이터와 인공지능Myungjin Lee
 
법령 온톨로지의 구축 및 검색
법령 온톨로지의 구축 및 검색법령 온톨로지의 구축 및 검색
법령 온톨로지의 구축 및 검색Myungjin Lee
 
도서관과 Linked Data
도서관과 Linked Data도서관과 Linked Data
도서관과 Linked DataMyungjin Lee
 
공공데이터, 현재 우리는?
공공데이터, 현재 우리는?공공데이터, 현재 우리는?
공공데이터, 현재 우리는?Myungjin Lee
 
LODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopLODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopMyungjin Lee
 
Introduction of Deep Learning
Introduction of Deep LearningIntroduction of Deep Learning
Introduction of Deep LearningMyungjin Lee
 
쉽게 이해하는 LOD
쉽게 이해하는 LOD쉽게 이해하는 LOD
쉽게 이해하는 LODMyungjin Lee
 
서울시 열린데이터 광장 문화관광 분야 LOD 서비스
서울시 열린데이터 광장 문화관광 분야 LOD 서비스서울시 열린데이터 광장 문화관광 분야 LOD 서비스
서울시 열린데이터 광장 문화관광 분야 LOD 서비스Myungjin Lee
 
LOD(Linked Open Data) Recommendations
LOD(Linked Open Data) RecommendationsLOD(Linked Open Data) Recommendations
LOD(Linked Open Data) RecommendationsMyungjin Lee
 
Interlinking for Linked Data
Interlinking for Linked DataInterlinking for Linked Data
Interlinking for Linked DataMyungjin Lee
 
Linked Open Data Tutorial
Linked Open Data TutorialLinked Open Data Tutorial
Linked Open Data TutorialMyungjin Lee
 
Linked Data Usecases
Linked Data UsecasesLinked Data Usecases
Linked Data UsecasesMyungjin Lee
 
공공데이터와 Linked open data
공공데이터와 Linked open data공공데이터와 Linked open data
공공데이터와 Linked open dataMyungjin Lee
 

Mehr von Myungjin Lee (20)

지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
 
JSP 프로그래밍 #05 HTML과 JSP
JSP 프로그래밍 #05 HTML과 JSPJSP 프로그래밍 #05 HTML과 JSP
JSP 프로그래밍 #05 HTML과 JSP
 
JSP 프로그래밍 #04 JSP 의 기본
JSP 프로그래밍 #04 JSP 의 기본JSP 프로그래밍 #04 JSP 의 기본
JSP 프로그래밍 #04 JSP 의 기본
 
JSP 프로그래밍 #03 서블릿
JSP 프로그래밍 #03 서블릿JSP 프로그래밍 #03 서블릿
JSP 프로그래밍 #03 서블릿
 
JSP 프로그래밍 #02 서블릿과 JSP 시작하기
JSP 프로그래밍 #02 서블릿과 JSP 시작하기JSP 프로그래밍 #02 서블릿과 JSP 시작하기
JSP 프로그래밍 #02 서블릿과 JSP 시작하기
 
JSP 프로그래밍 #01 웹 프로그래밍
JSP 프로그래밍 #01 웹 프로그래밍JSP 프로그래밍 #01 웹 프로그래밍
JSP 프로그래밍 #01 웹 프로그래밍
 
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
 
오픈 데이터와 인공지능
오픈 데이터와 인공지능오픈 데이터와 인공지능
오픈 데이터와 인공지능
 
법령 온톨로지의 구축 및 검색
법령 온톨로지의 구축 및 검색법령 온톨로지의 구축 및 검색
법령 온톨로지의 구축 및 검색
 
도서관과 Linked Data
도서관과 Linked Data도서관과 Linked Data
도서관과 Linked Data
 
공공데이터, 현재 우리는?
공공데이터, 현재 우리는?공공데이터, 현재 우리는?
공공데이터, 현재 우리는?
 
LODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopLODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data Workshop
 
Introduction of Deep Learning
Introduction of Deep LearningIntroduction of Deep Learning
Introduction of Deep Learning
 
쉽게 이해하는 LOD
쉽게 이해하는 LOD쉽게 이해하는 LOD
쉽게 이해하는 LOD
 
서울시 열린데이터 광장 문화관광 분야 LOD 서비스
서울시 열린데이터 광장 문화관광 분야 LOD 서비스서울시 열린데이터 광장 문화관광 분야 LOD 서비스
서울시 열린데이터 광장 문화관광 분야 LOD 서비스
 
LOD(Linked Open Data) Recommendations
LOD(Linked Open Data) RecommendationsLOD(Linked Open Data) Recommendations
LOD(Linked Open Data) Recommendations
 
Interlinking for Linked Data
Interlinking for Linked DataInterlinking for Linked Data
Interlinking for Linked Data
 
Linked Open Data Tutorial
Linked Open Data TutorialLinked Open Data Tutorial
Linked Open Data Tutorial
 
Linked Data Usecases
Linked Data UsecasesLinked Data Usecases
Linked Data Usecases
 
공공데이터와 Linked open data
공공데이터와 Linked open data공공데이터와 Linked open data
공공데이터와 Linked open data
 

Kürzlich hochgeladen

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Kürzlich hochgeladen (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Development of Twitter Application #5 - Users

  • 1. Linked Data & Semantic Web Technology Development of Twitter Applications Part 5. Users Dr. Myungjin Lee
  • 2. Linked Data & Semantic Web Technology Users • Users in Twitter – anyone or anything who tweets, follows, creates lists, has a home_timeline, can be mentioned, and can be looked up in bulk 2 followers: another Twitter user who has followed you following (frineds): the quantity of other Twitter users you have chosen to follow name: a name that can be different from your username and is used to locate you on Twitter scree name (user name): unique and fewer than 15 characters to identify you on Twitter for replies and mentions location description url profile image
  • 3. Linked Data & Semantic Web Technology REST API related to Users 3 Resource Description GET users/lookup Returns fully-hydrated user objects for up to 100 users per request, as specified by comma-separated values passed to the user_id and/or screen_name parameters. This method is especially useful when used in conjunction with collections of user IDs returned from GET friends/ids and GET followers/... GET users/show Returns a variety of information about the user specified by the required user_id or screen_name parameter. The author's most recent Tweet will be returned inline when possible. GET users/lookup is used to retrieve a bulk collection of user objects. GET users/search Provides a simple, relevance-based search interface to public user accounts on Twitter. Try querying by topical interest, full name, company name, location, or other criteria. Exact match searches are not supported. Only the first 1,000 matching results are available.
  • 4. Linked Data & Semantic Web Technology Users Primary Field Guide 4 Field Type Description created_at String The UTC datetime that the user account was created on Twitter description String Nullable. The user-defined UTF-8 string describing their account. entities Entities Entities which have been parsed out of the url or description fields defined by the user. favourites_count Int The number of tweets this user has favorited in the account's lifetime. followers_count Int The number of followers this account currently has. friends_count Int The number of users this account is following (AKA their "followings"). id Int64 The integer representation of the unique identifier for this User. id_str String The string representation of the unique identifier for this Tweet. lang String The BCP 47 code for the user's self-declared user interface language. listed_count Int The number of public lists that this user is a member of. location String Nullable. The user-defined location for this account's profile. name String The name of the user, as they've defined it. protected Boolean When true, indicates that this user has chosen to protect their Tweets. screen_name String The screen name, handle, or alias that this user identifies themselves with. status Tweets Nullable. If possible, the user's most recent tweet or retweet. statuses_count Int The number of tweets (including retweets) issued by the user. url String Nullable. A URL provided by the user in association with their profile.
  • 5. Linked Data & Semantic Web Technology Twitter4J Classes for Users • UsersResources Interface – Methods • ResponseList<User> lookupUsers(long[] ids) • ResponseList<User> searchUsers(String query, int page) • User showUser(long userId) • User showUser(String screenName) • User Interface – A data interface representing Basic user information element – Methods • Date getCreatedAt() • String getDescription() • int getFavouritesCount() • int getFollowersCount() • int getFriendsCount() • long getId() • String getLang() • int getListedCount() • String getLocation() • String getName() • String getProfileImageURL() • String getScreenName() • int getStatusesCount() • String getURL() 5
  • 6. Linked Data & Semantic Web Technology GET users/show • Resource URL – http://api.twitter.com/1.1/users/show.json • Parameters • Other Information – Requests per rate limit window: 180/user, 180/app – Authentication: Required – Response Object: Users – API Version: v1.1 user_id required The ID of the user for whom to return results for. Either an id or screen_name is required for this method. screen_name required The screen name of the user for whom to return results for. Either a id or screen_name is required for this method. include_entities optional The entities node will be disincluded when set to false. 6
  • 7. Linked Data & Semantic Web Technology Getting the User 1. import java.util.List; 2. import twitter4j.Twitter; 3. import twitter4j.TwitterException; 4. import twitter4j.TwitterFactory; 5. import twitter4j.User; 6. public class TwitterUser { 7. Twitter twitter = null; 8. public TwitterUser() { 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. TwitterUser tt = new TwitterUser (); 16. User user = tt.twitter.showUser("ACSpressroom"); 17. System.out.println(user.getId()); 18. System.out.println(user.getName()); 19. System.out.println(user.getScreenName()); 20. System.out.println(user.getDescription()); 21. System.out.println(user.getLocation()); 22. System.out.println(user.getURL()); 23. System.out.println(user.getProfileBackgroundImageURL()); 24. } 25. } 7
  • 8. Linked Data & Semantic Web Technology GET users/lookup • Resource URL – https://api.twitter.com/1.1/users/lookup.json • Parameters • Other Information – Requests per rate limit window: 180/user, 60/app – Authentication: Required – Response Object: Users – API Version: v1.1 user_id optional The ID of the user for whom to return results for. Either an id or screen_name is required for this method. screen_name optional The screen name of the user for whom to return results for. Either a id or screen_name is required for this method. include_entities optional The entities node will be disincluded when set to false. 8
  • 9. Linked Data & Semantic Web Technology Getting Users 1. public static void main(String args[]) throws TwitterException { 2. TwitterUser tt = new TwitterUser (); 3. String[] users = {"ACSpressroom", "AIP_Publishing", "PLoSNTDs"}; 4. List<User> userList = tt.twitter.lookupUsers(users); 5. for(int i = 0; i < userList.size(); i++) { 6. User user = userList.get(i); 7. System.out.println(user.getId()); 8. } 9. } 9
  • 10. Linked Data & Semantic Web Technology GET users/search • Resource URL – https://api.twitter.com/1.1/users/search.json • Parameters • Other Information – Requests per rate limit window: 180/user, 60/app – Authentication: Required – Response Object: Users – API Version: v1.1 q required The search query to run against people search. page optional Specifies the page of results to retrieve. count optional The number of potential user results to retrieve per page. This value has a maximum of 20. include_entities optional The entities node will be disincluded when set to false. 10
  • 11. Linked Data & Semantic Web Technology Searching Users 1. public static void main(String args[]) throws TwitterException { 2. TwitterUser tt = new TwitterUser (); 3. List<User> userList = tt.twitter.searchUsers("journal", 1); 4. for(int i = 0; i < userList.size(); i++) { 5. User user = userList.get(i); 6. System.out.println(user.getId() + ", " + user.getName()); 7. } 8. } 11
  • 12. Linked Data & Semantic Web Technology REST API related to Friends & Followers 12 Resource Description GET friends/ids Returns a cursored collection of user IDs for every user the specified user is following (otherwise known as their "friends"). At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues.... GET followers/ids Returns a cursored collection of user IDs for every user following the specified user. At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 5,000 user... GET friendships/lookup Returns the relationships of the authenticating user to the comma- separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none. GET friendships/show Returns detailed information about the relationship between two arbitrary users.
  • 13. Linked Data & Semantic Web Technology Twitter4J Classes for Friends & Followers • FriendsFollowersResources Interface – Methods • IDs getFollowersIDs(long cursor) • IDs getFollowersIDs(long userId, long cursor) • IDs getFollowersIDs(String screenName, long cursor) • IDs getFriendsIDs(long cursor) • IDs getFriendsIDs(long userId, long cursor) • IDs getFriendsIDs(String screenName, long cursor) • IDs – A data interface representing array of numeric IDs. – Methods • long[] getIDs() 13
  • 14. Linked Data & Semantic Web Technology GET friends/ids & followers/ids • Resource URL – https://api.twitter.com/1.1/friends/ids.json – https://api.twitter.com/1.1/followers/ids.json • Parameters • Other Information – Requests per rate limit window: 180/user, 60/app – Authentication: Required – Response Object: Users – 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. cursor semi-optional Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first "page." stringify_ids optional Many programming environments will not consume our Tweet ids due to their size. Provide this option to have ids returned as strings instead. count optional Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. The value of count is best thought of as a limit to the number of results to return. When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user's collection. Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response. 14
  • 15. Linked Data & Semantic Web Technology Getting Friends and Followers 1. public static void main(String args[]) throws TwitterException { 2. TwitterUser tt = new TwitterUser (); 3. IDs friends = tt.twitter.getFriendsIDs("ACSpressroom", -1); 4. System.out.println("friends:"); 5. long[] ids = friends.getIDs(); 6. for(int i = 0; i < ids.length; i++) { 7. System.out.println("t" + ids[i]); 8. } 9. IDs followers = tt.twitter.getFollowersIDs("ACSpressroom", -1); 10. ids = followers.getIDs(); 11. System.out.println("followers:"); 12. for(int i = 0; i < ids.length; i++) { 13. System.out.println("t" + ids[i]); 14. } 15. } 15