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

Detailed Description

Connection to the DataFormatters server.

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

Author
Sean Gallagher, Mihai Mehedint

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 IOException
 
static ArrayList< ActorMovieIMDBgetActorMovieIMDBData (int maxElem) throws IOException, IllegalArgumentException
 
static ArrayList< ActorMovieIMDBgetActorMovieIMDBData2 () throws IOException
 
static ArrayList< GutenbergBookgetGutenbergBookMetaData () throws IOException
 
static ArrayList< GamegetGameData () throws IOException
 
static ArrayList< SonggetSongData () throws IOException
 
static Song getSong (String songTitle, String artistName) throws IOException
 
static ArrayList< ActorMovieWikidatagetWikidataActorMovie (int yearBegin, int yearEnd) throws IOException
 This function returns the Movie and Actors playing in them between two years from WikiData. More...
 
static ArrayList< ShakespearegetShakespeareData (String works, Boolean textOnly) throws IOException
 
static ArrayList< CancerIncidencegetCancerIncidenceData () throws IOException
 

Protected Member Functions

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

Constructor & Destructor Documentation

◆ DataFormatter()

bridges.connect.DataFormatter.DataFormatter ( )
protected

Constructor

Member Function Documentation

◆ convertTweet()

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

◆ getActorMovieIMDBData()

static ArrayList<ActorMovieIMDB> bridges.connect.DataFormatter.getActorMovieIMDBData ( int  maxElem) throws IOException, IllegalArgumentException
static

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

Parameters
maxElemthe 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

◆ getActorMovieIMDBData2()

static ArrayList<ActorMovieIMDB> bridges.connect.DataFormatter.getActorMovieIMDBData2 ( ) throws IOException
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.

◆ getAssociations() [1/5]

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

◆ getAssociations() [2/5]

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

◆ getAssociations() [3/5]

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

◆ getAssociations() [4/5]

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

◆ getAssociations() [5/5]

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

◆ getBackend()

Connector bridges.connect.DataFormatter.getBackend ( )
protected
Returns
the backend

◆ getCancerIncidenceData()

static ArrayList<CancerIncidence> bridges.connect.DataFormatter.getCancerIncidenceData ( ) throws IOException
static

◆ getEarthquakeUSGSData()

static ArrayList<EarthquakeUSGS> bridges.connect.DataFormatter.getEarthquakeUSGSData ( int  maxElem) throws IOException
static

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

Parameters
maxElemthe number of earthquake records retrieved, limited to 5000
Exceptions
Exceptionif the request fails
Returns
a list of earthquake records

◆ getEdgeWeight()

static double bridges.connect.DataFormatter.getEdgeWeight ( String  source,
String  target 
)
static

Generate a sample Edge weight for two nodes

Parameters
source
target
Returns

◆ getGameData()

static ArrayList<Game> bridges.connect.DataFormatter.getGameData ( ) throws IOException
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,

◆ getGutenbergBookMetaData()

static ArrayList<GutenbergBook> bridges.connect.DataFormatter.getGutenbergBookMetaData ( ) throws IOException
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,

◆ getServerURL()

static String bridges.connect.DataFormatter.getServerURL ( )
static

◆ getShakespeareData()

static ArrayList<Shakespeare> bridges.connect.DataFormatter.getShakespeareData ( String  works,
Boolean  textOnly 
) throws IOException
static

Get data of Shakespeare works (plays, poems)

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

Exceptions
IOExceptionif 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

◆ getSong()

static Song bridges.connect.DataFormatter.getSong ( String  songTitle,
String  artistName 
) throws IOException
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,

◆ getSongData()

static ArrayList<Song> bridges.connect.DataFormatter.getSongData ( ) throws IOException
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,

◆ getWikidataActorMovie()

static ArrayList<ActorMovieWikidata> bridges.connect.DataFormatter.getWikidataActorMovie ( int  yearBegin,
int  yearEnd 
) throws IOException
static

This function returns the Movie and Actors playing in them between two years from WikiData.

Parameters
yearBegininclusive start year
yearEndinclusive end year
Returns
ArrayList of all ActorMovie pairs in Wikidata between the years provided
Exceptions
IOExceptionIf the response from WikiData is malformed or an issue occurs making the request

◆ next() [1/2]

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

◆ next() [2/2]

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
acuUSGSaccount information
Returns
the list of eq containing the old and the new batch of tweets

◆ setBackend()

void bridges.connect.DataFormatter.setBackend ( Connector  backend)
protected
Parameters
backendthe backend to set

◆ setServerURL()

static void bridges.connect.DataFormatter.setServerURL ( String  server_url)
static

◆ trimComma()

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

◆ validNumberOfTweets()

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

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