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

The Bridges class is the main class that provides interfaces to datasets, maintains user and assignment information, and connects to the Bridges server. More...

Public Member Functions

 Bridges ()
 
 Bridges (int assignment, String username, String appl_id)
 
void init (int assignment, String username, String appl_id)
 
void setTitle (String title)
 
void setDescription (String description)
 
void setServer (String server)
 
void setMapOverlay (Boolean flag)
 
void setDisplayMode (String mode) throws IllegalArgumentException
 
void setCoordSystemType (String coord)
 
boolean visualizeJSON ()
 
void setVisualizeJSON (boolean flag)
 
String getAssignmentJSON (String user, int assignment, int subassignment) throws IOException
 
String getAssignmentJSON (String user, int assignment) throws IOException
 
bridges.base.ColorGrid getColorGridFromAssignment (String user, int assignment, int subassignment) throws IOException
 
bridges.base.ColorGrid getColorGridFromAssignment (String user, int assignment) throws IOException
 
void setDataStructure (DataStruct ds) throws NullPointerException
 
void clearAssignment ()
 
void visualize () throws IOException, RateLimitException
 

Static Public Member Functions

static void setDebugFlag (Boolean flag)
 
static Boolean getDebugFlag ()
 
static List< EarthquakeUSGSgetEarthquakeUSGSData (int maxElements) throws Exception
 
static List< ActorMovieIMDBgetActorMovieIMDBData () throws Exception
 
static List< ActorMovieIMDBgetActorMovieIMDBData (int maxElements) throws Exception
 
static List< ActorMovieIMDBgetActorMovieIMDBData2 () throws Exception
 
static List< GutenbergBookgetGutenbergBookMetaData () throws Exception
 
static List< GamegetGameData () throws Exception
 
static List< SonggetSongData () throws Exception
 
static Song getSong (String songTitle) throws Exception
 
static Song getSong (String songTitle, String artistName) throws Exception
 
static List< ShakespearegetShakespeareData () throws Exception
 
static List< ShakespearegetShakespeareData (String works) throws Exception
 
static List< ShakespearegetShakespeareData (String works, Boolean textOnly) throws Exception
 
static ArrayList< CancerIncidencegetCancerIncidenceData () throws Exception
 
static bridges.data_src_dependent.OsmData getOsmData (String location) throws IOException
 
static String getAssignment ()
 
static int getAssignmentID ()
 
static void setAssignment (int assignment)
 
static String getUserName ()
 
static void setUserName (String userName)
 
static String getKey ()
 
static void setKey (String key)
 

Detailed Description

The Bridges class is the main class that provides interfaces to datasets, maintains user and assignment information, and connects to the Bridges server.

The Bridges class is responsible for initializing the Bridges system, specifying parameters (user id, assignment id, title, description, data structure type, etc) for the student assignment, generating the data structure representation and transmission to the Bridges server. In addition, it provides interfaces to a number of real-world datasets, that makes it easy to access the data for use algorithms/data structure assignments.

Datasets. The datasets that are currently supported through the BRIDGES API include USGS Earthquake Data, IMDB Actor/Movie Data (2 versions), Gutenberg Book Collection Meta Data, a Video Game Dataset and Shakespeare Dataset. More information is found in the respective methods (below) and at

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

A typical Bridges program includes creating the Bridges object, followed by creation of the data structure by the user, assigning visual attributes to elements of the data structure, followed by specification of teh data structure type and the call to visualize the data structure (Bridges::setDataStructure() and visualize() methods).

Author
Sean Gallagher, Kalpathi Subramanaian, Mihai Mehedint, David Burlinson.
Date
1/16/17, 5/19/17
See also
Tutorial examples at
http://bridgesuncc.github.io/Hello_World_Tutorials/Overview.html

Constructor & Destructor Documentation

◆ Bridges() [1/2]

bridges.connect.Bridges.Bridges ( )

Constructors

◆ Bridges() [2/2]

bridges.connect.Bridges.Bridges ( int  assignment,
String  username,
String  appl_id 
)

Initialize Bridges (Constructor)

Parameters
assignmentthis is the assignmen id (integer)
appl_idthis is the appl authentication key(from the Bridges account)
usernamethis is the username (from the Bridges account)

Member Function Documentation

◆ clearAssignment()

void bridges.connect.Bridges.clearAssignment ( )

This method deletes the user's current assignment from the Bridges server

Exceptions
IOException

◆ getActorMovieIMDBData() [1/2]

static List<ActorMovieIMDB> bridges.connect.Bridges.getActorMovieIMDBData ( ) throws Exception
static

This helper function provides access to a small curated IMDB dataset. The data is retrieved, formatted into a list of ActorMovieIMDB objects (about 1800 pairs).

This curated data set has only actor and movie name pairs. refer to

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

for more information and to look at the dataset.

Exceptions
Exceptionif the request fails
Returns
a list of ActorMovieIMDB objects, but only actor, movie, movie genre and movie rating are returned.

◆ getActorMovieIMDBData() [2/2]

static List<ActorMovieIMDB> bridges.connect.Bridges.getActorMovieIMDBData ( int  maxElements) throws Exception
static

◆ getActorMovieIMDBData2()

static List<ActorMovieIMDB> bridges.connect.Bridges.getActorMovieIMDBData2 ( ) throws Exception
static

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

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

for more information and to look at the dataset.

Exceptions
Exceptionif the request fails
Returns
a list of ActorMovieIMDB objects

◆ getAssignment()

static String bridges.connect.Bridges.getAssignment ( )
static

Get the assignment id

Returns
assignment as a string

◆ getAssignmentID()

static int bridges.connect.Bridges.getAssignmentID ( )
static

◆ getAssignmentJSON() [1/2]

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

◆ getAssignmentJSON() [2/2]

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

◆ getCancerIncidenceData()

static ArrayList<CancerIncidence> bridges.connect.Bridges.getCancerIncidenceData ( ) throws Exception
static

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

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

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

◆ getColorGridFromAssignment() [1/2]

bridges.base.ColorGrid bridges.connect.Bridges.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() [2/2]

bridges.base.ColorGrid bridges.connect.Bridges.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

◆ getDebugFlag()

static Boolean bridges.connect.Bridges.getDebugFlag ( )
static

◆ getEarthquakeUSGSData()

static List<EarthquakeUSGS> bridges.connect.Bridges.getEarthquakeUSGSData ( int  maxElements) throws Exception
static

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

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

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

◆ getGameData()

static List<Game> bridges.connect.Bridges.getGameData ( ) throws Exception
static

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

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

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

◆ getGutenbergBookMetaData()

static List<GutenbergBook> bridges.connect.Bridges.getGutenbergBookMetaData ( ) throws Exception
static

This helper function provides access to the meta-data of the Gutenberg book collection (about 1000 books); the data is retrieved, formatted into a list of GutenbergBook objects.

Each book in this collection has for each record, information on author (name, birth, death), title, languages, genres, subjects, metrics(number of chars, words, sentences, difficult words), url downloads. More information and commands to access the data can be found at

     http://bridgesuncc.github.io/datasets.html
for more information and to look at the dataset.

Exceptions
Exceptionif the request fails
Returns
a list of GutenbergBook objects

◆ getKey()

static String bridges.connect.Bridges.getKey ( )
static

Get application key

Returns
application key value (string)

◆ getOsmData()

static bridges.data_src_dependent.OsmData bridges.connect.Bridges.getOsmData ( String  location) throws IOException
static

Fetches Open Street Map data for a given location

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

◆ getShakespeareData() [1/3]

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

This helper 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

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

Exceptions
Exceptionif the request fails
Parameters
{String}[works] Valid input: "Plays" or "Poems". The works flag is optional.
{Boolean}[textOnly] True returns only words, no punctuation. The textOnly flag is optional.
Returns
a list of Shakespeare objects.

◆ getShakespeareData() [2/3]

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

◆ getShakespeareData() [3/3]

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

◆ getSong() [1/2]

static Song bridges.connect.Bridges.getSong ( String  songTitle) throws Exception
static

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

Exceptions
Exceptionif the request fails
Returns
a Song object.

◆ getSong() [2/2]

static Song bridges.connect.Bridges.getSong ( String  songTitle,
String  artistName 
) throws Exception
static

◆ getSongData()

static List<Song> bridges.connect.Bridges.getSongData ( ) throws Exception
static

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.

◆ getUserName()

static String bridges.connect.Bridges.getUserName ( )
static

This exists to prevent duplicate error traces.

Returns
user id (string)

◆ init()

void bridges.connect.Bridges.init ( int  assignment,
String  username,
String  appl_id 
)

Initialize Bridges

Parameters
assignmentthis is the assignmen id (integer)
appl_idthis is the appl authentication key(from the Bridges account)
usernamethis is the username (from the Bridges account)

◆ setAssignment()

static void bridges.connect.Bridges.setAssignment ( int  assignment)
static

set the assignment id

Parameters
assignmentnumber (int)

◆ setCoordSystemType()

void bridges.connect.Bridges.setCoordSystemType ( String  coord)
Parameters
coordthis is the desired coordinate space argument Options are: ['cartesian', 'albersusa', 'equirectangular'], and 'cartesian' is the default;

◆ setDataStructure()

void bridges.connect.Bridges.setDataStructure ( DataStruct  ds) throws NullPointerException
This method sets  the handle to the current data structure; this can

be an array, the head of a linked list, root of a tree structure, a graph Arrays of upto 3 dimensions are suppported. It can be any of the data structures supported by BRIDGES. Polymorphism and type casting is used to determine the actual data structure and extract its representtion.

Parameters
dsThe data structure to set (any of the subclasses of DataStruct)

◆ setDebugFlag()

static void bridges.connect.Bridges.setDebugFlag ( Boolean  flag)
static

◆ setDescription()

void bridges.connect.Bridges.setDescription ( String  description)
Parameters
descriptiondescription to annotate the visualization;

◆ setDisplayMode()

void bridges.connect.Bridges.setDisplayMode ( String  mode) throws IllegalArgumentException

Set the current assignment display mode to slide or stack, or throw an error;

Parameters
modeOne of: ['slide', 'stack'].

◆ setKey()

static void bridges.connect.Bridges.setKey ( String  key)
static

Set application key

Parameters
keyapplication key value (string)

◆ setMapOverlay()

void bridges.connect.Bridges.setMapOverlay ( Boolean  flag)

Turns on map overlay for subsequent visualizations - used with location specific datasets

Parameters
flagthis is the boolean flag for displaying a map overlay

◆ setServer()

void bridges.connect.Bridges.setServer ( String  server)
Parameters
serverserver to which to connect. Options are: ['live', 'local', 'clone'], and 'live' is the default;

◆ setTitle()

void bridges.connect.Bridges.setTitle ( String  title)

Bridges JSON Parameters

Parameters
titletitle used in the visualization;

◆ setUserName()

static void bridges.connect.Bridges.setUserName ( String  userName)
static

set User id

Parameters
userName(string)

◆ setVisualizeJSON()

void bridges.connect.Bridges.setVisualizeJSON ( boolean  flag)
Parameters
flagthe flag to print the JSON represenation of the data structure to standard output

◆ visualize()

void bridges.connect.Bridges.visualize ( ) throws IOException, RateLimitException

This method generates the representation of the current data structure (JSON) and sends that to the Bridges server for generating a visualization.

Exceptions
RateLimitException
IOException

◆ visualizeJSON()

boolean bridges.connect.Bridges.visualizeJSON ( )
Returns
check if the flag to output the JSON is set

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