Thanks Benjamin for the elaborate answer, 

You are exactly got my point, each object is a tree. I use neo4j spatial 
plugin to 

create the objects (I am using neo4j 2.1.2 with the same spatial plugin 
version). 

I use Neo4j java API for creating the graph (I am not using Cypher, do you 

suggest otherwise, i.e., to use Cypher from Java for graph import?), so I 
can 

use the following snippet to set label for nodes:

Label myLabel = DynamicLabel.label("Label_Name");
myNode.addLabel(myLabel);   

Now my questions are: 

1- which approach will be more efficient to do? 

2- regarding the label to be auto-indexed, then I need only an spatial 
index and that would be enough, right?

Best,
Alireza


On Monday, July 21, 2014 4:32:48 PM UTC+2, Benjamin Makus wrote:
>
> That sound's like you've got a tree (or several trees), and it looks like:
>                ROOT-NODE
>               /    |    \
> (layer1)    A1     A2    A3
>            /  \    |     |
> (layer2) B1   B2   B3    B4
>                   /  \
> (layer3)         C1  C2
> Something like this? 
>
> Now you can of course say something like "start at root-node, go 2 levels 
> deep and return all found nodes", in this case, you would get B1, B2, B3 
> and B4. Also you could say "start at B3 and go 1 levels deep" this would 
> return C1 and C2.
>
> Regarding your spatial layer: The question is: What kind oft 
> framework/tool do you use to create those Geometry objects? If that 
> software is only compatible with Neo4j 1.x, but not 2.x then it will not be 
> aware of labels.
>
> Of course you can first create your point P and then run a second query to 
> attach a label:
> MATCH (n)                    // match your created point somehow
> SET n:MyPoint                // Set Label "MyPoint" for this object
> RETURN n
>
> Label do not decrease performance, but would rather increase performance, 
> if you use querys that look for the label. Labels get auto-indexed, and 
> this way it's super-fast to query for "all nodes with label x". The only 
> performance decrease might be the insert-performance, if you need to run 2 
> queries instead of one (if your spatial framework doesn't support labels 
> and you've got to run a second query to set the label).
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to