简体   繁体   中英

cypher query to match all nodes of a specific relationship type to a specific node

I have a node type of Author and a node type of Articles

Author has a relationship type of WROTE which links it to articles that it has written.

I would like to get all articles that have been written by an author with a specific uuid.

MATCH (n:Author {uuid: '8f47fb1d-2a3f-46a8-b0fc-06b24169ac86'})<-[:WROTE]-(Article) RETURN Article

is what I am trying, but it is coming back with (no changes, no records)

I'm guessing here, but the direction of your relationship seems off. You also want to provide the type (ie "label") of your article node:

MATCH (n:Author {uuid: '8f47fb1d-2a3f-46a8-b0fc-06b24169ac86'})-[:WROTE]->(a:Article)
RETURN a

For exploring your data and if you do not know the direction, you can match relationships while ignoring the direction:

MATCH (n:Author {uuid: '8f47fb1d-2a3f-46a8-b0fc-06b24169ac86'})-[:WROTE]-(a:Article)
RETURN a

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM