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.