makeFromGDF()

9 views
Skip to first unread message

Jeroen Van hove

unread,
May 16, 2010, 1:53:50 PM5/16/10
to guess-discuss
Hi,
Whenever i try to load a gdf file for the first time using
makeFromGDF(filename) the graph loads fine but the seconds time it
always give me this error:

Exception in thread "AWT-EventQueue-0" java.lang.Error:
java.sql.SQLException: Unique constraint violation:
at com.hp.hpl.guess.db.DBServer.addNode(DBServer.java:2564)
at com.hp.hpl.guess.Graph.addNode(Graph.java:202)
at com.hp.hpl.guess.io.GDFReader.<init>(GDFReader.java:298)
at com.hp.hpl.guess.Graph.makeFromGDF(Graph.java:1984)
at main.GuessController.loadTopology(GuessController.java:306)
....

does anybody knows what i'm doing wrong?

--
You received this message because you are subscribed to the Google Groups "guess-discuss" group.
To post to this group, send email to guess-...@googlegroups.com.
To unsubscribe from this group, send email to guess-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guess-discuss?hl=en.

Jeroen Van hove

unread,
May 16, 2010, 2:40:21 PM5/16/10
to guess-discuss


hi again.

forgot to mention i tried this before:

Set edges = Guess.getGraph().getEdges();
for (Object o: edges) {
if (o instanceof Edge){
Edge e = (Edge)o;
gGraph.removeEdgeComplete(e);
}
}

and of course the same for the nodes.
This doesn't work because i'm changing the Set edges in the for loop
while i need this set to iterate over the objects.
so the Set edges can not change during the for loop.
do i make myself clear?

Jeroen

Jeroen Van hove

unread,
May 16, 2010, 2:48:09 PM5/16/10
to guess-discuss
I noticed that my question in the previous post wasn't very clear.
So i'm trying to find a solution for this:

>         Set edges = Guess.getGraph().getEdges();
>         for (Object o: edges) {
>                 if (o instanceof Edge){
>                         Edge e = (Edge)o;
>                         gGraph.removeEdgeComplete(e);
>                 }
>         }

Thanks

Jeroen Van hove

unread,
May 16, 2010, 3:04:00 PM5/16/10
to guess-discuss
Ok, I feel like a jurk now (please dont comment that :))

Set edges = Guess.getGraph().getEdges();
List<Integer> ids = new ArrayList<Integer>();
for (Object o: edges) {
if (o instanceof Edge){
Edge e = (Edge)o;
ids.add(e.getID());
}
}
for (Integer id : ids) {
Guess.getGraph().removeEdgeComplete(gGraph.getEdgeByID(id));
Reply all
Reply to author
Forward
0 new messages