

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Servlet di stato ed endpoint di stato openCypher di Neptune
<a name="access-graph-opencypher-status"></a>

L'endpoint di stato openCypher fornisce l'accesso alle informazioni sulle query attualmente in esecuzione sul server o in attesa di essere eseguite. Consente inoltre di annullare tali query. L'endpoint è:

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

È possibile utilizzare i metodi HTTP `GET` e `POST` per ottenere lo stato corrente dal server o per annullare una query. È inoltre possibile utilizzare il metodo `DELETE` per annullare una query in esecuzione o in attesa.

## Parametri per le richieste di stato
<a name="access-graph-opencypher-status-parameters"></a>

**Parametri delle query di stato**
+ **`includeWaiting`** (`true` o `false`): se impostato su `true` e non sono presenti altri parametri, vengono restituite le informazioni sullo stato per le query in attesa e per quelle in esecuzione.
+ **`cancelQuery`**: utilizzato solo con i metodi `GET` e `POST`, per indicare che si tratta di una richiesta di annullamento. Il metodo `DELETE` non richiede questo parametro.

  Il valore del parametro `cancelQuery` non viene utilizzato, ma quando `cancelQuery` è presente, è necessario il parametro `queryId` per identificare la query da annullare.
+ **`queryId`**: contiene l'ID di una query specifica.

  Se utilizzato con il metodo `GET` o `POST` e il parametro `cancelQuery` non è presente, `queryId` restituisce informazioni sullo stato per la query specifica che identifica. Se il parametro `cancelQuery` è presente, la query specifica identificata da `queryId` viene annullata.

  Se utilizzato con il metodo `DELETE`, `queryId` indica sempre una query specifica da annullare.
+ **`silent`**: utilizzato solo quando si annulla una query. Se impostato su `true`, l'annullamento avviene senza alcun avviso.

## Campi di risposta della richiesta di stato
<a name="access-graph-opencypher-status-response-fields"></a>

**Campi di risposta di stato se non viene fornito l'ID di una query specifica**
+ **acceptedQueryCount**— Il numero di interrogazioni che sono state accettate ma non ancora completate, incluse le interrogazioni in coda.
+ **runningQueryCount**— Il numero di query OpenCypher attualmente in esecuzione.
+ **queries**: elenco delle query openCypher correnti.

**Campi di risposta di stato per una query specifica**
+ **queryId**: ID GUID della query. Neptune assegna automaticamente questo valore ID a ogni query oppure è possibile assegnare un ID personalizzato (consulta [Inserimento di un ID personalizzato in una query Neptune Gremlin o SPARQL](features-query-id.md)).
+ **queryString**: la query inviata. Questa è troncata a 1024 caratteri nel caso in cui sia più lunga.
+ **queryEvalStats**— Statistiche per questa interrogazione:
  + **waited**: indica il tempo di attesa della query, in millisecondi.
  + **elapsed**: numero di millisecondi in cui la query è stata eseguita finora.
  + **cancelled**: `True` indica che la query è stata annullata, `False` che non è stata annullata.

## Esempi di richieste e risposte di stato
<a name="access-graph-opencypher-status-samples"></a>
+ **Richiesta dello stato di tutte le query, comprese quelle in attesa:**

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

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

  Per ulteriori informazioni, vedere [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html) nel AWS CLI Command Reference.

------
#### [ 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)
  ```

  Per esempi AWS SDK in altre lingue, consulta. [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"
  ```

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster Neptune.

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

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

------

  *Risposta:*

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **Richiesta dello stato delle query in esecuzione, **escluse** quelle in attesa:**

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

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

  Per ulteriori informazioni, vedere [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html) nel Command Reference. AWS CLI 

------
#### [ 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)
  ```

  Per esempi AWS SDK in altre lingue, consulta. [AWS SDK](access-graph-opencypher-sdk.md)

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

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

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster Neptune.

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

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

------

  *Risposta:*

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **Richiesta dello stato di una singola query:**

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

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

  Per ulteriori informazioni, vedere [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html) nel Command Reference. AWS CLI 

------
#### [ 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)
  ```

  Per esempi AWS SDK in altre lingue, consulta. [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"
  ```

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster Neptune.

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

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

------

  *Risposta:*

  ```
  {
    "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
    }
  }
  ```
+ **Richieste di annullamento di una query**

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

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

  Per ulteriori informazioni, vedere [cancel-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/cancel-open-cypher-query.html)nel AWS CLI Command Reference.

------
#### [ 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)
  ```

  Per esempi AWS SDK in altre lingue, consulta[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"
  ```

**Nota**  
Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci *us-east-1* con la regione del tuo cluster Neptune.

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

  1. Con `POST`:

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

  2. Con `GET`:

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

  3. Con `DELETE`:

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

------

  *Risposta:*

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