Re: [Neo4j] Get a NULL object with getVertex(string) API

27 views
Skip to first unread message

Marko Rodriguez

unread,
Sep 18, 2012, 4:43:04 PM9/18/12
to ne...@googlegroups.com
Hello,

> Object mystr1 = new String("888");
> Vertex = neo4jgraph.addVertex(mystr1);

You are not setting the variable to anything.

Do:

Vertex v = neo4jgraph.addVertex(null);

Marko.

http://markorodriguez.com

On Sep 18, 2012, at 2:16 PM, Tigerfish wrote:

> I have a Neo4jGraph object "neo4jgraph" and I am doing the following API.
>
> Object mystr1 = new String("888");
> Vertex = neo4jgraph.addVertex(mystr1);
>
> Somehow, neo4jgraph.getVertex(mystr1) returns NULL after the above API call.
>
> Did I miss something obvious?
>
> Note: the version I am using is community 1.8 M05.
>
> --
>
>

Tigerfish

unread,
Sep 18, 2012, 5:07:19 PM9/18/12
to ne...@googlegroups.com
:) Sorry for the cut & paste error. There is indeed a "Vertex v0= neo4jgraph.addVertex(mystr1); " in the code.
The original problem stands.

Thanks!

Marko Rodriguez

unread,
Sep 18, 2012, 5:09:19 PM9/18/12
to ne...@googlegroups.com
Hi,

Dunno.

Do:

System.out.println(neo4jgraph.toString())
Vertex v = neo4jgraph.addVertex(null);

The mystr1 won't do anything as Neo4j does not respect user-supplied IDs. It maintains its own long ID system. As you get more comfortable with Blueprints, you can use IdGraph wrapper to simulate your own ID system:


Good luck,
Marko.
--
 
 

Tigerfish

unread,
Sep 18, 2012, 6:04:49 PM9/18/12
to ne...@googlegroups.com
Thanks for your speedy response. Appreciate it. I don't have any problems using "neo4jgraph.addVertex(null)." It is a bit strange that neo4j silently disregards an argument.

Marko Rodriguez

unread,
Sep 18, 2012, 6:06:51 PM9/18/12
to ne...@googlegroups.com
Hi,

It has to do with Blueprints. Some Blueprints graphs support ID specification, other do not. Neo4j does not.

Marko.
--
 
 

Reply all
Reply to author
Forward
0 new messages