Skip to content

Instantly share code, notes, and snippets.

@mzsima
Last active May 15, 2020 13:19
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/aeb6866bd5e3df93eeb4cff17bf4c616 to your computer and use it in GitHub Desktop.
Save mzsima/aeb6866bd5e3df93eeb4cff17bf4c616 to your computer and use it in GitHub Desktop.
ピッチャーが投げて、キャッチャーが捕る

image

snapshot

gremlin code

schema.vertexLabel("Player").
       ifNotExists().
       partitionBy("name", Text).
       property("position", Text).
       create();

schema.vertexLabel("Ball").
       ifNotExists().
       partitionBy("type", Text).
       create();

schema.edgeLabel('throw').
  ifNotExists().
  from('Player').to('Ball').
  create()
 
schema.edgeLabel('catch').
  ifNotExists().
  from('Ball').to('Player').
  create()
  
taro = g.addV("Player").
        property("name", "Taro").
        property("position", "pitcher").
        next();
        
jiro = g.addV("Player").
        property("name", "Jiro").
        property("position", "catcher").
        next();

ball = g.addV("Ball").
    property("type", "Baseball").
    next();
        
g.addE("throw").
    from(taro).
    to(ball).
    next();
    
g.addE("catch").
    from(ball).
    to(jiro).
    next();


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