Exception when duplicating workspace through GraphModel.pushFrom()

Bug #686116 reported by Sébastien Heymann on 2010-12-06
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Won't Fix
Mathieu Bastian
Won't Fix

Bug Description

Way to reproduce with the toolkit:

1. Follow http://wiki.gephi.org/index.php/Toolkit_-_Metrics_over_time
2. Add the following code to copy a subgraph into a new workspace:

Graph currentGraphView = dynamicGraph.getSnapshotGraph(subinterval);

final Workspace newWorkspace = pc.newWorkspace(pc.getCurrentProject());
GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(newWorkspace);

An exception is raised:

java.lang.IllegalArgumentException: The column doesn't exist
        at org.gephi.data.attributes.AttributeRowImpl.setValue(AttributeRowImpl.java:73)
        at org.gephi.graph.dhns.core.DuplicateManager.duplicateNodeData(DuplicateManager.java:186)
        at org.gephi.graph.dhns.core.DuplicateManager.duplicate(DuplicateManager.java:62)
        at org.gephi.graph.dhns.core.Dhns.pushFrom(Dhns.java:429)
        at org.cnrs.lip6.radarmetrics.Application.execute(Application.java:149)
        at org.cnrs.lip6.radarmetrics.Main.main(Main.java:44)

With the debugger, I found that it occurs with the parameters:

So basically:
NodeDataImpl.getAttributes() returns a row that is unknown by AttributeTableImpl.getColumn().

Changed in gephi:
milestone: none → 0.7beta
tags: added: workspace

Another code to reproduce the bug, assuming that the CSV file contains an edge list:

//Init a project - and therefore a workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
Workspace workspace = pc.getCurrentWorkspace();

//Get controllers and models
ImportController importController = Lookup.getDefault().lookup(ImportController.class);

//Import file
Container container;
try {
    File file = new File("1.csv");
    container = importController.importFile(file);
    container.getLoader().setEdgeDefault(EdgeDefault.DIRECTED); //Force DIRECTED
    container.setAllowAutoNode(false); //Don't create missing nodes
} catch (Exception ex) {

//Initialize the DynamicProcessor - which will append the container to the workspace
DynamicProcessor dynamicProcessor = new DynamicProcessor();
dynamicProcessor.setDateMode(false); //Set 'true' if you set real dates (ex: yyyy-mm-dd), it's double otherwise
dynamicProcessor.setLabelmatching(false); //Set 'true' if node matching is done on labels instead of ids

//Set date for this file

//Process the container using the DynamicProcessor
importController.process(container, dynamicProcessor, workspace);

GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);

final Workspace newWorkspace = pc.newWorkspace(pc.getCurrentProject());
GraphModel newGm = Lookup.getDefault().lookup(GraphController.class).getModel(newWorkspace);

Changed in gephi:
assignee: nobody → Mathieu Bastian (mathieu.bastian)

Mainly for modularity reasons, you know that graph and attributes are separated in gephi. You may also know that you can write attribute values only if the column exists; and has therefore been created somehow.

The pushFrom method fails here because the columns haven't been created in the new workspace. Its a pity it doesn't take this classic issue in account and raise a proper exception.

Anyway, do that to duplicate the attribute model in the new workspace:

AttributeModel sourceAttributeModel = attributeController.getModel(currentWorkspace);
AttributeModel destAttributeModel = attributeController.getModel(newWorkspace);

Thanks, it solved the issue!

Changed in gephi:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers