Package: thinkmap.graph.fftable

Defines functions for loading flat-file data into a thinkmap graph

Examples:

Load data for a movie database from flat files: var graph = new thinkmap.graph.Graph(); loadCSV(); function loadCSV() { var fftable = thinkmap.graph.fftable; // return a future that is complete once nodes and edges are loaded return thinkmap.async.all( //load movie data into graph fftable.node('movie') //specify movieid as a key .keys({'movieid':true}) .intoGraph(graph) .data( thinkmap.data.csv().load('movie.csv')), //load directors into graph fftable.node('director').extend('person') // specify directorid as a key .keys({'directorid':true}) .intoGraph(graph) .data( thinkmap.data.csv().load('director.csv')) ).then ( function() { //once nodes are loaded, we can load the edges that connect them return fftable.edge('movie_director') // edge goes from movie to director .from('movie').to('director') // map the movieid column in this table to the movieid column // in the from table .fromKeys({'movieid':'movieid'}) // map the directorid column in this table to the directorid column // in the from table .toKeys({'directorid':'directorid'}) .intoGraph(graph) .data(thinkmap.data.csv().load('movie_director.csv')) } ); }

Functions