

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Beispiele für Neptune-Streams
<a name="streams-examples"></a>

Die folgenden Beispiele zeigen, wie Sie auf Änderungsprotokoll-Stream-Daten in Amazon Neptune zugreifen.

**Topics**
+ [`AT_SEQUENCE_NUMBER`-Änderungsprotokoll](#streams-examples-at_seq)
+ [`AFTER_SEQUENCE_NUMBER`-Änderungsprotokoll](#streams-examples-after_seq)
+ [`TRIM_HORIZON`-Änderungsprotokoll](#streams-examples-trim)
+ [`LATEST`-Änderungsprotokoll](#streams-examples-trim)
+ [Komprimierungsänderungsprotokoll](#streams-examples-compress)

## `AT_SEQUENCE_NUMBER`-Änderungsprotokoll
<a name="streams-examples-at_seq"></a>

Das folgende Beispiel zeigt ein Gremlin- oder openCypher-`AT_SEQUENCE_NUMBER`-Änderungsprotokoll.

```
curl -s "https://Neptune-DNS:8182/propertygraph/stream?limit=1&commitNum=1&opNum=1&iteratorType=AT_SEQUENCE_NUMBER" |jq
{
  "lastEventId": {
    "commitNum": 1,
    "opNum": 1
  },
  "lastTrxTimestamp": 1560011610678,
  "format": "PG_JSON",
  "records": [
    {
      "eventId": {
        "commitNum": 1,
        "opNum": 1
      },
      "commitTimestamp": 1560011610678,
      "data": {
        "id": "d2b59bf8-0d0f-218b-f68b-2aa7b0b1904a",
        "type": "vl",
        "key": "label",
        "value": {
          "value": "vertex",
          "dataType": "String"
        }
      },
      "op": "ADD",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```

Dies ist ein SPARQL-Beispiel eines `AT_SEQUENCE_NUMBER`-Änderungsprotokolls.

```
curl -s "https://localhost:8182/sparql/stream?limit=1&commitNum=1&opNum=1&iteratorType=AT_SEQUENCE_NUMBER" |jq
{
  "lastEventId": {
    "commitNum": 1,
    "opNum": 1
  },
  "lastTrxTimestamp": 1571252030566,
  "format": "NQUADS",
  "records": [
    {
      "eventId": {
        "commitNum": 1,
        "opNum": 1
      },
      "commitTimestamp": 1571252030566,
      "data": {
        "stmt": "<https://test.com/s> <https://test.com/p> <https://test.com/o> .\n"
      },
      "op": "ADD",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```

## `AFTER_SEQUENCE_NUMBER`-Änderungsprotokoll
<a name="streams-examples-after_seq"></a>

Das folgende Beispiel zeigt ein Gremlin- oder openCypher-`AFTER_SEQUENCE_NUMBER`-Änderungsprotokoll.

```
curl -s "https://Neptune-DNS:8182/propertygraph/stream?limit=1&commitNum=1&opNum=1&iteratorType=AFTER_SEQUENCE_NUMBER" |jq
{
  "lastEventId": {
    "commitNum": 2,
    "opNum": 1
  },
  "lastTrxTimestamp": 1560011633768,
  "format": "PG_JSON",
  "records": [
    {
      "commitTimestamp": 1560011633768,
      "eventId": {
        "commitNum": 2,
        "opNum": 1
      },
      "data": {
        "id": "d2b59bf8-0d0f-218b-f68b-2aa7b0b1904a",
        "type": "vl",
        "key": "label",
        "value": {
          "value": "vertex",
          "dataType": "String"
        }
      },
      "op": "REMOVE",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```

## `TRIM_HORIZON`-Änderungsprotokoll
<a name="streams-examples-trim"></a>

Das folgende Beispiel zeigt ein Gremlin- oder openCypher-`TRIM_HORIZON`-Änderungsprotokoll.

```
curl -s "https://Neptune-DNS:8182/propertygraph/stream?limit=1&iteratorType=TRIM_HORIZON" |jq
{
  "lastEventId": {
    "commitNum": 1,
    "opNum": 1
  },
  "lastTrxTimestamp": 1560011610678,
  "format": "PG_JSON",
  "records": [
    {
      "commitTimestamp": 1560011610678,
      "eventId": {
        "commitNum": 1,
        "opNum": 1
      },
      "data": {
        "id": "d2b59bf8-0d0f-218b-f68b-2aa7b0b1904a",
        "type": "vl",
        "key": "label",
        "value": {
          "value": "vertex",
          "dataType": "String"
        }
      },
      "op": "ADD",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```

## `LATEST`-Änderungsprotokoll
<a name="streams-examples-trim"></a>

Das folgende Beispiel zeigt ein Gremlin- oder openCypher-`LATEST`-Änderungsprotokoll. Beachten Sie, dass die API-Parameter `limit`, `commitNum` und `opNum` vollständig optional sind.

```
curl -s "https://Neptune-DNS:8182/propertygraph/stream?iteratorType=LATEST" | jq
{
  "lastEventId": {
    "commitNum": 21,
    "opNum": 4
  },
  "lastTrxTimestamp": 1634710497743,
  "format": "PG_JSON",
  "records": [
    {
      "commitTimestamp": 1634710497743,
      "eventId": {
        "commitNum": 21,
        "opNum": 4
      },
      "data": {
        "id": "24be4e2b-53b9-b195-56ba-3f48fa2b60ac",
        "type": "e",
        "key": "label",
        "value": {
          "value": "created",
          "dataType": "String"
        },
        "from": "4",
        "to": "5"
      },
      "op": "REMOVE",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```

## Komprimierungsänderungsprotokoll
<a name="streams-examples-compress"></a>

Das folgende Beispiel zeigt ein Gremlin- oder openCypher-Komprimierungsänderungsprotokoll.

```
curl -sH \
  "Accept-Encoding: gzip" \
  "https://Neptune-DNS:8182/propertygraph/stream?limit=1&commitNum=1" \
  -H "Accept-Encoding: gzip" \
  -v |gunzip -|jq
> GET /propertygraph/stream?limit=1 HTTP/1.1
> Host: localhost:8182
> User-Agent: curl/7.64.0
> Accept: /
> Accept-Encoding: gzip
*> Accept-Encoding: gzip*
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Connection: keep-alive
*< content-encoding: gzip*
< content-length: 191
<
{ [191 bytes data]
Connection #0 to host localhost left intact
{
  "lastEventId": "1:1",
  "lastTrxTimestamp": 1558942160603,
  "format": "PG_JSON",
  "records": [
    {
      "commitTimestamp": 1558942160603,
      "eventId": "1:1",
      "data": {
        "id": "v1",
        "type": "vl",
        "key": "label",
        "value": {
          "value": "person",
          "dataType": "String"
        }
      },
      "op": "ADD",
      "isLastOp": true
    }
  ],
  "totalRecords": 1
}
```