Amazon Neptune · JSON Structure

Amazon Neptune Stream Record Structure

Represents a change-log stream record from Neptune Streams. Each record captures a single mutation (ADD or REMOVE) made to graph data. Supports both property graph (PG_JSON format) and RDF (NQUADS format) records.

Type: object Properties: 5 Required: 5
DatabaseGraph DatabaseGremlinNeptuneProperty GraphRDFSPARQL

Amazon Neptune Stream Record is a JSON Structure definition published by Amazon Neptune, describing 5 properties, of which 5 are required. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

lastEventId lastTrxTimestamp format records totalRecords

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://github.com/api-search/amazon-neptune/json-structure/amazon-neptune-stream-record-structure.json",
  "name": "Amazon Neptune Stream Record",
  "description": "Represents a change-log stream record from Neptune Streams. Each record captures a single mutation (ADD or REMOVE) made to graph data. Supports both property graph (PG_JSON format) and RDF (NQUADS format) records.",
  "type": "object",
  "required": [
    "lastEventId",
    "lastTrxTimestamp",
    "format",
    "records",
    "totalRecords"
  ],
  "properties": {
    "lastEventId": {
      "$ref": "#/$defs/EventId",
      "description": "The sequence identifier of the last change in the response."
    },
    "lastTrxTimestamp": {
      "type": "int32",
      "description": "Unix epoch timestamp in milliseconds of the last transaction commit."
    },
    "format": {
      "type": "string",
      "description": "The serialization format of the stream records.",
      "enum": [
        "PG_JSON",
        "NQUADS"
      ]
    },
    "records": {
      "type": "array",
      "description": "The array of change-log stream records.",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/PropertyGraphRecord"
          },
          {
            "$ref": "#/$defs/SparqlRecord"
          }
        ]
      }
    },
    "totalRecords": {
      "type": "int32",
      "description": "The total number of records in the response."
    }
  },
  "definitions": {
    "EventId": {
      "type": "object",
      "name": "EventId",
      "description": "A unique sequence identifier for a stream event, composed of the commit number and operation number.",
      "required": [
        "commitNum",
        "opNum"
      ],
      "properties": {
        "commitNum": {
          "type": "int32",
          "description": "The commit (transaction) number."
        },
        "opNum": {
          "type": "int32",
          "description": "The operation number within the commit."
        }
      }
    },
    "PropertyGraphRecord": {
      "type": "object",
      "name": "PropertyGraphRecord",
      "description": "A change record for property graph (Gremlin/openCypher) data in PG_JSON format.",
      "required": [
        "commitTimestamp",
        "eventId",
        "data",
        "op"
      ],
      "properties": {
        "commitTimestamp": {
          "type": "int32",
          "description": "Unix epoch timestamp in milliseconds of the transaction commit."
        },
        "eventId": {
          "$ref": "#/$defs/EventId"
        },
        "data": {
          "$ref": "#/$defs/PropertyGraphData"
        },
        "op": {
          "type": "string",
          "description": "The operation type.",
          "enum": [
            "ADD",
            "REMOVE"
          ]
        },
        "isLastOp": {
          "type": "boolean",
          "description": "True only if this is the last operation in the transaction."
        }
      }
    },
    "PropertyGraphData": {
      "type": "object",
      "name": "PropertyGraphData",
      "description": "The property graph change data within a stream record.",
      "required": [
        "id",
        "type"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The unique identifier of the graph element."
        },
        "type": {
          "type": "string",
          "description": "The type of graph element: v (vertex), vl (vertex label), vp (vertex property), e (edge), ep (edge property).",
          "enum": [
            "v",
            "vl",
            "vp",
            "e",
            "ep"
          ]
        },
        "key": {
          "type": "string",
          "description": "The property key name (for property changes)."
        },
        "value": {
          "type": "object",
          "description": "The typed property value.",
          "properties": {
            "value": {
              "description": "The actual value."
            },
            "dataType": {
              "type": "string",
              "description": "The Neptune data type.",
              "enum": [
                "String",
                "Integer",
                "Long",
                "Double",
                "Float",
                "Boolean",
                "Date",
                "DateTime"
              ]
            }
          }
        },
        "from": {
          "type": "string",
          "description": "The source vertex ID (for edge records only)."
        },
        "to": {
          "type": "string",
          "description": "The target vertex ID (for edge records only)."
        }
      }
    },
    "SparqlRecord": {
      "type": "object",
      "name": "SparqlRecord",
      "description": "A change record for RDF (SPARQL) data in NQUADS format.",
      "required": [
        "commitTimestamp",
        "eventId",
        "data",
        "op"
      ],
      "properties": {
        "commitTimestamp": {
          "type": "int32",
          "description": "Unix epoch timestamp in milliseconds of the transaction commit."
        },
        "eventId": {
          "$ref": "#/$defs/EventId"
        },
        "data": {
          "type": "object",
          "required": [
            "stmt"
          ],
          "properties": {
            "stmt": {
              "type": "string",
              "description": "The N-Quads statement representing the RDF triple or quad change."
            }
          }
        },
        "op": {
          "type": "string",
          "description": "The operation type.",
          "enum": [
            "ADD",
            "REMOVE"
          ]
        },
        "isLastOp": {
          "type": "boolean",
          "description": "True only if this is the last operation in the transaction."
        }
      }
    }
  }
}