A person has many relationships, and I created different names for these relationships. For example, person-[person_read_book]-book, person-[person_write_book]-book, I want to find out who read or wrote a book, person-[r]-[book] type(r) ends with book.
Sorry, let me re-describe the scene. reader-[reader_read_book]-book, writer-[writer_write_book]-book, I want to know who has read or written a certain book, there are many different types, I don’t know which node types are there , I only know book. So I query (n)-[r]-(b:Book) where type(r) ends with 'book' return n
I don't know where you did get this kind of model from, I definitely recommend to you to adjust your model to the recommended form otherwise you're fighting the system and won't be happy :)
Usually graph models are like this (Subject Predicate Object) on the schema-level:
(:Person)-[:WROTE|READ]->(:Book)
So they form a fact, which you then can query by the start- and end-labels and rel-types.
e.g.
MATCH (p:Person)-[:WROTE|READ]->(b:Book)
RETURN p, b
or
MATCH (p:Person)
WHERE exists { (p)-[:WROTE|READ]->(:Book) }
RETURN p