Add a node

5 views
Skip to first unread message

Lorenz Rusch

unread,
Jul 30, 2010, 7:38:15 AM7/30/10
to guess-discuss
Hi,

I'm trying to write an expansion for Guess so that it is able to
collapse some nodes into one.

I have a problem however when adding a node.

StorageFactory.getSL().addNode(newNode);
Guess.getGraph().addNode(newNode);
StorageFactory.getSL().refresh(Guess.getGraph());

After this, the node is visible on the graph but when I try to use it
in the interpreter, I get:

Traceback (innermost last):
File " <string>", line 1, in ?
NameError: newnode

If a export to .gdf, close Guess and open it again with the exported
file. It doesn't give an error and I can use it.

Does anyone knows what I am doing wrong?

Eytan Adar

unread,
Jul 30, 2010, 9:26:21 AM7/30/10
to guess-...@googlegroups.com
You're breaking an abstraction barrier, graph.addNode(...) will call
the storage subsystem for you and take care of everything.

Something like:

Node newNode = Guess.getGraph().addNode("newnodename");

> --
> 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.
>
>

Lorenz Rusch

unread,
Jul 30, 2010, 9:31:44 AM7/30/10
to guess-...@googlegroups.com
Hi,

I tried with graph.addnode() but still the same problem. Still can't use the node in the interpreter.

2010/7/30 Eytan Adar <eyta...@gmail.com>

Eytan Adar

unread,
Jul 30, 2010, 9:48:02 AM7/30/10
to guess-...@googlegroups.com
Not sure, this is what I just ran in the interpreter:

g.addNode("foo")
foo.color = red

Are you trying to write your expansion in Java or Gython?

-E

Lorenz Rusch

unread,
Jul 31, 2010, 11:16:27 AM7/31/10
to guess-...@googlegroups.com
I'm writing in Java. So I'm not running in the interpreter..

2010/7/30 Eytan Adar <eyta...@gmail.com>
Reply all
Reply to author
Forward
0 new messages