statement.executeUpdate("create table edges (source string, target string, weight real)");
//Get the current graph in the defined workspace
GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
GraphModel graphModel = graphController.getModel(workspace);
Graph graph = graphModel.getGraphVisible();
//Count the number of tasks (nodes + edges) and start the progress
int tasks = graph.getNodeCount() + graph.getEdgeCount();
Progress.start(progress, tasks);
//Export nodes. Progress is incremented at each step.
for (Node n : graph.getNodes().toArray()) {
String id = n.getNodeData().getId();
String label = n.getNodeData().getLabel();
statement.executeUpdate("insert into nodes values('" + id + "', '" + label + "')");
if (cancel) {
return false;
}
Progress.progress(progress);
}
//Export edges. Progress is incremented at each step.
for (Edge e : graph.getEdges().toArray()) {
String sourceId = e.getSource().getNodeData().getId();
String targetId = e.getTarget().getNodeData().getId();
String weight = String.valueOf(e.getWeight());
statement.executeUpdate("insert into edges values('" + sourceId + "', '" + targetId + "', '" + weight + "')");
if (cancel) {