Can I have controll over the GeomNode id?

41 views
Skip to first unread message

Eugen Paraschiv

unread,
May 6, 2012, 12:45:42 PM5/6/12
to ne...@googlegroups.com
I'm using Neo4J 1.6.2 and Neo4J Spatial 0.8.
I'm working against the SimplePointLayer and adding a (lat,long) via add(double x, double y)
The Node associated with the location and returned in the SpatialDatabaseRecord has an id, which is generated by the IdGenerator.
My question is: is there any way to pass in my own ids (unique) or control this process in any way?
Thanks.
Eugen.

Peter Neubauer

unread,
May 6, 2012, 1:57:42 PM5/6/12
to ne...@googlegroups.com

Eugen,
Right now we are taking the default node ids, but I think some custom property to use instead, like your own I'd, could be used. Also, I'd you get back your domain node, you could just read it out again?

Eugen Paraschiv

unread,
May 7, 2012, 8:29:54 AM5/7/12
to ne...@googlegroups.com
OK, so first, on the custom property you mention, how would I use that to gain control of the id generation process. As far as I can tell, the ids get generated automatically and I couldn't find a way to control the process. Is there any example for this one?
Next, let me give you some more background of why I would want to do this: I have 2 nodes, both running neo4j and I'm indexing a location (lat,long) in both of them; each one will assign it's own id to that location, so the id's I'm getting back are different. If I could set the ids myself, I would be able to generate an id (manually, and ensure it's unique) and then pass it into the index operation on both machines, so that they both end up using the same id.
Hopefully that clarifies the usecase and what kind of control I need related to ids.
Thanks.
Eugen.

Peter Neubauer

unread,
May 7, 2012, 9:40:07 AM5/7/12
to ne...@googlegroups.com
Mmh,
so you are saying if lat/lon are the same, then the indexed geometry
node should be the same? You could of course do some custom structure
and do exactly that - attaching your POI to the same Location node
that then gets indexed only once? Not sure I understand why having
your custom IDs would help you here.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j

Eugen Paraschiv

unread,
May 7, 2012, 9:45:48 AM5/7/12
to ne...@googlegroups.com
So, I didn't expect Neo4J to assign the same id based on the fact that lat,long were the same. That's what I want, but I don't expect that to be the default behaviour. What I am going for is controlling that behaviour (setting the id) manually, from the outside. The reason that would help is that I'm adding the geo point (lat,long) to neo4j and then I'm storing the id somewhere else, so that I can later on work with it. In Neo4J spatial, most if not all operations are related to this geom id - for instance, delete is by id, so in order to delete the node, I need to keep track of this id. 
If each server will assign it's own id, then I will need to store all of these, whereas if I can specify a single id, then I only need to store that one.
Thanks for the feedback.
Eugen.

Peter Neubauer

unread,
May 10, 2012, 9:41:51 AM5/10/12
to ne...@googlegroups.com
Right,
so you want to federate the same lon/lat geometry point over several
servers and attach different domain nodes to it in the different
graphs? Sorry, I am not totally clear over how you are using it. Maybe
we could even Skype?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j


Craig Taverner

unread,
May 10, 2012, 10:15:25 AM5/10/12
to ne...@googlegroups.com
My 2 cents:

It sounds like you want two databases to have the same id space. In that case, you should use HA.

If, instead you want two databases to have only parts of the graph shared, and other parts different, then it gets more complex. In that case I agree with Peter, you need to explain your actual use case so he (or I, or someone else) can recommend a solution. A key questions to answer: why do you have two servers? What is the purpose: redundancy, sharding, different apps?

I also think this question is not specific to neo4j-spatial, but to neo4j in general. The concept of controlling the node-id from the app. In principle it cannot, or even should not be done. I suspect your reasons for wanting this are based on a use case or feature that might be satisfied in some other way.
Reply all
Reply to author
Forward
0 new messages