Convert a MongoDB with two collections in a neo4j graph -


i finished create mongo database. made on 2 collections:

1. team 2. coach 

i give example of documents contained in these collections:

here team document:

{     "_id" : "mil.74",     "official_name" : "associazione calcio milan s.p.a",     "common_name" : "milan",     "country" : "italy",     "started_by" : {         "day" : 16,         "month" : 12,         "year" : 1899     },     "stadium" : {         "name" : "giuseppe meazza",         "capacity" : 81277     },     "palmarès" : {         "serie a" : 18,         "serie b" : 2,         "coppa italia" : 5,         "supercoppa italiana" : 6,         "uefa champions league" : 7,         "uefa super cup" : 5,         "cup winners cup" : 2,         "uefa intercontinental cup" : 4     },     "uniform" : "black , red" } 

this coach document:

{     "_id" : objectid("556cec3b9262ab4f14165fcd"),     "name" : "carlo",     "surname" : "ancelotti",     "age" : 55,     "date_of_birth" : {         "day" : 10,         "month" : 6,         "year" : 1959     },     "place_of_birth" : "reggiolo",     "nationality" : "italian",     "preferred_formation" : "4-2-3-1",     "coached_team" : [          {             "team_id" : "rma.103",             "in_charge" : {                 "from" : "26/june/2013",                 "to" : "25/may/2015"             },             "matches" : 119         },          {             "team_id" : "psg.00",             "in_charge" : {                 "from" : "30/dec/2011",                 "to" : "24/june/2013"             },             "matches" : 77         },          {             "team_id" : "che.11",             "in_charge" : {                 "from" : "01/july/2009",                 "to" : "22/may/2011"             },             "matches" : 109         },          {             "team_id" : "mil.74",             "in_charge" : {                 "from" : "07/nov/2001",                 "to" : "31/may/2009"             },             "matches" : 420         }     ] 

as can see, used normalized model: every coach has array of coached teams. want convert mongo database graph database, in particular neo4j; goal show in highly connected domains neo4j has better performance mongo(for example query:"find palmarès of teams coached carlo ancelotti, in mongo requires 2 queries, instead in neo4j it's enough follow relationships).
found this guide on forum uses gremlin convert mongo collection of documents neo4j graph automatically.
the problem guide talks 1 collection.
so, possible generate automatically neo4j graph starting mongo database(with 2 collections) or must create graph "by hand"?

gremlin domain specific language working graphs, based on groovy have flexibility want whatever want. in other words, can 1 mongodb collection can 2 (or many collections have). point of blog post referenced in 1 of other answers:

http://thinkaurelius.com/2013/02/04/polyglot-persistence-and-query-with-gremlin/

gremlin great language transforming data graph form, whatever source format is. think first load of teams vertices iterate through coaches, creating coach vertices , edges related teams go.

i add nothing "automatic" gremlin. it's not though tell gremlin have data in mongodb , turns graph. have write gremlin tell how want mongodb data turned graph.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -