Bridges-Java  3.4.2
Bridges(Java API)
Public Member Functions | Package Functions | List of all members
bridges.connect.DataSource Class Reference

Detailed Description

This class is the main BRIDGES class that facilitates access to external datasets.

The DataSource class provides the BRIDGES API to all external datasets that are implemented in BRIDGES. These include earthquake data, song data, IMDB actor/movies, Wikidata, Gutenberg book collections, OpenStreet maps, Shakespeare, play, sonnets, poems, Cancer incidence data and IGN games Each dataset is accessed through a function call, which typically returns a list of objects with all associated attributes. These can then be used as part of a data structure, algorithm. Some initial support to import previously built data structures is also provided.

Public Member Functions

void setSourceType (String st)
 specify which server to use for accessing datasources. More...
 
Vector< CitygetUSCitiesData (HashMap< String, String > params) throws IOException
 Retrieves US city data based on a set of filtering parameters. More...
 
List< EarthquakeUSGSgetEarthquakeUSGSData (int maxElem) throws IOException
 
List< ShakespearegetShakespeareData () throws Exception
 This function provides access to a collection of Shakespeare plays, poems and plays. More...
 
List< ShakespearegetShakespeareData (String works, Boolean textOnly) throws Exception
 This function provides access to a collection of Shakespeare plays, poems and plays. More...
 
List< ShakespearegetShakespeareData (String works) throws Exception
 
List< CancerIncidencegetCancerIncidenceData () throws Exception
 
OsmData getOsmData (String location) throws IOException
 
OsmData getOsmData (String location, String level) throws IOException
 
OsmData getOsmData (double minLat, double minLon, double maxLat, double maxLon) throws IOException
 
OsmData getOsmData (double minLat, double minLon, double maxLat, double maxLon, String level) throws IOException
 
List< ActorMovieIMDBgetActorMovieIMDBData (int maxElem) throws IOException, IllegalArgumentException
 
List< ActorMovieIMDBgetActorMovieIMDBData2 () throws IOException
 
List< GamegetGameData () throws IOException
 
ArrayList< SonggetSongData () throws IOException
 
Song getSong (String songTitle, String artistName) throws IOException
 
Song getSong (String songTitle) throws IOException
 
Vector< AmenitygetAmenityData (String location, String amenity) throws IOException
 
Vector< AmenitygetAmenityData (double minLat, double minLon, double maxLat, double maxLon, String amenity) throws IOException
 
ElevationData getElevationData (double minLat, double minLon, double maxLat, double maxLon, double res) throws IOException
 This method retrieves the elevation map of a region given the lat/long range (bounding box) and resolution level. More...
 
List< GutenbergMetagetGutenbergBookMetaData (String term, String category) throws IOException
 Search the gutenberg data for retrieving meta data of books matching a string and a category. More...
 
GutenbergMeta getAGutenbergBookMetaData (int id) throws IOException
 
String getGutenbergBookText (int id) throws IOException
 
ArrayList< ActorMovieWikidatagetWikidataActorMovie (int yearBegin, int yearEnd) throws IOException
 This function returns the Movie and Actors playing in them between two years from WikiData. More...
 
ArrayList< RedditgetRedditData (String subreddit) throws IOException
 
ArrayList< RedditgetRedditData (String subreddit, int time_request) throws IOException
 
ArrayList< String > getAvailableSubreddits () throws IOException
 retrieves the subreddits made available by BRIDGES More...
 
String getAssignmentJSON (String user, int assignment, int subassignment) throws IOException
 
String getAssignmentJSON (String user, int assignment) throws IOException
 
ColorGrid getColorGridFromAssignment (String user, int assignment, int subassignment) throws IOException
 
ColorGrid getColorGridFromAssignment (String user, int assignment) throws IOException
 
ColorGrid getColorGridFromAssignment (String server, String user, int assignment, int subassignment) throws IOException
 Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server. More...
 
bridges.base.ColorGrid getColorGridFromAssignment (String server, String user, int assignment) throws IOException
 Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server. More...
 
String getAssignment (String server, String user, int assignment, int subassignment) throws IOException
 
String getAssignment (String server, String user, int assignment) throws IOException, Exception
 

Package Functions

 DataSource ()
 
 DataSource (Bridges b)
 

Constructor & Destructor Documentation

◆ DataSource() [1/2]

bridges.connect.DataSource.DataSource ( )
package

◆ DataSource() [2/2]

bridges.connect.DataSource.DataSource ( Bridges  b)
package

Member Function Documentation

◆ getActorMovieIMDBData()

List<ActorMovieIMDB> bridges.connect.DataSource.getActorMovieIMDBData ( int  maxElem) throws IOException, IllegalArgumentException

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

Check out the tutorial on the IMDB dataset at https://bridgesuncc.github.io/tutorials/Data_IMDB.html

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()

List<ActorMovieIMDB> bridges.connect.DataSource.getActorMovieIMDBData2 ( ) throws IOException

This helper function provides access to a second curated IMDB dataset; the data is retrieved, formatted into a list of ActorMovieIMDB objects

This version of the IMDB Actor/Movie data contains for each record, actor name, movie name, movie genres, movie rating; refer to

     https://bridgesuncc.github.io/datasets.html

for more information and to look at the dataset.

Check out the tutorial on the IMDB dataset at https://bridgesuncc.github.io/tutorials/Data_IMDB.html

Exceptions
Exceptionif the request fails
Returns
a list of ActorMovieIMDB objects

◆ getAGutenbergBookMetaData()

GutenbergMeta bridges.connect.DataSource.getAGutenbergBookMetaData ( int  id) throws IOException

This function is to retrieve a gutenberg book metadata from a book ID

A tutorial of how to use the Gutenberg data in BRIDGES is available: https://bridgesuncc.github.io/tutorials/Data_Gutenberg.html

Parameters
idis the id of the book you want to retrieve
Returns
a GutenbergMeta object of the book with the ID passed in

◆ getAmenityData() [1/2]

Vector<Amenity> bridges.connect.DataSource.getAmenityData ( double  minLat,
double  minLon,
double  maxLat,
double  maxLon,
String  amenity 
) throws IOException

This method retrieves the specified amenity related data given a bounding box of a region, from a Open Street map

Check out the tutorial on getting amenity data at https://bridgesuncc.github.io/tutorials/Data_Amenity.html

Parameters
minLatminimum latitude
minLonminimumm longitude
maxLatmaximum latitude
maxLonmaximum longitude
amenityamenity type
Exceptions
exception

◆ getAmenityData() [2/2]

Vector<Amenity> bridges.connect.DataSource.getAmenityData ( String  location,
String  amenity 
) throws IOException

This method retrieves the specified amenity related data given a location from a specified openstreet mmap location

Check out the tutorial on getting amenity data at https://bridgesuncc.github.io/tutorials/Data_Amenity.html

Parameters
locationcity/town from where amenity data is sought
amenityamenity type
Exceptions
exception

◆ getAssignment() [1/2]

String bridges.connect.DataSource.getAssignment ( String  server,
String  user,
int  assignment 
) throws IOException, Exception

◆ getAssignment() [2/2]

String bridges.connect.DataSource.getAssignment ( String  server,
String  user,
int  assignment,
int  subassignment 
) throws IOException

◆ getAssignmentJSON() [1/2]

String bridges.connect.DataSource.getAssignmentJSON ( String  user,
int  assignment 
) throws IOException

This function obtains the JSON representation of a particular subassignment.

Returns
a string that is the JSON representation of the subassignment as stored by the Bridges server.
Parameters
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get

◆ getAssignmentJSON() [2/2]

String bridges.connect.DataSource.getAssignmentJSON ( String  user,
int  assignment,
int  subassignment 
) throws IOException

This function obtains the JSON representation of a particular subassignment.

Returns
a string that is the JSON representation of the subassignment as stored by the Bridges server.
Parameters
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get
subassignmentthe ID of the subassignment to get

◆ getAvailableSubreddits()

ArrayList<String> bridges.connect.DataSource.getAvailableSubreddits ( ) throws IOException

retrieves the subreddits made available by BRIDGES

Returns
a list of strings of subreddit names

◆ getCancerIncidenceData()

List<CancerIncidence> bridges.connect.DataSource.getCancerIncidenceData ( ) throws Exception

This helper function provides access to a cancer dataset from CDC https://www.cdc.gov/cancer/npcr/uscs/download_data.htm and curated by Austin (Cory) Bart as part of the Corgis data collection https://think.cs.vt.edu/corgis/

Each record in this collection has a number of fields detailed in the CancerIncidence class.

For more information and to look at the data, refer to

     https://bridgesuncc.github.io/datasets.html

Refer to tutorial examples on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_CancerIncidence.html

Exceptions
Exceptionif the request fails
Returns
a list of Cancer incidence objects.

◆ getColorGridFromAssignment() [1/4]

bridges.base.ColorGrid bridges.connect.DataSource.getColorGridFromAssignment ( String  server,
String  user,
int  assignment 
) throws IOException

Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server.

Parameters
serverbase URL of the Bridges service
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get
Returns
the ColorGrid stored in the bridges server

◆ getColorGridFromAssignment() [2/4]

ColorGrid bridges.connect.DataSource.getColorGridFromAssignment ( String  server,
String  user,
int  assignment,
int  subassignment 
) throws IOException

Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server.

Parameters
serverbase URL of the Bridges service
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get
subassignmentthe ID of the subassignment to get
Returns
the ColorGrid stored in the bridges server

◆ getColorGridFromAssignment() [3/4]

ColorGrid bridges.connect.DataSource.getColorGridFromAssignment ( String  user,
int  assignment 
) throws IOException

Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server

Returns
the ColorGrid stored in the bridges server
Parameters
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get

◆ getColorGridFromAssignment() [4/4]

ColorGrid bridges.connect.DataSource.getColorGridFromAssignment ( String  user,
int  assignment,
int  subassignment 
) throws IOException

Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server

Returns
the ColorGrid stored in the bridges server
Parameters
userthe name of the user who uploaded the assignment
assignmentthe ID of the assignment to get
subassignmentthe ID of the subassignment to get

◆ getEarthquakeUSGSData()

List<EarthquakeUSGS> bridges.connect.DataSource.getEarthquakeUSGSData ( int  maxElem) throws IOException

This helper function provides a simple API to retrieve current USGS earthquake Tweet data from the USGS website (https://earthquake.usgs.gov/earthquakes/map/); The data is retrieved and formatted into a list of EarthquakeUSGS objects.

More information on the dataset can be found at https://bridgesuncc.github.io/datasets.html

Refer to the tutorial on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_EQ_USGS.html

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

◆ getElevationData()

ElevationData bridges.connect.DataSource.getElevationData ( double  minLat,
double  minLon,
double  maxLat,
double  maxLon,
double  res 
) throws IOException

This method retrieves the elevation map of a region given the lat/long range (bounding box) and resolution level.

Note that the ElevationData that is returned may have slightly different location and resolution.

A tutorial on how to use the Elevation dataset is available at: https://bridgesuncc.github.io/tutorials/Data_Elevation.html

Parameters
minLatminimum latitude requested
minLonminimum longitude requested
maxLatmaximum latitude requested
maxLonmaximum longitude requested
resspatial resolution, aka the distance between two samples (in degrees)
Returns
a ElevationData object mapping a region close to the box requested

◆ getGameData()

List<Game> bridges.connect.DataSource.getGameData ( ) throws IOException

This helper function provides access to the meta-data of the video game collection.

Each record in this collection has information on game title, platform, rating, and genre. For more information and to look at the data, refer to

     https://bridgesuncc.github.io/datasets.html

Refer to tutorial examples on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_IGN_Games.html

Exceptions
Exceptionif the request fails
Returns
a list of Game objects.

◆ getGutenbergBookMetaData()

List<GutenbergMeta> bridges.connect.DataSource.getGutenbergBookMetaData ( String  term,
String  category 
) throws IOException

Search the gutenberg data for retrieving meta data of books matching a string and a category.

Data is retrieved into a vector of book records.

A tutorial of how to use the Gutenberg data in bridges is presented here: https://bridgesuncc.github.io/tutorials/Data_Gutenberg.html

Parameters
terma string that matches the category
categorycategory can be any book attribute (title, genre, date, Library of Congress class, language)

◆ getGutenbergBookText()

String bridges.connect.DataSource.getGutenbergBookText ( int  id) throws IOException

This function gets the text of a gutenberg book based on the ID

A tutorial of how to use the Gutenberg data in BRIDGES is available: https://bridgesuncc.github.io/tutorials/Data_Gutenberg.html

Parameters
idis the id of the book you want the text of
Returns
a string of the book's text

◆ getOsmData() [1/4]

OsmData bridges.connect.DataSource.getOsmData ( double  minLat,
double  minLon,
double  maxLat,
double  maxLon 
) throws IOException

Generates Open Street Map URL request for a given set of coordinates with default level and returns the map data

Check out how to use OSM data at: https://bridgesuncc.github.io/tutorials/Data_OSM.html

Parameters
minLatminimum latitude value for the area requested
minLonminimum longitude value for the area requested
maxLatmaximum latitude value for the area requested
maxLonmaximum longitude value for the area requested
Returns
OsmData vertices and edges of Open Street Map data
Exceptions
IOExceptionIf there is an error parsing response from server or is an invalid location name

◆ getOsmData() [2/4]

OsmData bridges.connect.DataSource.getOsmData ( double  minLat,
double  minLon,
double  maxLat,
double  maxLon,
String  level 
) throws IOException

Generates Open Street Map URL request for a given set of coordinates with default level and returns the map data

Check out how to use OSM data at: https://bridgesuncc.github.io/tutorials/Data_OSM.html

Parameters
minLatminimum latitude value for the area requested
minLonminimum longitude value for the area requested
maxLatmaximum latitude value for the area requested
maxLonmaximum longitude value for the area requested
levelresolution at which the data is to be retrieved
Returns
OsmData vertices and edges of Open Street Map data
Exceptions
IOExceptionIf there is an error parsing response from server or is an invalid location name

◆ getOsmData() [3/4]

OsmData bridges.connect.DataSource.getOsmData ( String  location) throws IOException

Generates Open Street Map URL request for a given location at general level of details and returns the map data

Check out how to use OSM data at: https://bridgesuncc.github.io/tutorials/Data_OSM.html

Parameters
locationname of city or area that the server supports
Returns
OsmData vertices and edges of Open Street Map data
Exceptions
IOExceptionIf there is an error parsing response from server or is an invalid location name

◆ getOsmData() [4/4]

OsmData bridges.connect.DataSource.getOsmData ( String  location,
String  level 
) throws IOException

Generates Open Street Map URL request for a given location and returns the map data

Check out how to use OSM data at: https://bridgesuncc.github.io/tutorials/Data_OSM.html

Parameters
locationname of city or area that the server supports
levellevel of road detail on requested map
Returns
OsmData vertices and edges of Open Street Map data
Exceptions
IOExceptionIf there is an error parsing response from server or is an invalid location name

◆ getRedditData() [1/2]

ArrayList<Reddit> bridges.connect.DataSource.getRedditData ( String  subreddit) throws IOException
@brief retrieves the most recent reddit posts from a subreddit
Parameters
subredditthe name of the subreddit ( check list available at http://bridges-data-server-reddit.bridgesuncc.org/list or using getAvailableSubreddits() )
Returns
a list of reddit objects with the data of the posts

◆ getRedditData() [2/2]

ArrayList<Reddit> bridges.connect.DataSource.getRedditData ( String  subreddit,
int  time_request 
) throws IOException
@brief retrieves the reddit posts from a subreddit
Parameters
subredditthe name of the subreddit ( check list available at http://bridges-data-server-reddit.bridgesuncc.org/list or using getAvailableSubreddits() )
time_requestunix timestamp of when requested subreddit was generated or less than 0 for now
Returns
a list of reddit objects with the data of the posts

◆ getShakespeareData() [1/3]

List<Shakespeare> bridges.connect.DataSource.getShakespeareData ( ) throws Exception

This function provides access to a collection of Shakespeare plays, poems and plays.

This function return all the works of Shakespeare in the collection.

Each record in this collection has information on title, type (poem, Sonnet, play) and text.

For more information and to look at the data, refer to https://bridgesuncc.github.io/datasets.html

Refer to the tutorial on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_Shakespeare.html

Exceptions
Exceptionif the request fails
Returns
a list of Shakespeare objects.

◆ getShakespeareData() [2/3]

List<Shakespeare> bridges.connect.DataSource.getShakespeareData ( String  works) throws Exception

Refer to the tutorial on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_Shakespeare.html

◆ getShakespeareData() [3/3]

List<Shakespeare> bridges.connect.DataSource.getShakespeareData ( String  works,
Boolean  textOnly 
) throws Exception

This function provides access to a collection of Shakespeare plays, poems and plays.

Each record in this collection has information on title, type (poem, Sonnet, play) and text.

For more information and to look at the data, refer to https://bridgesuncc.github.io/datasets.html

This function returns only some of the works, either the plays, or the poems, depending on the parameters.

Refer to the tutorial on how to use this dataset: https://bridgesuncc.github.io/tutorials/Data_Shakespeare.html

Exceptions
Exceptionif the request fails
Parameters
worksreturn only some of the works. "Plays" for only the plays, "Poems", or "" for all.
Returns
a list of Shakespeare objects.

◆ getSong() [1/2]

Song bridges.connect.DataSource.getSong ( String  songTitle) throws IOException

These helper functions provides access to a particular song.

The record has information such as song title, artist, album, year, lyrics, and genre. For more information and to look at the data, refer to

     https://bridgesdata.herokuapp.com/api/datasets/songs

Refer to tutorial for example of using this feature: https://bridgesuncc.github.io/tutorials/Data_Song_Lyrics.html

Parameters
songTitletitle of song (string)
Exceptions
Exceptionif the request fails
Returns
a Song object.

◆ getSong() [2/2]

Song bridges.connect.DataSource.getSong ( String  songTitle,
String  artistName 
) throws IOException

These helper functions provides access to a particular song.

The record has information such as song title, artist, album, year, lyrics, and genre. For more information and to look at the data, refer to

     https://bridgesdata.herokuapp.com/api/datasets/songs

Parameters
songTitletitle of song (string)
artistNamename of artist (string), empty string for unspecified
Exceptions
Exceptionif the request fails
Returns
a Song object.

◆ getSongData()

ArrayList<Song> bridges.connect.DataSource.getSongData ( ) throws IOException

This helper function provides access to the meta-data of the lyrics collection.

Each record in this collection has information on song title, artist, album, year, lyrics, and genre. For more information and to look at the data, refer to

     https://bridgesdata.herokuapp.com/api/datasets/songs

Exceptions
Exceptionif the request fails
Returns
a list of Song objects.

◆ getUSCitiesData()

Vector<City> bridges.connect.DataSource.getUSCitiesData ( HashMap< String, String >  params) throws IOException

Retrieves US city data based on a set of filtering parameters.

Parameters
paramsthis represents a specification of the filtering parameters provided as a map. Multiple parameters will result in filtering as a combination (intersection) Available parameters and their types are as follows:

'city' : string 'state' : string 'country' : string 'time_zone' : string 'min_elev' : integer 'max_elev' : integer 'min_pop' : integer 'max_pop' : integer 'min_lat' : float 'min_long' : float 'max_lat' : float 'max_long' : float

◆ getWikidataActorMovie()

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

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

◆ setSourceType()

void bridges.connect.DataSource.setSourceType ( String  st)

specify which server to use for accessing datasources.

This is mostly useful for the BRIDGES team to debug issues with accessing data.

Parameters
stshould be "live", "testing", or "local"

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