//=== Generate a table of edges
public Table generateSecondEdgesTable(int newFocus, Paper[] dupeNodes)
{
int rowCount = 0;
Table edge_table = edgeSchema.instantiate();
//==== Loop through the duplicate nodes, creating edges to the new index
for (int i=0; i<Array.getLength(dupeNodes); i++)
{
//=== Add a row for the 'ref' type links
if(dupeNodes[i].getRefType().equals("REFERENCES"))
{
edge_table.addRow();
edge_table.setInt(rowCount, "source", newFocus);
edge_table.setInt(rowCount, "target", dupeNodes[i].getDefaultNodeKey());
//edge_table.setString(rowCount, "edgeType", "ref");
rowCount++;
}
//=== Add a row for the 'cit' type links
else if (dupeNodes[i].getRefType().equals("CITATIONS"))
{
edge_table.addRow();
edge_table.setInt(rowCount, "source", dupeNodes[i].getDefaultNodeKey());
edge_table.setInt(rowCount, "target", newFocus);
//edge_table.setString(rowCount, "edgeType", "cit");
rowCount++;
}
}
//==== Loop through all the new papers, adding an edge from each to the new index
for (int j=0; j<Array.getLength(paperList); j++)
{
//=== Add a row for the 'ref' type links
if(paperList[j].getRefType().equals("REFERENCES"))
{
edge_table.addRow();
edge_table.setInt(rowCount, "source", newFocus);
edge_table.setInt(rowCount, "target", this.paperList[j].getDefaultNodeKey());
//edge_table.setString(rowCount, "edgeType", "ref");
rowCount++;
}
//=== Add a row for the 'cit' type links
else if(paperList[j].getRefType().equals("CITATIONS"))
{
edge_table.addRow();
edge_table.setInt(rowCount, "source", this.paperList[j].getDefaultNodeKey());
edge_table.setInt(rowCount, "target", newFocus);
//edge_table.setString(rowCount, "edgeType", "cit");
rowCount++;
}
}