Created
July 23, 2018 10:19
-
-
Save nghuuquyen/ba09fb174619f6d6ab0037302533a206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sử dụng APOC để làm điều kiện | |
``` | |
MATCH (user:User) | |
WHERE ID(user) = 611 | |
MERGE (post:Post {description: 'test', type: 'sketch'})-[:Post {date_upload: timestamp(), visual: 0 }]->(user) | |
WITH user, post | |
OPTIONAL MATCH (gen:Genre)<-[:IT]-(gl:GenreLang) | |
WHERE gl.name IN ['Drammatico', 'Azione'] | |
CALL apoc.do.when(gen IS NOT NULL, 'MERGE (post)-[:HAS_GENRE]->(gen)', '', {post: post, gen: gen}) YIELD value | |
WITH user, post | |
MATCH (post)-[:HAS_GENRE]->()<-[:IT]-(r) | |
RETURN user, post, r.name; | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment