Skip to content

Instantly share code, notes, and snippets.

@mzsima
Last active May 6, 2020 12:42
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/a2acc6b0cc5c14c3ccd068ada9f79eac to your computer and use it in GitHub Desktop.
Save mzsima/a2acc6b0cc5c14c3ccd068ada9f79eac to your computer and use it in GitHub Desktop.
Taro が Tweet

イメージ

snapshot

コード(GREMLIN)

schema.vertexLabel("User").
       ifNotExists().
       partitionBy("uid", Text).
       property("name", Text).
       create();

schema.vertexLabel("Tweet").
       ifNotExists().
       partitionBy("text", Text).
       create();

schema.edgeLabel('post').
  ifNotExists().
  from('User').to('Tweet').
  create()
  
taro = g.addV("User").
        property("uid", "user1").
        property("name", "Taro").
        next();
        
tweet1 = g.addV("Tweet").
        property("text", "Hello world.").
        next();
        
g.addE("post").
    from(taro).
    to(tweet1).
    next();

tweet2 = g.addV("Tweet").
        property("text", "test message.").
        next();
        
g.addE("post").
    from(taro).
    to(tweet2).
    next();
    
g.V()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment