Thought about that too, and while it's always node zero today, but who knows
what happens in some future rev with sharding, etc...I'd prefer it to be
opaque to the "how".  

-----Original Message-----
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On
Behalf Of Marko Rodriguez
Sent: Wednesday, December 15, 2010 11:26 AM
To: Neo4j user discussions
Subject: [SPAM] Re: [Neo4j] [SPAM] Re: [SPAM] Re: Reference node pains.

Hi,

> One reason: how to you obtain that reference node later?  Seems to me
you'd
> need to write some code to save the node id, index it, etc...

If the reference node (=the first node created) is always Vertex Id 0 as
Johan stated in a previous email as being the case, then you simply do:

Graph.getNodeById(0);

You can, of course, create your own method:

public Node getReferenceNode() {
   return graph.getNodeById(0);
}

> I don't understand why, for those that don't want a reference node, simply
> don't call "getReferenceNode()" (assuming the lazy creation logic is
added).
> ;-)

...assuming "lazy creation logic." (which is smart). 

Another argument could be the inverse of my previous email:

// I like the concept of a reference node
Graph graph = new Neo4j();

And for those that don't:

// I don't like the concept of a reference node
Graph graph = new Neo4j();
graph.removeNode(graph.getReferenceNode() || graph.getNodeById(0))

See ya,
Marko.
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to