翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
Neptune Streams のシリアル化形式
Amazon Neptune では、2 つの異なる形式を使用して、グラフ変更データをログストリームにシリアル化します。これは、グラフが Gremlin と SPARQL のどちらを使用して作成されたかによって異なります。
両方のフォーマットは、Neptune Streams API レスポンスの形式 で説明されているように、共通のレコードシリアル化形式を共有します。これには、以下のフィールドが含まれています。
commitTimestamp
- トランザクションのコミットがリクエストされた時間 (Unix エポックからのミリ秒単位)。eventId
- ストリームレスポンスの最後の変更のシーケンス識別子。data
– シリアル化された Gremlin、SPARQL、または OpenCypher 変更レコード。各レコードのシリアル化形式については、次のセクションで詳しく説明します。op
— 変更を作成した操作。
PG_JSON 変更のシリアル化形式
注記
エンジンリリース 1.1.0.0 現在、Gremlin ストリームエンドポイント (https://
) が出力した Gremlin ストリームの出力形式 (Neptune-DNS
:8182/gremlin/streamGREMLIN_JSON
) は非推奨です。これは PG_JSON に置き換えられます。PG_JSON は現在 GREMLIN_JSON
と同じです。
ログストリームレスポンスの data
フィールドに含まれる Gremlin または openCypher 変更レコードには、以下のフィールドが含まれます。
-
id
- 文字列、必須。Gremlin または openCypher 要素の ID。
-
type
- 文字列、必須。この Gremlin または openCypher 要素のタイプ。以下のいずれかである必要があります。
vl
— Gremlin の頂点ラベル、openCypher のノードラベル。vp
— Gremlin の頂点プロパティ、openCypher のノードプロパティ。e
— Gremlin のエッジとエッジラベル、openCypher のリレーションシップとリレーションシップタイプ。ep
— Gremlin のエッジプロパティ、openCypher のリレーションシッププロパティ。
-
key
- 文字列、必須。プロパティ名。要素ラベルの場合、これは "label" です。
-
value
–value
オブジェクト、必須。これは、値自体の
value
フィールドと、その値の JSON データ型のdatatype
フィールドを含む JSON オブジェクトです。"value": { "value": "
the new value
", "dataType": "the JSON datatype of the new value
" } -
from
- 文字列、オプション。これがエッジ (type="e") である場合、対応する from 頂点または始点ノードの ID。
-
to
- 文字列、オプション。これがエッジ (type="e") である場合、対応する to 頂点またはターゲットノードの 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
" }
SPARQL NQUADS 変更のシリアル化形式
Neptune は W3C RDF 1.1 N-QuadsN-QUADS
言語を使用して、グラフ内の SPARQL クワッドの変更を記録します。
次の例のように、変更レコードの data
フィールドには、変更されたクアッドを表す N-QUADS ステートメントを保持する stmt
フィールドが含まれます。
"stmt" : "<https://test.com/s> <https://test.com/p> <https://test.com/o> .\n"