# How to Integrate nodes by name, in neo4j?

**URL:** <https://community.neo4j.com/t/how-to-integrate-nodes-by-name-in-neo4j/19221>\
**Category:** Cypher\
**Created:** [May 26, 2020, 2:54am UTC](https://community.neo4j.com/t/how-to-integrate-nodes-by-name-in-neo4j/19221 "2020-05-26T02:54:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjtnwjd40](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/gjtnwjd40/32/11632_2.png) [@gjtnwjd40](https://community.neo4j.com/u/gjtnwjd40)\
**Post date:** [May 26, 2020, 2:54am UTC](https://community.neo4j.com/t/how-to-integrate-nodes-by-name-in-neo4j/19221/1 "2020-05-26T02:54:00Z")

</div>

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

 ![take_3](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/f/f3d05102553b84c0e01e99f2b99dcfb0474762ea.png)

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,

 ![take_1](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/2X/5/5a56f4038a86b625dae8e52be099e6f8a0c668dc.png)

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**

```auto
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)

```auto
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

---

<div class="post-metadata">

**Author:** ![intouch\_vivek](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/intouch_vivek/32/4097_2.png) [@intouch\_vivek](https://community.neo4j.com/u/intouch_vivek)\
**Post date:** [May 26, 2020, 8:09am UTC](https://community.neo4j.com/t/how-to-integrate-nodes-by-name-in-neo4j/19221/2 "2020-05-26T08:09:19Z")

</div>

> [@gjtnwjd40](#):
>
> t to

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
