In many multilingual systems, there are nested hierarchis of categories, connected to different products that need to be searched by customers with different language preferences. Here is a possible approach, inspired by the Wordnet Project.
CREATE (getr{name:'C1'})
CREATE (alc{name:'C2'})
CREATE ({caption:'beverages', lang:'EN'})<-[:CAPTION]-(getr)
CREATE (getr)-[:CAPTION]->({caption:'Getraenke', lang:'DE'})
CREATE ({caption:'alcoholic stuff', lang:'EN'})<-[:CAPTION]-(alc)
CREATE (alc)-[:CAPTION]->(alc_de{caption:'Alkoholika', lang:'DE'})
CREATE (getr)<-[:IS_A]-(alc)
CREATE ({name:"Wein"})-[:TAGGED]->(alc_de)
Now, let’s find the German captions of products that are attached to the category or one of its subcategories of the one that has an English caption beverages
.
MATCH
(bev_caption)<-[:CAPTION]-bev<-[:IS_A*0..]-(sub_cat)-[:CAPTION]->(caption),
bev-[:CAPTION]->(cap2),(caption)<-[:TAGGED]-(product)
WHERE
bev_caption.caption = 'beverages' AND
caption.lang='DE' AND cap2.lang='DE'
RETURN bev_caption.caption AS search_term,cap2.caption AS search_term_DE,caption.caption AS found_cat, product.name