Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-25-2020 07:54 PM
Hi, these days i'm going to make a app which integrate NLP and recommendation enable with neo4j.
For example,
If there is a information about 'sushi' and the user say about sushi,
the 'sushi node' must be one (not two of node).
I'll show you below
But when I made a two graph,
one for user sentence and one for product there is problem that the node aren't integrated as one.
like this,
I also use MERGE statement and Double label (e.g CREATE (sushi:Cuisine:test_word_1))
but it wasn't useful at all.
so I want to ask how to integrate if the node represented 'name' is same.
I'll attach my cypher query
Graph 1
CREATE (philip:Person {name:"philip"})-[:IS_FRIEND_OF]->(emil:Person {name:"emil"}),
(philip)-[:IS_FRIEND_OF]->(michael:Person {name:"michael"}),
(philip)-[:IS_FRIEND_OF]->(andreas:Person {name:"andreas"})
CREATE (sushi:Cuisine {name:"sushi"}), (nyc:City {name:"new york"}),
(isushi:Restaurant {name:"isushi"})-[:SERVES]->(sushi),(isushi)-[:LOCATED_IN]->(nyc),
(michael)-[:LIKES]->(isushi),
(andreas)-[:LIKES]->(isushi),
(zam:restaurant {name:"zushi zam"})-[:SERVES]->(sushi),(zam)-[:LOCATED_IN]->(nyc),
(andreas)-[:LIKES]->(zam)
Graph 2 (User mentioned Graph)
WITH split("''' + last_user_message +'''"," ") AS text
UNWIND range(0, size(text)-2) AS i
MERGE (w1:test_word_1{name: text[i]})
MERGE (w2:test_word_1{name: text[i+1]})
MERGE (w1)-[:NEXT]->(w2)
Any Comments would be appriciated.
Regards,
Sujeong
05-26-2020 01:09 AM
Hi @gjtnwjd40,
Try merge refactor like below
MATCH (sushi:Cuisine)
WITH sushi.name as cusinieName, collect(sushi) as nodes
CALL apoc.refactor.mergeNodes(nodes, {properties: "combine"}) YIELD node
RETURN node
All the sessions of the conference are now available online