Error while performing WeakConnectivityDFS on restored DEX database

22 views
Skip to first unread message

dotas...@gmail.com

unread,
Sep 20, 2013, 5:18:18 PM9/20/13
to dex...@googlegroups.com
I've encountered an unexpected behavior in DEX. When I backup and restore a DEX database, followed by weak connectivity analysis, I get an error if any deletions took  place before the backup occurred. I may be making some kind of mistake, or this could be a bug.

I am running on Windows Vista 64. This is the exception:

java.lang.RuntimeException: [DEX: 12] Invalid object identifier.
at com.sparsity.dexjavawrapJNI.dex_algorithms_WeakConnectivityDFS_run(Native Method)
at com.sparsity.dex.algorithms.WeakConnectivityDFS.run(WeakConnectivityDFS.java:43)
at org.navigator.workspace.Workspace.dexBackupTest(Workspace.java:431)

This is code that produced it:

public boolean dexBackupTest(Dex dex)
{
System.out.println("DEX BACKUP TEST");
File tempFile;

try 
{
tempFile = File.createTempFile("graphPool",".temp");
String dexFile = tempFile.getAbsolutePath();

System.out.println("Dex file:" + dexFile);

Database database = dex.create(dexFile, "dex_test");

Session session = database.newSession();
session.begin();
Graph graph = session.getGraph();
int nodeType = graph.newNodeType("Test Node Type");
int indexAttribute = graph.newAttribute(nodeType, "Index", DataType.Integer, AttributeKind.Unique);
long nodeA = graph.newNode(nodeType);
int numNodes = 50;
int numEdges = 50;
for (int i = 0; i < numNodes; i++)
{
long node = graph.newNode(nodeType);
graph.setAttribute(node, indexAttribute, new Value().setInteger(i));
}

Random generator = new Random();


int edgeType = graph.newEdgeType("Default Edge", true, false);
for (int i = 0; i < numEdges; i++)
{

int indexHead = (int)(generator.nextDouble() * numNodes);
int indexTail = (int)(generator.nextDouble() * numNodes);

long head = graph.findObject(indexAttribute, new Value().setInteger(indexHead));
long tail = graph.findObject(indexAttribute, new Value().setInteger(indexTail));

graph.newEdge(edgeType, tail, head);
}

ArrayList<Long> toDelete = new ArrayList<Long>();
Objects objects = graph.select(edgeType);
for (long oid : objects)
{
if (generator.nextDouble() > .7)
{
toDelete.add(oid);
}
}
objects.close();
for (Long oid : toDelete)
{
graph.drop(oid);
}
session.commit();

graph.backup("backup.test");

session.close();
database.close();

Database restoredDatabase = dex.restore("restore.test", "backup.test");
Session restoredSession = restoredDatabase.newSession();

{
WeakConnectivityDFS connectivity = new WeakConnectivityDFS(restoredSession);
connectivity.addAllNodeTypes();
connectivity.addAllEdgeTypes();
connectivity.run();
connectivity.close();
}
restoredSession.close();
restoredDatabase.close();

catch (IOException e) 
{
e.printStackTrace();
return false;
}
return true;

}

dotas...@gmail.com

unread,
Sep 20, 2013, 5:19:02 PM9/20/13
to dex...@googlegroups.com
DEX version is 4.8.2

c3po.ac

unread,
Sep 26, 2013, 9:18:52 AM9/26/13
to dex...@googlegroups.com

Hi,

Your code is fine. There is a bug in the current release.
A new Dex release will be available next week with this issue solved.

Thank you!


El divendres 20 de setembre de 2013 23:19:02 UTC+2, dotas...@gmail.com va escriure:
DEX version is 4.8.2
Reply all
Reply to author
Forward
0 new messages