velocity-cmd

コマンド・ラインから Watson™ Explorer Engine の SOAP/REST API 関数を実行できます。

構文

velocity-cmd [-h|-help]
    [-installation-dir /path/to/velocity/installation]
    [-list]
    [-list-xml]
    [-user userid]
    {<function> [help|<name>=<value>]}

説明

velocity-cmd コマンドは Watson Explorer Engine インストール済み環境の bin サブディレクトリーにあります。このコマンドにより、すべての Watson Explorer Engine SOAP/REST API 関数をコマンド・ラインから実行できます。このコマンドを使用して API 関数の詳細なヘルプを表示することもできます。

velocity-cmd コマンドは、すべての Watson Explorer Engine SOAP/REST API をサポートする実行可能ファイルにアクセスできる必要があります。velocity.aspxWatson Explorer Engine の 1 次実行可能ファイルとして使用する場合、次の例のように、velocity-config コマンドを使用して global/api-url 変数を変更し、velocity.aspx アプリケーションの場所を明示的に設定する必要があります。

 velocity-config global/api-url=http://url/to/velocity.aspx
注: このコマンドを実行できるのは、Watson Explorer Engine がインストールされているサーバーの認証された管理ユーザーのみであるため、Watson Explorer Engine への認証が前提となります。ただし、一部の機能については、ユーザーの識別が適切です (クエリーやアノテーションなど)。これが必要な場合は、-U パラメーターまたは -user パラメーターを指定する必要があります。

オプション

  • -h|-help コマンド・ラインのヘルプ・メッセージを表示して終了します。
  • -installation-dir Watson Explorer Engine インストール済み環境の場所を定義します。デフォルトのインストール・ディレクトリーを使用した場合、このパラメーターは不要です。
  • -list 使用可能なすべての API 関数のリストを表示します。このリストは非常に長いため、対応できるだけの十分な端末バッファー容量が必要です。
  • -list-xml 使用可能なすべての API 関数のリストを XML 形式で表示します。このリストは非常に長いため、対応できるだけの十分な端末バッファー容量が必要です。
  • -user API 関数の実行時に使用するユーザーを定義します。デフォルトは none です。
    注: このパラメーターを使用して指定されるユーザーはすべて、Watson Explorer Engine 内に既に存在している必要があります。
  • <function> help 指定された関数に関する包括的なヘルプを返します。
  • <function> <name>=<value> 指定されたパラメーターを使用して Watson Explorer Engine REST API 関数を実行します。その後、API の応答がコマンド・ラインに送信されます。応答に xml ヘッダーは含まれません。velocity-cmd コマンドではすべての API 関数を実行できます。使用可能な API コマンドと規定の構文の詳細なリストについては、「API Developers Manual」を参照してください。

引数を指定せずに velocity-cmd コマンドを実行すると、-help オプションを指定して呼び出した場合と同じ出力が表示されます。

メッセージ

インストール・ディレクトリーの指定が誤っている場合は、以下のメッセージが表示されます。

There has been a problem:
      The directory 'directory' does not appear to be a
      valid Velocity Installation.  Your installation may
      be incomplete or you may need to specify the '-I' option, followed
      by the name of the directory in which Velocity is
      installed. (ID: CLI_BAD_VELOCITY_DIR_ERROR)

Watson Explorer Engine に存在しないユーザーを指定すると、以下のメッセージが表示されます。

There has been a problem:
      (ID: CORE_AUTHENTICATE_ERROR) Login failed because
           the user does not exist or the password was incorrect.

Watson Explorer Engine SOAP/REST API に存在しない API 呼び出しを指定すると、以下のメッセージが表示されます。

There has been a problem:
      (ID: XML_FUNCTION_NOT_DEFINED_ERROR) "function""API call" is not defined

velocity-config コマンドから出される可能性があるその他のメッセージの詳細については、「Velocity API Developers Guide」を参照してください。

入力例:

./velocity-cmd -list

出力例:

List functions:
 alert-list-xml: Retrieves a list of alerts for all users.
     This function has no inputs
     returns:
         Type:       nodeset
     throws:
       - alert-list

 alert-run: Starts the alert service and run alerts for user or id provided.
      input:
          - user: Run all alerts for this user.
              Type:           nmtoken
              Required:       No
          - alert-id: Run alert which has this id.
              Type:           string
              Required:       No
      throws:
          - alert-run

 alert-service-start: Starts the alert service and run all user alerts.
     This function has no inputs
     throws:
         - alert-service-start

 alert-service-status-xml: Retrieves the status of the alert service, whether it is running or not.
     This function has no inputs
     returns:
         Type:       nodeset
     throws:
         - alert-service-status
 .
 .
 .

入力例:

./velocity-cmd -U administrator dictionary-list-xml

出力例:

<dictionaries>
  <dictionary name="english" />
  <dictionary name="doc-search-dictionary" />
  <dictionary name="test" />
  <dictionary name="default" />
  <dictionary name="base" />
</dictionaries>

終了ステータス

コマンドが正常に実行された場合は、ステータス 0 で終了します。

注: Linux システムでは、127 より上の終了コードはシェルによって返されます。詳しくは、ご使用のシェルの資料を参照してください。