Here are the two datasets named books and genres both having columns Genre.
I want to create a relationship where books will be mapped to their respective genres(Please note: Each book has multiple genres)
The following code was run :
WHERE B.Genres CONTAINS G.Genres
CREATE (B)-[r:BelongsTo]->(G) RETURN type(r)
And the result obtained was :
By executing the above query, only the books belonging to Fiction Genre were mapped , but the other books belonging to the other categories were not mapped. Someone help please
It's hard to tell what design you want to achieve.
I wonder if you're just looking for a design that lets you run
That's fine, so long as you've designed your data to be ready for this question. Perhaps you can provide more info on your end goals.
You may want to review your :Genre nodes and ensure there are no leading or trailing spaces, as that could be a reason why your matching isn't working as expected.
On a :Book node, is
Genres a list property, or is it one large string? Is there a reason why you're wanting to use substring matching instead of equality, for each genre in the list?