Reputation: 11
When I run the query below query 1 is producing result returning all categories label for a document for all documents. Note a document can have multiple categories hence collecting them in on go.
START doc = node:entities(type = "document-link")
MATCH category-[:category]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
COLLECT(COALESCE(category.category, "")) as categories
query 2 is producing result returning language of the document for all documents. A document can have only one language type.
START doc = node:entities(type = "document-link")
MATCH lan-[:language]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
lan.language as language
query 3 which is join of 1 and 2 is producing empty result. Can someone highlight what I am doing wrong?
START doc = node:entities(type = "document-link")
MATCH category-[:category]-lan-[:language]-doc<-[:`document-link`]-id
RETURN
doc.title as title,
lan.language as language,
COLLECT(COALESCE(category.category, "")) as categories
Upvotes: 1
Views: 1293
Reputation: 2826
In your third query you match on a relation between category and a language, which you don't do in your first 2 queries. How about this:
START doc = node:entities(type = "document-link")
MATCH category-[:category]-doc<-[:`document-link`]-id
MATCH doc-[:language]-lan
RETURN
doc.title as title,
lan.language as language,
COLLECT(COALESCE(category.category, "")) as categories
Upvotes: 1