Re: [Neo4j] Reference node and best practice

308 views
Skip to first unread message

Julian Simpson

unread,
Jul 27, 2012, 4:05:55 AM7/27/12
to ne...@googlegroups.com
Hi,

On Fri, Jul 27, 2012 at 6:49 AM, S B <stefan...@rechaoss.com> wrote:
Hi,
being quite new to neo4j and graph databases in general I'm struggling a lot to grasp the product and different concepts (traverse vs. traversal, cypher, gremlin). But there is one thing that startles me, the reference node.

As I read on github [1], the reference node is now not created by default (I understand the motivation to start with an empty database) but that raises two questions for me :
* How do I create a reference node? I think it's impossible through REST and I don't know how to do it with neo4j.py

The reference node should still be there, with ID 0.  But we don't recommend that you use it,
 
* If I'm not using a reference node, what is the best practice or a use case to find my top nodes?

Indexes help you find nodes - when you create them, put them in an index.  That should be very easy with the python tools.

Cheers

Julian.


In your answers, keep in mind that I'm accessing neo4j through python (either neo4.py or neo4jrestclient).

Stefan




--
Julian Simpson 
Software Engineer | Neo Technology
+447967189579 | @builddoctor
As a friend of Neo, register for GraphConnect and get a 20% discount. Code: GCFON

Javier de la Rosa

unread,
Jul 27, 2012, 10:55:16 AM7/27/12
to ne...@googlegroups.com
On Fri, Jul 27, 2012 at 4:05 AM, Julian Simpson
<julian....@neotechnology.com> wrote:
> Indexes help you find nodes - when you create them, put them in an index.
> That should be very easy with the python tools.

Using neo4jrestclient, you can do:

>>> n = gdb.nodes.create(type="important", label="This should be a top node")

>>> idx = gdb.nodes.indexes.create(name="reference_nodes", type="fulltext")

>>> idx["type"]["important"] = n

>>> idx.query("type", "important")[:]
[<Neo4j Node: http://localhost:7474/db/data/node/1>]


--
Javier de la Rosa
http://versae.es
Reply all
Reply to author
Forward
0 new messages