paleobot / pbot-dev

Codebase and initial design documents for pbot client
MIT License
2 stars 2 forks source link

Do we really need CharacterInstance nodes in our Description complexes? #23

Closed NoisyFlowers closed 3 years ago

NoisyFlowers commented 3 years ago

I was researching other ways to compare Description complexes and came across this discussion on how to use the GDS Node Similarity comparison on deep relationships: https://community.neo4j.com/t/node-similarity-algorithm-for-second-and-third-level-relationships-comparison/12919.

The Node Similarity comparison (https://neo4j.com/docs/graph-data-science/current/algorithms/node-similarity/) is intended to operate on a bipartite graph. But we want to compare Description nodes based on their State leaf nodes, which are reached through the intermediate CharacterInstance nodes.

One approach described is to use a Cypher projection (https://neo4j.com/docs/graph-algorithms/current/projected-graph-model/cypher-projection/). I'm a little shaky on the syntax involved, but I get the concept. This is worth further investigation.

But the other approach is what led to my opening of this Issue: just add the relationships between the nodes you are comparing and the leaf nodes to the graph directly. In our case, that means bypassing the CharacterInstance nodes.

Those CharacterInstance nodes are intended to signify the binding of a Character to a State for a particular Description complex. But we don't really need to do that. The State is all that matters in the Description complex, and if for some reason we really want to get the Character that a State belongs to, we can reach it through the STATE_OF relationship from the State itself.

So, it's worth considering the idea of linking Descriptions nodes directly to their States without the intermediate CharacterInstance node.

aazaff commented 3 years ago

We definitely do not need them. You suggested them because I think you said they made the queries easier and I think we found them visually appealing (when you look at the whole complex), but I'm 97.5% sure we can do without them if you find it expedient.

aazaff commented 3 years ago

I think we determined that they were useful for tracking commentary. #24