{"id":16832124,"url":"https://github.com/okram/mongodb-gremlin","last_synced_at":"2025-04-11T04:32:43.962Z","repository":{"id":90612451,"uuid":"99523961","full_name":"okram/mongodb-gremlin","owner":"okram","description":"A MongoDB compiler for the Gremlin traversal machine.","archived":false,"fork":false,"pushed_at":"2020-03-29T11:31:35.000Z","size":294,"stargazers_count":19,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-25T02:39:53.411Z","etag":null,"topics":["graphdb","gremlin","mongodb","tinkerpop"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/okram.png","metadata":{"files":{"readme":"README.asciidoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-07T01:16:32.000Z","updated_at":"2023-09-01T18:30:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8c7b6ab-7e46-4d77-94d4-02b411bfa4a0","html_url":"https://github.com/okram/mongodb-gremlin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okram%2Fmongodb-gremlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okram%2Fmongodb-gremlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okram%2Fmongodb-gremlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okram%2Fmongodb-gremlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okram","download_url":"https://codeload.github.com/okram/mongodb-gremlin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345202,"owners_count":21088231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphdb","gremlin","mongodb","tinkerpop"],"created_at":"2024-10-13T11:47:46.336Z","updated_at":"2025-04-11T04:32:43.935Z","avatar_url":"https://github.com/okram.png","language":"Java","readme":"image::https://raw.githubusercontent.com/okram/mongodb-gremlin/73fb15f74d23a544d224e6a1f66e746bd3329e31/docs/images/mongodb-gremlin-logo.png[MongoDB-Gremlin]\n\nMongoDB-Gremlin\n---------------\n\nMongoDB-Gremlin compiles MongoDB link:https://docs.mongodb.com/manual/tutorial/insert-documents/[insert] and\nlink:https://docs.mongodb.com/manual/tutorial/query-documents/[query] documents to\nlink:http://tinkerpop.apache.org/gremlin.html[Gremlin] bytecode. In doing so, JSON documents are embedded in the\nunderlying link:http://tinkerpop.apache.org[Apache TinkerPop]-enabled graph system.\n\nThis project currently serves as a proof-of-concept and should not be used in any real, production capacity.\nIt was created to provide a technical foundation for the link:https://www.datastax.com/dev/blog/the-von-gremlin-architecture[The Von Gremlin Architecture]\narticle. If anyone is interested in taking over this project and flushing out the remaining CRUD operations of\nMongoDB (e.g. delete and update), please feel free to do so. There are a few peculiarities that were introduced for\nthe sake of providing a quick POC. These should be rectified in a more thorough implementation and can be discussed\nwith the interested developer.\n\n*NOTE*: Please see link:https://github.com/twilmes/sql-gremlin[SQL-Gremlin] and link:https://github.com/dkuppitz/sparql-gremlin[SPARQL-Gremlin]\nfor other examples of using common data structures and query languages with Gremlin.\n\nJSON Graph Encoding\n~~~~~~~~~~~~~~~~~~~\n\nThe JSON-to-graph encoding is as follows:\n\n1. Every JSON object is a vertex.\n2. Every JSON primitive field is a vertex property.\n3. Every JSON array must either be all primitives or all objects.\n** Primitive arrays are represented using vertex multi-properties.\n** Object arrays are represented using edges to vertices.\n4. JSON arrays may not contain JSON arrays.\n\nIt is important to note that appropriate graph-based indices should be defined to enable quick\nretrieval based on the abstract structure defined above.\n\nExample Usage\n~~~~~~~~~~~~~\n\n[source,groovy]\n----\n~/software/tinkerpop bin/gremlin.sh\n\n         \\,,,/\n         (o o)\n-----oOOo-(3)-oOOo-----\nplugin activated: tinkerpop.server\nplugin activated: tinkerpop.utilities\nplugin activated: tinkerpop.tinkergraph\ngremlin\u003e :install com.datastax.tinkerpop mongodb-gremlin 0.1-SNAPSHOT\n==\u003eLoaded: [com.datastax.tinkerpop, mongodb-gremlin, 0.1-SNAPSHOT]\ngremlin\u003e import com.datastax.tinkerpop.mongodb.MongoDBTraversalSource\n==\u003e...\ngremlin\u003e graph = TinkerGraph.open()\n==\u003etinkergraph[vertices:0 edges:0]\ngremlin\u003e db = graph.traversal(MongoDBTraversalSource)\n==\u003emongodbtraversalsource[tinkergraph[vertices:0 edges:0], standard]\ngremlin\u003e db.insertOne(\"\"\"\n......1\u003e {\n......2\u003e   \"~id\" : \"71223bf3-9dcc-4de1-b95a-13fdb8aba9e0\",\n......3\u003e   \"~label\" : \"person\",\n......4\u003e   \"name\" : \"Gremlin\",\n......5\u003e   \"hobbies\" : [\"traversing\", \"reflecting\"],\n......6\u003e   \"birthyear\" : 2009,\n......7\u003e   \"alive\" : true,\n......8\u003e   \"languages\" : [\n......9\u003e     {\n.....10\u003e       \"name\" : \"Gremlin-Java\",\n.....11\u003e       \"language\" : \"Java8\"\n.....12\u003e     },\n.....13\u003e     {\n.....14\u003e       \"name\" : \"Gremlin-Python\",\n.....15\u003e       \"language\" : \"Python\"\n.....16\u003e     },\n.....17\u003e     {\n.....18\u003e       \"name\" : \"Ogre\",\n.....19\u003e       \"language\" : \"Clojure\"\n.....20\u003e     }\n.....21\u003e   ]\n.....22\u003e }\n.....23\u003e \"\"\")\n==\u003e[acknowledged:true,insertId:71223bf3-9dcc-4de1-b95a-13fdb8aba9e0]\ngremlin\u003e db.find('{\"name\" : \"Gremlin\"}')\n==\u003e[~id:71223bf3-9dcc-4de1-b95a-13fdb8aba9e0,\n    ~label:person,\n    birthyear:2009,\n    alive:true,\n    hobbies:[traversing,reflecting],\n    name:Gremlin,\n    languages:\n     [[~label:vertex,~id:2,name:Gremlin-Java,language:Java8],\n      [~label:vertex,~id:6,name:Gremlin-Python,language:Python],\n      [~label:vertex,~id:10,name:Ogre,language:Clojure]]]\n----\n\nFinally, it is important to note that because the JSON document is embedded in the graph as vertices, edges, and properties,\nit is possible to use `GraphTraversal` to query the graph structure as well.\n\n[source,groovy]\n----\ngremlin\u003e g = graph.traversal()\n==\u003egraphtraversalsource[tinkergraph[vertices:4 edges:3], standard]\ngremlin\u003e g.V().has('name','Gremlin').out('languages').has('name','Ogre').values('language')\n==\u003eClojure\n----","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokram%2Fmongodb-gremlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokram%2Fmongodb-gremlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokram%2Fmongodb-gremlin/lists"}