Bridges-Java
3.4.3
Bridges(Java API)
|
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< City > | getUSCitiesData (HashMap< String, String > params) throws IOException |
Retrieves US city data based on a set of filtering parameters. More... | |
List< EarthquakeUSGS > | getEarthquakeUSGSData (int maxElem) throws IOException |
List< Shakespeare > | getShakespeareData () throws Exception |
This function provides access to a collection of Shakespeare plays, poems and plays. More... | |
List< Shakespeare > | getShakespeareData (String works, Boolean textOnly) throws Exception |
This function provides access to a collection of Shakespeare plays, poems and plays. More... | |
List< Shakespeare > | getShakespeareData (String works) throws Exception |
List< CancerIncidence > | getCancerIncidenceData () 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< ActorMovieIMDB > | getActorMovieIMDBData (int maxElem) throws IOException, IllegalArgumentException |
List< ActorMovieIMDB > | getActorMovieIMDBData2 () throws IOException |
List< Game > | getGameData () throws IOException |
ArrayList< Song > | getSongData () throws IOException |
Song | getSong (String songTitle, String artistName) throws IOException |
Song | getSong (String songTitle) throws IOException |
Vector< Amenity > | getAmenityData (String location, String amenity) throws IOException |
Vector< Amenity > | getAmenityData (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< GutenbergMeta > | getGutenbergBookMetaData (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< ActorMovieWikidata > | getWikidataActorMovie (int yearBegin, int yearEnd) throws IOException |
This function returns the Movie and Actors playing in them between two years from WikiData. More... | |
ArrayList< Reddit > | getRedditData (String subreddit) throws IOException |
ArrayList< Reddit > | getRedditData (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) | |
|
package |
|
package |
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
maxElem | the number of actor/movie pairs |
Exception | if the request fails |
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
Exception | if the request fails |
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
id | is the id of the book you want to retrieve |
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
minLat | minimum latitude |
minLon | minimumm longitude |
maxLat | maximum latitude |
maxLon | maximum longitude |
amenity | amenity type |
exception |
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
location | city/town from where amenity data is sought |
amenity | amenity type |
exception |
String bridges.connect.DataSource.getAssignment | ( | String | server, |
String | user, | ||
int | assignment | ||
) | throws IOException, Exception |
String bridges.connect.DataSource.getAssignment | ( | String | server, |
String | user, | ||
int | assignment, | ||
int | subassignment | ||
) | throws IOException |
String bridges.connect.DataSource.getAssignmentJSON | ( | String | user, |
int | assignment | ||
) | throws IOException |
This function obtains the JSON representation of a particular subassignment.
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
String bridges.connect.DataSource.getAssignmentJSON | ( | String | user, |
int | assignment, | ||
int | subassignment | ||
) | throws IOException |
This function obtains the JSON representation of a particular subassignment.
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
subassignment | the ID of the subassignment to get |
ArrayList<String> bridges.connect.DataSource.getAvailableSubreddits | ( | ) | throws IOException |
retrieves the subreddits made available by BRIDGES
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
Exception | if the request fails |
bridges.base.ColorGrid bridges.connect.DataSource.getColorGridFromAssignment | ( | String | server, |
String | user, | ||
int | assignment | ||
) | throws IOException |
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.
server | base URL of the Bridges service |
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
subassignment | the ID of the subassignment to get |
ColorGrid bridges.connect.DataSource.getColorGridFromAssignment | ( | String | user, |
int | assignment | ||
) | throws IOException |
Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
ColorGrid bridges.connect.DataSource.getColorGridFromAssignment | ( | String | user, |
int | assignment, | ||
int | subassignment | ||
) | throws IOException |
Reconstruct a ColorGrid from an existing ColorGrid on the Bridges server
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
subassignment | the ID of the subassignment to get |
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
maxElem | the number of earthquake records retrieved, limited to 5000 |
Exception | if the request fails |
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
minLat | minimum latitude requested |
minLon | minimum longitude requested |
maxLat | maximum latitude requested |
maxLon | maximum longitude requested |
res | spatial resolution, aka the distance between two samples (in degrees) |
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
Exception | if the request fails |
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
term | a string that matches the category |
category | category can be any book attribute (title, genre, date, Library of Congress class, language) |
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
id | is the id of the book you want the text of |
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
minLat | minimum latitude value for the area requested |
minLon | minimum longitude value for the area requested |
maxLat | maximum latitude value for the area requested |
maxLon | maximum longitude value for the area requested |
IOException | If there is an error parsing response from server or is an invalid location name |
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
minLat | minimum latitude value for the area requested |
minLon | minimum longitude value for the area requested |
maxLat | maximum latitude value for the area requested |
maxLon | maximum longitude value for the area requested |
level | resolution at which the data is to be retrieved |
IOException | If there is an error parsing response from server or is an invalid location name |
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
location | name of city or area that the server supports |
IOException | If there is an error parsing response from server or is an invalid location name |
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
location | name of city or area that the server supports |
level | level of road detail on requested map |
IOException | If there is an error parsing response from server or is an invalid location name |
ArrayList<Reddit> bridges.connect.DataSource.getRedditData | ( | String | subreddit | ) | throws IOException |
@brief retrieves the most recent reddit posts from a subreddit
subreddit | the name of the subreddit ( check list available at http://bridges-data-server-reddit.bridgesuncc.org/list or using getAvailableSubreddits() ) |
ArrayList<Reddit> bridges.connect.DataSource.getRedditData | ( | String | subreddit, |
int | time_request | ||
) | throws IOException |
@brief retrieves the reddit posts from a subreddit
subreddit | the name of the subreddit ( check list available at http://bridges-data-server-reddit.bridgesuncc.org/list or using getAvailableSubreddits() ) |
time_request | unix timestamp of when requested subreddit was generated or less than 0 for now |
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
Exception | if the request fails |
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
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
Exception | if the request fails |
works | return only some of the works. "Plays" for only the plays, "Poems", or "" for all. |
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/song
Refer to tutorial for example of using this feature: https://bridgesuncc.github.io/tutorials/Data_Song_Lyrics.html
songTitle | title of song (string) |
Exception | if the request fails |
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/song
songTitle | title of song (string) |
artistName | name of artist (string), empty string for unspecified |
Exception | if the request fails |
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/song
Exception | if the request fails |
Vector<City> bridges.connect.DataSource.getUSCitiesData | ( | HashMap< String, String > | params | ) | throws IOException |
Retrieves US city data based on a set of filtering parameters.
params | this 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
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.
yearBegin | inclusive start year |
yearEnd | inclusive end year |
IOException | If the response from WikiData is malformed or an issue occurs making the request |
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.
st | should be "live", "testing", or "local" |