Neptune 스트림의 직렬화 형식 - Amazon Neptune

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Neptune 스트림의 직렬화 형식

Amazon Neptune은 그래프가 Gremlin을 사용하여 생성되었는지 또는 Gremlin을 사용하여 생성되었는지 여부에 따라 두 가지 형식을 사용하여 그래프 변경 데이터를 로그 스트림으로 직렬화합니다. SPARQL

Neptune 스트림 응답 형식 API에 설명된 대로 두 형식 모두 다음 필드를 포함하는 공통 레코드 직렬화 형식을 공유합니다.

  • commitTimestamp   –   트랜잭션에 대한 커밋이 요청된 시점입니다(Unix epoch의 밀리초).

  • eventId   –   스트림 변경 레코드의 시퀀스 식별자입니다.

  • data— 직렬화된 Gremlin, 또는 변경 레코드. SPARQL OpenCypher 각 레코드의 직렬화된 형식은 다음 섹션에 자세히 설명되어 있습니다.

  • op   –   변경을 일으킨 작업입니다.

PG_ JSON 직렬화 형식 변경

참고

엔진 릴리스 1.1.0.0부터 Gremlin 스트림 엔드포인트(https://Neptune-DNS:8182/gremlin/stream)에서 출력되는 Gremlin 스트림 출력 형식(GREMLIN_JSON)은 더 이상 사용되지 않습니다. 현재와 동일한 JSON PG_로 대체됩니다. GREMLIN_JSON

로그 스트림 응답 data 필드에 포함된 Gremlin 또는 openCypher 변경 레코드에는 다음과 같은 필드가 있습니다.

  • id – 문자열(필수).

    그렘린 또는 요소의 ID. openCypher

  • type – 문자열(필수).

    이 그렘린 또는 요소의 유형. openCypher 다음 중 하나여야 합니다.

    • vl— 그렘린의 버텍스 레이블, 그렘린의 노드 레이블. openCypher

    • vp— 그렘린의 정점 속성, 노드 속성 openCypher

    • e— Gremlin의 엣지 및 엣지 레이블, 관계 및 관계 유형. openCypher

    • ep— 그렘린의 에지 속성, 관계 속성 openCypher

  • key – 문자열(필수).

    속성 이름입니다. 요소 레이블에서 속성 이름은 “label”입니다.

  • value – value 객체(필수).

    이 JSON 객체는 값 자체에 대한 value 필드와 해당 값의 JSON 데이터 유형에 대한 datatype 필드를 포함하는 객체입니다.

    "value": { "value": "the new value", "dataType": "the JSON datatype of the new value" }
  • from – 문자열(선택 사항).

    이것이 엣지(type="e")일 경우, 해당되는 소스 버텍스 또는 소스 노드의 ID입니다.

  • to – 문자열(선택 사항).

    이것이 엣지(type="e")일 경우, 해당되는 대상 버텍스 또는 대상 노드의 ID입니다.

Gremlin 예제
  • 다음은 Gremlin 버텍스 레이블의 예제입니다.

    { "id": "an ID string", "type": "vl", "key": "label", "value": { "value": "the new value of the vertex label", "dataType": "String" } }
  • 다음은 Gremlin 버텍스 속성의 예제입니다.

    { "id": "an ID string", "type": "vp", "key": "the property name", "value": { "value": "the new value of the vertex property", "dataType": "the datatype of the vertex property" } }
  • 다음은 Gremlin 엣지의 예제입니다.

    { "id": "an ID string", "type": "e", "key": "label", "value": { "value": "the new value of the edge", "dataType": "String" }, "from": "the ID of the corresponding "from" vertex", "to": "the ID of the corresponding "to" vertex" }
openCypher 예시:
  • 다음은 openCypher 노드 레이블의 예입니다.

    { "id": "an ID string", "type": "vl", "key": "label", "value": { "value": "the new value of the node label", "dataType": "String" } }
  • 다음은 openCypher 노드 속성의 예입니다.

    { "id": "an ID string", "type": "vp", "key": "the property name", "value": { "value": "the new value of the node property", "dataType": "the datatype of the node property" } }
  • 다음은 openCypher 관계의 예입니다.

    { "id": "an ID string", "type": "e", "key": "label", "value": { "value": "the new value of the relationship", "dataType": "String" }, "from": "the ID of the corresponding source node", "to": "the ID of the corresponding target node" }

SPARQLNQUADS직렬화 형식 변경

Neptune은 W3C 1.1 SPARQL N-Quads 사양에 정의된 리소스 설명 프레임워크 RDF (N-QUADS) 언어를 사용하여 그래프의 쿼드에 대한 변경 사항을 기록합니다 RDF.

변경 레코드의 data 필드에는 다음 예와 같이 변경된 stmt 쿼드를 나타내는 N- QUADS 문이 들어 있는 필드만 포함됩니다.

"stmt" : "<https://test.com/s> <https://test.com/p> <https://test.com/o> .\n"