Skip to content

Latest commit

 

History

History
56 lines (46 loc) · 1.02 KB

README.md

File metadata and controls

56 lines (46 loc) · 1.02 KB

Graph CRUD

High-level API to run CRUD operations on Graph Databases, with JSON inputs.

UPDATE. This project is moved to invanalabs/invana

Note Under Active Development.

from gremlin_crud.manager import GremlinCRUDManager

manager = GremlinCRUDManager("ws://127.0.0.1:8182/gremlin")
msg = {...}
manager.process(msg)

Add Vertex

{
  "type": "vertex",
  "operation_type": "create",
  "data": {
    "label": "Plant",
    "properties":{
      "common_name": "chrysanths",
      "scientific_name": "Chrysanthemum"
    }
  }
}
manager.process(msg)

Add Edge

{
  "type": "Edge",
  "operation_type": "create",
  "data": {
    "label": "BelongsTo",
    "inV": {
      "query":  {
        "type":  "vertex", 
        "operation_type": "find_one", 
        "filter":  {"label":  "Plant", "properties": {"common_name": "chrysanths"} }
      }
    },
    "outV": {"id":  "123-asdv-asd123"},
    "properties":{
      "first_discovered": 1989
    }    
  }
 
}