

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Neptune openCypher ステータスサーブレットとステータスエンドポイント
<a name="access-graph-opencypher-status"></a>

openCypher ステータスエンドポイントは、サーバー上で現在実行されている、または実行を待っているクエリに関する情報へのアクセスを提供します。また、これらのクエリをキャンセルすることもできます。エンドポイントは、次の通りです。

```
https://{{(the server)}}:{{(the port number)}}/openCypher/status
```

サーバーから現在のステータスを取得する、またはクエリをキャンセルするHTTP `GET` および `POST` メソッドを使用できます。また、実行中のクエリまたは待機中のクエリをキャンセルする `DELETE` メソッドを使用することもできます。

## ステータスリクエストのパラメータ
<a name="access-graph-opencypher-status-parameters"></a>

**ステータスクエリパラメータ**
+ **`includeWaiting`** (`true` または `false`) — `true` に設定し、かつその他のパラメータが存在しない場合は、待機中のクエリと実行中のクエリのステータス情報が返されます。
+ **`cancelQuery`** — `GET` および `POST` メソッドを使用してのみ使用し、これがキャンセル要求であることを示します。`DELETE` メソッドはこのパラメータを必要としません。

  `cancelQuery` パラメータの値は使用されませんが、`cancelQuery` が存在する場合、キャンセルするクエリを識別するには、`queryId` パラメータが必要です。
+ **`queryId`** — 特定のクエリの ID が含まれます。

  `GET` または `POST` メソッドと併用およびし、なおかつ `cancelQuery` パラメータが存在しない場合 `queryId` は、識別する特定のクエリのステータス情報を返します。`cancelQuery` パラメータが存在する場合、`queryId` が特定するクエリはキャンセルされます。

  `DELETE` メソッドと併用する場合、`queryId` は常に特定のクエリがキャンセルされることを示します。
+ **`silent`** — クエリをキャンセルするときにのみ使用されます。`true` に設定されている場合、キャンセルは予告なしに行われます。

## ステータスリクエストのレスポンスフィールド
<a name="access-graph-opencypher-status-response-fields"></a>

**特定のクエリの ID が指定されていない場合、ステータスレスポンスフィールドは表示されない**
+ **acceptedQueryCount**   –   受け入れられながらもまだ完了していないクエリの数 (キュー内のクエリを含む)。
+ **runningQueryCount**   –   現在実行されている openCypher クエリの数。
+ **queries**   –   現在の openCypher クエリのリスト。

**特定のクエリのステータスレスポンスフィールド**
+ **queryId**   –   クエリの GUID ID。Neptune は、この ID 値を各クエリに自動的に割り当てます。または、独自の ID を割り当てることもできます ([Neptune Gremlin または SPARQL クエリにカスタム ID を挿入する](features-query-id.md)を参照)。
+ **queryString**   –   送信されたクエリ。それより長い場合、これは 1024 文字に切り捨てられます。
+ **queryEvalStats** — このクエリの統計情報。
  + **waited** - クエリが待機していた時間をミリ秒単位で示します。
  + **elapsed**   –   これまでクエリが実行されていた時間 (マイクロ秒)。
  + **cancelled** — `True` はクエリがキャンセルされたことを示し、`False` はキャンセルされていないことを示します。

## ステータスリクエストとレスポンスの例
<a name="access-graph-opencypher-status-samples"></a>
+ **待機中のクエリを含む、すべてのクエリのステータスを要求します。**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --include-waiting
  ```

  詳細については、 AWS CLI 「 コマンドリファレンス」の[get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)」を参照してください。

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status(
      includeWaiting=True
  )
  
  print(response)
  ```

  他の言語の AWS SDK の例については、「」を参照してください[AWS SDK](access-graph-opencypher-sdk.md)。

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "includeWaiting=true"
  ```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "includeWaiting=true"
  ```

------

  *レスポンス*:

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **待機中のクエリを**含まない**、すべてのクエリのステータスを要求します。**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}}
  ```

  詳細については、 AWS CLI 「 コマンドリファレンス」の[get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)」を参照してください。

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status()
  
  print(response)
  ```

  他の言語の AWS SDK の例については、「」を参照してください[AWS SDK](access-graph-opencypher-sdk.md)。

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db
  ```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status
  ```

------

  *レスポンス*:

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **1 つのクエリのステータスをリクエストします。**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --query-id {{eadc6eea-698b-4a2f-8554-5270ab17ebee}}
  ```

  詳細については、 AWS CLI 「 コマンドリファレンス」の[get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)」を参照してください。

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status(
      queryId='{{eadc6eea-698b-4a2f-8554-5270ab17ebee}}'
  )
  
  print(response)
  ```

  他の言語の AWS SDK の例については、「」を参照してください[AWS SDK](access-graph-opencypher-sdk.md)。

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "queryId={{eadc6eea-698b-4a2f-8554-5270ab17ebee}}"
  ```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "queryId={{eadc6eea-698b-4a2f-8554-5270ab17ebee}}"
  ```

------

  *レスポンス*:

  ```
  {
    "queryId" : "eadc6eea-698b-4a2f-8554-5270ab17ebee",
    "queryString" : "MATCH (n1)-[:knows]->(n2), (n2)-[:knows]->(n3), (n3)-[:knows]->(n4), (n4)-[:knows]->(n5), (n5)-[:knows]->(n6), (n6)-[:knows]->(n7), (n7)-[:knows]->(n8), (n8)-[:knows]->(n9), (n9)-[:knows]->(n10) RETURN COUNT(n1);",
    "queryEvalStats" : {
      "waited" : 0,
      "elapsed" : 23463,
      "cancelled" : false
    }
  }
  ```
+ **クエリのキャンセルをリクエストします**

------
#### [ AWS CLI ]

  ```
  aws neptunedata cancel-open-cypher-query \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --query-id {{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}
  ```

  詳細については、 AWS CLI 「 コマンドリファレンス」の[cancel-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/cancel-open-cypher-query.html)」を参照してください。

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.cancel_open_cypher_query(
      queryId='{{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}'
  )
  
  print(response)
  ```

  他の言語の AWS SDK の例については、「」を参照してください[AWS SDK](access-graph-opencypher-sdk.md)。

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "cancelQuery" \
    -d "queryId={{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}"
  ```

**注記**  
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。{{us-east-1}} を Neptune クラスターのリージョンに置き換えます。

------
#### [ curl ]

  1. `POST` を使用する:

  ```
  curl -X POST https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "cancelQuery" \
    --data-urlencode "queryId={{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}"
  ```

  2. `GET` を使用する:

  ```
  curl -X GET https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "cancelQuery" \
    --data-urlencode "queryId={{588af350-cfde-4222-bee6-b9cedc87180d}}"
  ```

  3. `DELETE` を使用する:

  ```
  curl -X DELETE \
    "https://{{your-neptune-endpoint}}:{{port}}/openCypher/status?queryId={{b9a516d1-d25c-4301-bb80-10b2743ecf0e}}"
  ```

------

  *レスポンス*:

  ```
  {
    "status" : "200 OK",
    "payload" : true
  }
  ```