How to manage "multilingual" data in Neo4j in an efficient way ?

611 views
Skip to first unread message

Filip W.

unread,
Aug 28, 2013, 2:48:00 AM8/28/13
to ne...@googlegroups.com
Hi Everyone,

As hobby, i am trying to design a Culinary / Recipes | Food & Wine DATABASE with neo4j.
Information will be translated in different language (at least 3).
So here comes my question :

Is it better to generate a node for ever Noun for all language  and connect to the others with a relationship (is_english, is_spanish, is_french ...)
   For example :  Gateau - [is_english] -> Cake - [is_spanish] -> Pastel

Or

Use Label (with Neo4j 2.0, now i am more with 1.9, so for the future) such as :

CREATE
 (spanish:Spanish { name : "Pastel"})

and then connect it with Gateau and Cake ?

Or

Use Properties such as

CREATE n = { name : 'Pastel', Language : ' Spanish'}

But still need to connect to the other translation. like Pastel- [is] - Cake

Or

Perhaps a data model that has already be implemented/tested and you have information about it.


I hope that i explained my issue well and thank you in advance for your help.
Filip





Javier de la Rosa

unread,
Aug 28, 2013, 10:23:17 AM8/28/13
to ne...@googlegroups.com
There are different approaches to achieve this. But in the end is up to you. What I'd do is to have unique nodes for the entities, so the nodes and relationships don't need to be duplicated. And then, each node can have a name and also a label:es, label:en, etc as properties.

    CREATE n={ name: 'Cake', `label:en`: 'Cake', `label:es`: 'Pastel'}

So your graph doesn't have duplicated information and the "representation" of the node can be in any language you need.


--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Javier de la Rosa
http://versae.es

Filip W.

unread,
Aug 28, 2013, 10:47:06 AM8/28/13
to ne...@googlegroups.com
Hi Javier,
Thank you for your answer.
Your approach is definitvely accurate if you use neo4j 2.0 and i will strongly consider to do this on this version.
But now i am still with 1.9 (without the label option) so Perhaps someone else as an idea to manage it. Just to know how to do it. 
Thanks.

Javier de la Rosa

unread,
Aug 28, 2013, 4:18:25 PM8/28/13
to ne...@googlegroups.com
Not sure, but this solution may work on both, 1.9.2 and 2.0.0, since doesn't imvolve the use of Labels.

    CREATE n={ name: 'Cake', `label:en`: 'Cake', `label:es`: 'Pastel'}

When i say there 'label:es', I don't mean the Neo4j Label element, but a regular property called 'label:es'. Of course you can change that to, for example, 'title:es'.

Anyway, I hope you'll find a solution :)

Cheers!

Filip W.

unread,
Aug 28, 2013, 5:15:02 PM8/28/13
to ne...@googlegroups.com
Javier,
Thanks for the information. I will try it and let you know.
:)
Filip
Reply all
Reply to author
Forward
0 new messages