Specification

The assignment is to design, implement, test, and document an application to analyse the results of a Facebook search using the Graph API: e.g. Trending Topics of Facebook Status Updates. A Facebook Status Update, sometimes referred to as a Post, allows users to post messages for their friends to read. In turn, friends can respond with their own comments, as well as clicking the "Like" button.1 Facebook users post all sorts of information in status updates and by examining the contents of and detecting which words appear frequently across posts we can detect trending topics. See below for more information on Facebook and the API that generate the list of posts used in this assignment:

Facebook: http://facebook.com

Wikipedia on Facebook: http://en.wikipedia.org/wiki/Facebook

Facebook Developer Graph API: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3

Facebook Graph API Post Object: https://developers.facebook.com/docs/graph-api/reference/v2.3/post

Phase 1 Detailed Description

The goal of phase 1 is to parse a Facebook Post data string in into a Post object. You will need to at least:

  • Create a Java class called FBPost to represent the contents of a Post (user, date, text, etc)
  • Create a Java class called FBPostParser that can take a JSONObject or a String and extract a list of posts from it
  • Create a Java class called FBPostParserException that extends Exception to indicate a parsing error
  • Connect the classes created to the supplied graphical user interface to load and display posts, as shown in Figure 1
  • Create unit tests for phase 1

Figure 1. See image.

Phase 2 Detailed Description

Phase 2 is to sort Posts by different features of your newly created Post object (e.g. User, Date, etc.). You will need to at least be able to sort Posts based on

  • the user,
  • the date, and
  • something to do with the message of the post (e.g. its length).

You can use the static methods of the utility class Collections to sort your posts.

Create further unit tests using the supplied data files to verify that your sorting works.

You will need to update the graphical user interface to reflect the changes you have made (i.e. being able to sort posts). Figure 2 is a very basic example of an updated graphical user interface. See image.

Phase 3 Detailed Description

The task of phase 3 is to implement a trending topic analyser for the list of posts. This amounts to indexing the word usage across the text of the posts. A simple way to do this is to count the number of times a single word appears in the list of posts. Figure 3 lists a pseudo code example for indexing the words used in posts.

SomeCollection words (this could be a set, list, map, etc)
for each post
for each word in post
if (word is in words)
increment count for word in words
else
add word to words and set count to 1
end
associate post with word
end
end

NOTE: in this example the word is not cleaned in anyway (e.g. all punctuation symbols are included in the word, twinkle, is NOT the same as twinkle) and it counts multiple occurrences of a word in a post. Your indexer should meet this specification. If you improve upon it you should still make available this implementation for testing.

Once indexed, you need to be able to

  • quickly find a word
  • find the count associated with a word,
  • find all the posts that use that word
  • find the word that is used the most
  • create a list of words sorted by their counts

You will need to use classes from the Collections framework such as Lists, Maps and Sets to implement this algorithm. You may need to create a new class to store the information about a word, e.g. the word itself, the count, the posts associated with it.

Create further unit tests using the supplied data files to verify that your trending topic algorithm works. The supplied data assumes the above algorithm is implemented as specified.

You will need to update the graphical user interface to allow the user to index the posts and display the results (e.g. Figure 4) See image.

Testing your Application

It is expected that you will thoroughly test your application using unit testing. The unit tests will not test your graphical user interface, but will test the classes you build to represent the posts and other pieces of data (e.g. words in the index, comparators, lists) and the functionality associated with them (sorting, find most used word, getting the user of post). This will make your underlying classes somewhat separate from your user interface and build a more robust and reusable application (e.g. you could use the classes with another user interface such as a mobile device).

You will be provided with a set of data files and the expected output that you can use in your unit tests.

Application description document

You should write a brief document to describe the features of your application. You can include text from this document, but most importantly you need to describe any additional features that you have implemented that might not be obvious. For example, include information on any interesting algorithms you implemented to index the posts.

This document can be thought of as an informal user guide.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.