Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-25-2021 01:50 PM
For example, I may have a relation in an e-commerce domain as below:
Product producedBy Company
And in another domain, I may have a similar relation:
Pollution producedBy Vehicle
In both cases, 'producedBy' is an intuitive relation name and makes sense. However, the node types in both relations are completely different. In such a case, should I use a different name to represent the two different relations, or it is better to use the the same name as above? If I use different relation names, I may have to create a lot more relation names for similar situations.
Any recommendations on the choice of relation name in such cases?
Solved! Go to Solution.
01-25-2021 11:36 PM
I just got my Neo4j modeling certification yesterday.
The Graph Data Modeling for Neo4j online training is really good and even if I was using Neo4j for 2 years I learned a bunch of stuff to be exactly sure about how to model a database.
Short answer : I would need your queries questions, graph schema and the scalability of it to answer properly, it's not that easy, optimising a graph is something.
But roughly by guessing the size and schema of your graph and possible questions related to it, it's OK if these relations are not part of the same graph / database. It's 100% NOT if they are.
Relationships type are really important in query performance to avoid the gather-and-inspect behaviour. Meaning scanning a bunch of connected nodes not related to your query, called wasted hops.
If they are in the same graph, I would suggest something like Pollution EMITTED_BY
01-25-2021 06:39 PM
I think it depends on what your queries might be.
That being said, if the two types of relationships are used very differently and never overlap, then it would be better to keep them separate.
The reason why, is underneath the covers Neo4J collects Labels in Sets. If you have a union of dissimilar Labels that are actually disjoint, then you have an overly large Set that has to be scanned when picking out Label matches. The smaller the sets, the faster the transversals.
I hope that helpl. (and I'm sure if I'm not exactly right, I'll be corrected!)
01-25-2021 11:36 PM
I just got my Neo4j modeling certification yesterday.
The Graph Data Modeling for Neo4j online training is really good and even if I was using Neo4j for 2 years I learned a bunch of stuff to be exactly sure about how to model a database.
Short answer : I would need your queries questions, graph schema and the scalability of it to answer properly, it's not that easy, optimising a graph is something.
But roughly by guessing the size and schema of your graph and possible questions related to it, it's OK if these relations are not part of the same graph / database. It's 100% NOT if they are.
Relationships type are really important in query performance to avoid the gather-and-inspect behaviour. Meaning scanning a bunch of connected nodes not related to your query, called wasted hops.
If they are in the same graph, I would suggest something like Pollution EMITTED_BY
01-25-2021 11:57 PM
@tard.gabriel How do you get the modeling certification? Is there a link, please?
01-26-2021 12:04 AM
All the sessions of the conference are now available online