Skip to content

Instantly share code, notes, and snippets.

@mzsima
Last active May 11, 2020 15:04
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/d57bbb049af694f8a768853f16b5f593 to your computer and use it in GitHub Desktop.
Save mzsima/d57bbb049af694f8a768853f16b5f593 to your computer and use it in GitHub Desktop.
二郎は太郎から車を借りる

image

snapshot

gremlin code

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

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

schema.edgeLabel('rent').
  ifNotExists().
  from('Customer').to('Car').
  create()
       

schema.edgeLabel('own').
  ifNotExists().
  from('Customer').to('Car').
  create()

taro = g.addV("Customer").
        property("name", "Taro").
        next();
        
jiro = g.addV("Customer").
        property("name", "Jiro").
        next();
        
toyota = g.addV("Car").
        property("name", "Toyota").
        next();
        
g.addE("own").
    from(taro).
    to(toyota).
    next();
    
g.addE("rent").
    from(jiro).
    to(toyota).
    next();

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