Bridges-Java-2.3.3  2.3.3
Bridges(JavaAPI)
Static Public Member Functions | Protected Member Functions | List of all members
bridges.connect.DataFormatter Class Reference

Static Public Member Functions

static String getServerURL ()
 
static void setServerURL (String server_url)
 
static StringBuilder trimComma (StringBuilder in)
 
static List< FollowergetAssociations (Follower identifier, int max)
 
static List< TweetgetAssociations (TwitterAccount identifier, int max)
 
static List< EarthquakeUSGSgetAssociations (USGSaccount identifier, int max)
 
static List< EarthquakeTweetconvertTweet (List< Tweet > aList)
 
static List< ActorgetAssociations (Actor identifier, int max)
 
static List< MoviegetAssociations (Movie identifier, int max)
 
static List< Tweetnext (List< Tweet > aList, int max)
 
static List< EarthquakeUSGSnext (List< EarthquakeUSGS > aList, int max, USGSaccount acu)
 
static int validNumberOfTweets (int max)
 
static double getEdgeWeight (String source, String target)
 
static ArrayList< EarthquakeUSGSgetEarthquakeUSGSData (int maxElem) throws Exception
 
static ArrayList< ActorMovieIMDBgetActorMovieIMDBData (int maxElem) throws Exception, IllegalArgumentException
 
static ArrayList< ActorMovieIMDBgetActorMovieIMDBData2 () throws Exception
 
static ArrayList< GutenbergBookgetGutenbergBookMetaData () throws Exception
 
static ArrayList< GamegetGameData () throws Exception
 
static ArrayList< SonggetSongData () throws Exception
 
static Song getSong (String songTitle, String artistName) throws Exception
 
static ArrayList< ShakespearegetShakespeareData (String works, Boolean textOnly) throws Exception
 
static ArrayList< CancerIncidencegetCancerIncidenceData () throws Exception
 

Protected Member Functions

 DataFormatter ()
 
Connector getBackend ()
 
void setBackend (Connector backend)
 

Detailed Description

Connection to the DataFormatters server.

Initialize this class before using it, and call complete() afterward.

Author
Sean Gallagher
Parameters
<E>Mihai Mehedint

Constructor & Destructor Documentation

bridges.connect.DataFormatter.DataFormatter ( )
protected

Constructor

Member Function Documentation

static List<EarthquakeTweet> bridges.connect.DataFormatter.convertTweet ( List< Tweet aList)
static

This method change the tweet object into an earthquake tweet object with more data extracted from the tweet content, like magnitude

Parameters
aList
Returns
static ArrayList<ActorMovieIMDB> bridges.connect.DataFormatter.getActorMovieIMDBData ( int  maxElem) throws Exception, IllegalArgumentException
static

Get ActorMovie IMDB Data retrieved, formatted into a list of ActorMovieIMDB objects

Parameters
maxElementsthe number of actor/movie pairs
Exceptions
Exceptionif the request fails
Returns
a list of ActorMovieIMDB objects, but only actor and movie fields in this version
static ArrayList<ActorMovieIMDB> bridges.connect.DataFormatter.getActorMovieIMDBData2 ( ) throws Exception
static

Get ActorMovie IMDB Data retrieved, formatted into a list of ActorMovieIMDB objects

Exceptions
Exceptionif the request fails
Returns
a list of ActorMovieIMDB objects, consisting of actor name, movie name, movie genre and movie rating is returned.
static List<Follower> bridges.connect.DataFormatter.getAssociations ( Follower  identifier,
int  max 
)
static

Automatically choose whether to open a node identifier with: Twitter via followers(), TMDb with movies(), or RottenTomatoes with actors()

Parameters
identifier
max
Returns
a list of identifiers
Exceptions
QueryLimitExceptionThis Method returns the list of followers
Parameters
identifierholds the name of the
maxholds the max number of followers
Returns
static List<Tweet> bridges.connect.DataFormatter.getAssociations ( TwitterAccount  identifier,
int  max 
)
static

This Method returns the list of tweets

Parameters
identifierholds the name of the
maxholds the max number of tweets
Returns
Exceptions
MyExceptionClass
static List<EarthquakeUSGS> bridges.connect.DataFormatter.getAssociations ( USGSaccount  identifier,
int  max 
)
static

This Method returns the list of earthquakes

Parameters
identifierholds the name of the
maxholds the max number of earthquakes
Returns
Exceptions
MyExceptionClass
static List<Actor> bridges.connect.DataFormatter.getAssociations ( Actor  identifier,
int  max 
)
static

This Method returns the list of actors

Parameters
identifierholds the name of the movie
maxholds the max number of actors
Returns
static List<Movie> bridges.connect.DataFormatter.getAssociations ( Movie  identifier,
int  max 
)
static

This Method returns the list of movies

Parameters
identifierholds the name of the movie
maxholds the max number of movies
Returns
Connector bridges.connect.DataFormatter.getBackend ( )
protected
Returns
the backend
static ArrayList<CancerIncidence> bridges.connect.DataFormatter.getCancerIncidenceData ( ) throws Exception
static
static ArrayList<EarthquakeUSGS> bridges.connect.DataFormatter.getEarthquakeUSGSData ( int  maxElem) throws Exception
static

Get USGS earthquake data USGS Tweet data (https://earthquake.usgs.gov/earthquakes/map/) retrieved, formatted into a list of EarthquakeUSGS objects

Parameters
nameUSGS account name - must be "earthquake" to create account
maxElementsthe number of earthquake records retrieved, limited to 5000
Exceptions
Exceptionif the request fails
Returns
a list of earthquake records
static double bridges.connect.DataFormatter.getEdgeWeight ( String  source,
String  target 
)
static

Generate a sample Edge weight for two nodes

Parameters
source
target
Returns
static ArrayList<Game> bridges.connect.DataFormatter.getGameData ( ) throws Exception
static

Get meta data of the IGN games collection.

This function retrieves and formats the data into a list of Game objects

Exceptions
Exceptionif the request fails
Returns
a list of Game objects,
static ArrayList<GutenbergBook> bridges.connect.DataFormatter.getGutenbergBookMetaData ( ) throws Exception
static

Get meta data of the Gutenberg book collection (1000 books) This function retrieves, and formats the data into a list of GutenbergBook objects

Exceptions
Exceptionif the request fails
Returns
a list of GutenbergBook objects,
static String bridges.connect.DataFormatter.getServerURL ( )
static
static ArrayList<Shakespeare> bridges.connect.DataFormatter.getShakespeareData ( String  works,
Boolean  textOnly 
) throws Exception
static

Get data of Shakespeare works (plays, poems)

This function retrieves and formats the data into a a list of Shakespeare objects.

Exceptions
Exceptionif the request fails
Parameters
workscan be either "plays" or "poems". If this is specified, then only these types of works are retrieved.
textOnlyif this is set, then only the text is retrieved.
Returns
an array of Shakespeare objects
static Song bridges.connect.DataFormatter.getSong ( String  songTitle,
String  artistName 
) throws Exception
static

Get data of a particular songs (including lyrics) using the Genius API (https://docs.genius.com/), given the song title and artist name.

This function retrieves and formats the data into a Song object. The song if not cached in the local DB is queried and added to the DB

Exceptions
Exceptionif the request fails
Returns
a Song object,
static ArrayList<Song> bridges.connect.DataFormatter.getSongData ( ) throws Exception
static

Get data of the songs (including lyrics) using the Genius API https://docs.genius.com/

This function retrieves and formats the data into a list of Song objects. This version of the API retrieves all the cached songs in the local DB.

Exceptions
Exceptionif the request fails
Returns
a list of Song objects,
static List<Tweet> bridges.connect.DataFormatter.next ( List< Tweet aList,
int  max 
)
static

The next(List<Tweet>, int) method retrieves the next batch of tweets and adds deep copy of those tweets to the current list

Parameters
aListholds the reference to the current list of tweets
maxthe number of tweets in the new batch of tweets
Returns
the list of tweets containing the old and the new batch of tweets
Exceptions
MyExceptionClass
static List<EarthquakeUSGS> bridges.connect.DataFormatter.next ( List< EarthquakeUSGS aList,
int  max,
USGSaccount  acu 
)
static

The next(List<EarthquakeUSGS>, int) method retrieves the next batch of eq and adds deep copy of those eq to the current list

Parameters
aListholds the reference to the current list of eq
maxthe number of eq in the new batch of eq
Returns
the list of eq containing the old and the new batch of tweets
Exceptions
MyExceptionClass
void bridges.connect.DataFormatter.setBackend ( Connector  backend)
protected
Parameters
backendthe backend to set
static void bridges.connect.DataFormatter.setServerURL ( String  server_url)
static
static StringBuilder bridges.connect.DataFormatter.trimComma ( StringBuilder  in)
static

Internal method for JSON preparation

Parameters
inThe original string
Returns
a string with all but the last character
static int bridges.connect.DataFormatter.validNumberOfTweets ( int  max)
static

Check the validity of number of Tweets requested

Parameters
maxthe number of tweets
Returns
returns true if the number is in the range 0 - 500
Exceptions
MyExceptionClassotherwise

The documentation for this class was generated from the following file: