Format Serialisasi dalam Neptune Stream - Amazon Neptune

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Format Serialisasi dalam Neptune Stream

Amazon Neptunus menggunakan dua format berbeda untuk membuat serial data perubahan grafik untuk mencatat aliran, tergantung pada apakah grafik dibuat menggunakan Gremlin atau. SPARQL

Kedua format berbagi format serialisasi rekaman umum, seperti yang dijelaskan dalamFormat Respons Streaming API Neptunus, yang berisi bidang-bidang berikut:

  • commitTimestamp— Waktu di mana komit untuk transaksi diminta, dalam milidetik dari zaman Unix.

  • eventId— Pengidentifikasi urutan catatan perubahan aliran.

  • data— Gremlin serial,SPARQL, atau OpenCypher catatan perubahan. Format serialisasi setiap catatan dijelaskan secara lebih rinci di bagian selanjutnya.

  • op— Operasi yang menciptakan perubahan.

PG_ JSON Ubah Format Serialisasi

catatan

Pada rilis mesin 1.1.0.0, output format output aliran Gremlin (GREMLIN_JSON) oleh titik akhir aliran Gremlin () tidak digunakan lagi. https://Neptune-DNS:8182/gremlin/stream Ini digantikan oleh PG_JSON, yang saat ini identik dengan. GREMLIN_JSON

Gremlin atau catatan openCypher perubahan, yang terkandung dalam data bidang respons aliran log, memiliki bidang berikut:

  • id – STRING - Diperlukan.

    ID dari Gremlin atau openCypher elemen.

  • type – STRING - Diperlukan.

    Jenis Gremlin atau openCypher elemen ini. Harus berupa salah satu dari yang berikut:

    • vl- Label Vertex untuk Gremlin; label simpul untuk. openCypher

    • vp- Properti Vertex untuk Gremlin; properti node untuk. openCypher

    • e- Label tepi dan tepi untuk Gremlin; jenis hubungan dan hubungan untuk. openCypher

    • ep— Properti tepi untuk Gremlin; properti hubungan untuk. openCypher

  • key – STRING - Diperlukan.

    Nama properti. Untuk label elemen, ini adalah “label”.

  • value— objek value, diperlukan.

    Ini adalah JSON objek yang berisi value bidang untuk nilai itu sendiri, dan datatype bidang untuk tipe JSON data dari nilai itu.

    "value": { "value": "the new value", "dataType": "the JSON datatype of the new value" }
  • from- String, opsional.

    Jika ini adalah tepi (type="e”), ID yang sesuai dari simpul atau sumber simpul.

  • to- String, opsional.

    Jika ini adalah tepi (type="e”), ID yang sesuai dengan simpul atau target node.

Contoh Gremlin
  • Berikut ini adalah contoh label vertex Gremlin.

    { "id": "an ID string", "type": "vl", "key": "label", "value": { "value": "the new value of the vertex label", "dataType": "String" } }
  • Berikut ini adalah contoh properti vertex 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" } }
  • Berikut ini adalah contoh edge 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 Contoh
  • Berikut ini adalah contoh label openCypher node.

    { "id": "an ID string", "type": "vl", "key": "label", "value": { "value": "the new value of the node label", "dataType": "String" } }
  • Berikut ini adalah contoh dari properti openCypher node.

    { "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" } }
  • Berikut ini adalah contoh dari sebuah openCypher hubungan.

    { "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" }

SPARQLNQUADSUbah Format Serialisasi

Neptunus mencatat perubahan SPARQL ke paha depan dalam grafik menggunakan bahasa Resource Description Framework RDF (N-QUADS) yang ditentukan dalam spesifikasi W3C 1.1 N-Quads. RDF

dataBidang dalam catatan perubahan hanya berisi stmt bidang yang memegang QUADS pernyataan N- mengekspresikan quad yang diubah, seperti pada contoh berikut.

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