ESWC 2014 Tutorial Handson 1: Collect Data from Facebook
1. Social Web: Where are the Semantics?
ESWC 2014
Miriam Fernández, Victor Rodríguez,
Andrés García-Silva, Oscar Corcho
Ontology Engineering Group, UPM, Spain
Knowledge Media Institute, The Open University
2. 1.- Obtain a FB account
• If you don’t have already one ;)
ESWC 2014 Social Web: Where are the Semantics? 2
3. 2.- Register as developer
• https://developers.facebook.com/
ESWC 2014 Social Web: Where are the Semantics? 3
4. 3.- Create a new App
ESWC 2014 Social Web: Where are the Semantics? 4
5. 4.- Obtain your App ID and App Secret!
ESWC 2014 Social Web: Where are the Semantics? 5
6. 5.- Play a bit with the graph
ESWC 2014 Social Web: Where are the Semantics? 6
7. Now lets try to create our own APP
https://gist.github.com/miriamfs/b78a8b26ea0f2895788f
ESWC 2014 Social Web: Where are the Semantics? 7
8. To set up your project…you need three files
• FacebookDataCollector.java contains the code that you need to
download data from Facebook open groups or Facebook pages
• pom.xml contains the dependencies. If you prefer not to use a
maven project, just go to http://restfb.com/#download and
download the corresponding library [or ask for the usb]
• fbCollector.properties. This is the properties file that you need to
set up. You need to add:
– appId and appSecret. This are your facebook app's credentials.
– FbGroups and FbPages are the ids of groups and pages for which you want
to download information. If you have more than one group or one page,
please provide them separated by ",”
– maxPosts = maximum number of [initial] posts that you want to download for
each group/page. Note that for each initial posts all of its corresponding
comments will also be included in the download
ESWC 2014 Social Web: Where are the Semantics? 8
9. And you get three files ;)
• This program provides as output 3 files:
– posts.csv -> contains all the posts and comments that have been
downloaded including their text, time, user who generate them and
group or page from where they come from.
– replies.csv -> contains the reply change, i.e., information of which
posts have been generated as comments to other posts
– groups.csv -> contains information about the groups from which
information have been downloaded
ESWC 2014 Social Web: Where are the Semantics? 9
10. And if you don’t fancy to play with the code…
• Just execute it!
– java –jar fb_data_collector.jar ./fbCollector.properties
– And get the data!
ESWC 2014 Social Web: Where are the Semantics? 10