Gremlin Consoleの起動

対話型環境でのGremlin Consoleの起動。

Gremlinは、DSE Graphとの対話に使用するクエリー言語です。Gremlinコードの入力の一方法として、Gremlin Consoleを使用する方法があります。Gremlin Consoleは、Gremlinの直接入力によるグラフ・スキーマの作成、データの読み込み、グラフの管理、および探索結果の取得に役立つ対話型環境です。Gremlin Consoleは、Gremlin Serverとのインターフェイスで、DSE Graphと対話できます。

手順

  • Gremlin Consoleを起動します。
    bin/dse gremlin-console
             \,,,/
    (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated:tinkerpop.server
    plugin activated:tinkerpop.utilities
    plugin activated:tinkerpop.tinkergraph
    ==>Connected - localhost/127.0.0.1:8182-[42cf7fa9-fee3-439a-ab9d-41529938af64]
    ==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[42cf7fa9-fee3-439a-ab9d-41529938af64] - type ':remote console' to exit

    デフォルトでは、ご覧のとおり3つのプラグインがアクティブ化されます。Gremlin Servertinkerpop.serverが起動したため、DSE Graphに対してコマンドを発行することができます。ユーティリティ・プラグインtinkerpop.utilitiesは、Gremlin Consoleで役立つさまざまな関数、ヘルパー・メソッド、および外部クラスのインポート機能などを提供します。一部のグラフ操作で中間グラフとして使用されるインメモリー・グラフのTinkerGraphは、tinkerpop.tinkergraphで起動されます。Gremlin Consoleは、リモートGremlin Serverに自動的に接続します。

  • Gremlin Consoleのコマンドはhelpで調べることができます。コンソール・コマンドはGremlin言語のコマンドではなく、シェル機能のためにGremlin Consoleに対して発行されるコマンドです。Gremlin Consoleは、Groovyシェルに基づいています。
    :help
    For information about Groovy, visit:
    http://groovy-lang.org 
    
    Available commands:
    :help       (:h  ) Display this help message
      ?           
    (:?  ) Alias to: :help
    :exit       (:x  ) Exit the shell
    :quit       (:q  ) Alias to: :exit
    :import      (:i  ) Import a class into the namespace
    :display    (:d  ) Display the current buffer
    :clear      (:c  ) Clear the buffer and reset the prompt counter.
    :show       (:S  ) Show variables, classes or imports
    :inspect    (:n  ) Inspect a variable or the last result with the GUI object browser
    :purge      (:p  ) Purge variables, classes, imports or preferences
    :edit       (:e  ) Edit the current buffer
    :load       (:l  ) Load a file or URL into the buffer
    .           (:.  ) Alias to: :load
    :save       (:s  ) Save the current buffer to a file
    :record     (:r  ) Record the current session to a file
    :history    (:H  ) Display, manage and recall edit-line history
    :alias      (:a  ) Create an alias
    :register   (:rc ) Registers a new command with the shell
    :doc        (:D  ) Opens a browser window displaying the doc for the argument
    :set        (:=  ) Set (or list) preferences
    :uninstall  (:-  ) Uninstall a Maven library and its dependencies from the Gremlin Console
    :install    (:+  ) Install a Maven library and its dependencies into the Gremlin Console
    :plugin     (:pin) Manage plugins for the Console
    :remote     (:rem) Define a remote connection
    :submit     (:>  ) Send a Gremlin script to Gremlin Server
    
    For help on a specific command type:
    :help command 
    

    Gremlin Consoleは、自動補完によるコーディング支援機能を備えており、<TAB>キーを使用することで一連の有効な選択肢を表示させることができます。