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 :
MATCH(B:Books),(G:Genres)
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
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?