Hi Benjamin,
Thanks for the answer,
I have a layered graph, i.e., level 0 are only connected to level 1, level
one to level 2, etc. What if
I create a node at top, say level n and create all level n elements to it
and each time querying just
specify a start node (not sure if we can specify start node in java or
not)?
My following questions are as follows:
1- When creating normal node we can use createNode command in java and
specify the label, but
if I have a spatial layer and for instance I add a point (using
createPoint), how do I attach a label to it?
2-Is adding label to all nodes going to decrease the performance ?
Best,
Alireza
On Monday, July 14, 2014 1:16:20 AM UTC+2, Benjamin Makus wrote:
>
> There are no object types in Neo4j.
>
> There are basically 4 solutions for your problem:
>
> 1. search ALL nodes for property p = value (this will find ALL nodes
> which have a property named "p" with value "value")
> 2. use Labels. This way you can "tag" nodes. Each node can have
> multiple labels. so your query would be "give me all nodes with label 'x'
> and property p = value"
> 3. give all your nodes a field called "type" and use this for tagging
> your objects. (this was used before there were tags). query: "give me all
> nodes with property 'type' = 'x' and property 'p' = value"
> 4. give all your objects a relation to a common node, so you can say
> "give me all node which have a relation to 'common node' and where
> property
> p = value"
>
> As you can see, there are only 3 'good' solutions, because *1. *will scan
> every(!) node, which can get very slow and additionally it will return
> every kind of node with p = value.
>
> I'd prefer *2.* or *4.*.
>
> If your objects are really independent, what do they have in common? How
> would you find these objects in a database like MySQL or MongoDB? If the
> answer is: "I store them - and only them - in the same table", then the
> Neo4j answer is: Use Labels!
>
> Here's an example:
> create (n:MyLabel {p : "value"})
> This will create a Node with label "MyLabel" and property p = value.
>
> If you now want to get all Nodes with that label use:
> match n:MyLabel
> return n
>
> Or with additional p = value:
> match n:MyLabel
> where n.p = value
> return n
>
>
>
--
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.