String normalization in Neo4j Cypher - how to?

342 Views Asked by At

Problem background: Chinese words consists of characters which are words themselves. I have 3 nodes representing Chinese words each with the attribute word having the string-values: node (1): "a" node (2): "b" node (3): "ab"

Question 1: Using Cypher starting from node (3), how can I find the nodes (1) and (2) which constitute the string of node (3)?

Question 2: If there would be a further node (4): "dabc", how would I find all words of length one that are not part of the graph ("d" and "c" have no nodes)?

I know that I could model the relationships between these nodes explicitly, but I'm wondering whether Cypher is expressive enough to take this burden off my shoulders here.

1

There are 1 best solutions below

0
On

In general all you've got with the graph database is nodes and relationships, and cypher is good for navigating through relationships to find related nodes. So I would suggest trying some sample models and seeing what seems to suit your purposes best. I would not shy away from creating relationships.