Skip to content

Instantly share code, notes, and snippets.

@mzsima
Last active May 13, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzsima/79aedb09ea3756d3bacb3c4afb878636 to your computer and use it in GitHub Desktop.
Save mzsima/79aedb09ea3756d3bacb3c4afb878636 to your computer and use it in GitHub Desktop.
ブタの貯金箱に貯金する

image

snapshot

gremlin

schema.vertexLabel("Customer").
       ifNotExists().
       partitionBy("name", Text).
       create();

schema.vertexLabel("Bank").
       ifNotExists().
       partitionBy("name", Text).
       create();
       
schema.vertexLabel("Transaction").
       ifNotExists().
       partitionBy("price", Int).
       create();

schema.edgeLabel('deposit').
  ifNotExists().
  from('Transaction').to('Bank').
  create()
       
schema.edgeLabel('save').
  ifNotExists().
  from('Customer').to('Transaction').
  create()
  

taro = g.addV("Customer").
        property("name", "Taro").
        next();
        
piggy = g.addV("Bank").
        property("name", "Piggy").
        next();
        
t = g.addV("Transaction").
    property("price", 100).
    next();
        
g.addE("save").
    from(taro).
    to(t).
    next();

g.addE("deposit").
    from(t).
    to(piggy).
    next();

dev.V()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment