cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Multiple Properties vs Multiple Nodes

Hello !
I am trying to create a new database that will contain how similar certain things are.
It seems that around 25- 30% of my nodes will be 100% similar.
So I was wondering whether it would be more efficient performance wise to instead group them to single nodes. For example, instead of having 50 - 100 nodes of 100% similarity have 1 node that has all of the 100% similar objects as properties values.

1 ACCEPTED SOLUTION

Q: Can I search nodes and ask for all object with a certain origin if they are in a list inside a property ?

A: Yes you can search. Here is an example:
 Created two nodes:

merge (c:Test {val: ["red", "blue"]})
merge (d:Test {val: ["white", "red", "green"]})

Search for "green":

match (c:Test) where "green" in c.val return c
result: returns the second node with "green" only.

The above query returns all nodes that contain "green" in their property list.




View solution in original post

8 REPLIES 8

intouch_vivek
Graph Steward

If these nodes have similar properties and **they possess same label ** then logically they are same .
There is no reason to not merging them

ameyasoft
Graph Maven

Did you create the database already or are you planning to create a new database? Depending on that I can suggest ways to address this situation.Let mew know.

I am creating a new database.
The object itself is the same however I need to make note of the origin of the object.
This is the value I thought I could just add as a property.
However, this will mean I will have a list in the "origin" property. Will this still be ok ?
Can I search nodes and ask for all object with a certain origin if they are in a list inside a property ?

@atesterguy,

Not able to understand your requirement. Kindly explain so that we can help you

Q: Can I search nodes and ask for all object with a certain origin if they are in a list inside a property ?

A: Yes you can search. Here is an example:
 Created two nodes:

merge (c:Test {val: ["red", "blue"]})
merge (d:Test {val: ["white", "red", "green"]})

Search for "green":

match (c:Test) where "green" in c.val return c
result: returns the second node with "green" only.

The above query returns all nodes that contain "green" in their property list.




I believe this solves the main question I had.
I had another question related to this then.

WIll this query work for nodes who are not "combined" ?
will it return nodes that have a single value in val as well ?
I believe it will but having an answer here will simply calm me a bit ^^

Thank you very much 🙂 !

Yes, it will work. No worries!
Added another node to the previous two nodes:
merge (new:Test {val: "green"})

Ran this query:

match (c:Test) where "green" in c.val return c

result: two nodes -(new) and (d)

Thank you very much this is excellent news !