选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

用于数据的 Neptune 数据模型 OpenSearch

聚焦模式
用于数据的 Neptune 数据模型 OpenSearch - Amazon Neptune

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon Neptune 使用统一的 JSON 文档结构在服务中存储 SPARQL 和 Gremlin 数据。 OpenSearch 中的每个文档都 OpenSearch 对应一个实体,并存储该实体的所有相关信息。对于 Gremlin 来说,顶点和边被视为实体,因此相应的 OpenSearch 文档包含有关顶点、标签和属性的信息。对于 SPARQL,主题可以被视为实体,因此相应的 OpenSearch 文档在一个文档中包含有关所有谓词-对象对的信息。

注意

Neptune-to-OpenSearch复制实现仅存储字符串数据。但是,您可以对其进行修改以存储其他数据类型。

统一 JSON 文档结构如下所示。

{ "entity_id": "Vertex Id/Edge Id/Subject URI", "entity_type": [List of Labels/rdf:type object value], "document_type": "vertex/edge/rdf-resource" "predicates": { "Property name or predicate URI": [ { "value": "Property Value or Object Value", "graph": "(Only for Sparql) Named Graph Quad is present" "language": "(Only for Sparql) rdf:langString" }, { "value": "Property Value 2/ Object Value 2", } ] } }
  • entity_id – 表示文档的实体唯一 ID。

    • 对于 SPARQL,这是主语 URI。

    • 对于 Gremlin,这是 Vertex_IDEdge_ID

  • entity_type – 表示顶点或边缘的一个或多个标签,或者表示主题的零个或多个 rdf:type 谓词值。

  • document_type – 用于指定当前文档表示顶点、边缘还是 rdf 资源。

  • predicates – 对于 Gremlin,存储顶点或边缘的属性和值。对于 SPARQL,它存储谓语-宾语对。

    属性名称采用的properties.name.value格式为 OpenSearch。要查询它,您必须以该形式命名它。

  • value – Gremlin 的属性值或者 SPARQL 的对象值。

  • graph – SPARQL 的命名图形。

  • language – SPARQL 中 rdf:langString 文本的语言标签。

SPARQL 文档 OpenSearch 示例

数据

@prefix dt: <http://example.org/datatype#> . @prefix ex: <http://example.org/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . ex:simone rdf:type ex:Person ex:g1 ex:michael rdf:type ex:Person ex:g1 ex:simone ex:likes "spaghetti" ex:g1 ex:simone ex:knows ex:michael ex:g2 # Not stored in ES ex:simone ex:likes "spaghetti" ex:g2 ex:simone ex:status "La vita è un sogno"@it ex:g2 ex:simone ex:age "40"^^xsd:int DG # Not stored in ES ex:simone ex:dummy "testData"^^dt:newDataType DG # Not stored in ES ex:simone ex:hates _:bnode # Not stored in ES _:bnode ex:means "coding" DG # Not stored in ES

Documents

{ "entity_id": "http://example.org/simone", "entity_type": ["http://example.org/Person"], "document_type": "rdf-resource" "predicates": { "http://example.org/likes": [ { "value": "spaghetti", "graph": "http://example.org/g1" }, { "value": "spaghetti", "graph": "http://example.org/g2" } ] "http://example.org/status": [ { "value": "La vita è un sogno", "language": "it" // Only present for rdf:langString } ] } }
{ "entity_id" : "http://example.org/michael", "entity_type" : ["http://example.org/Person"], "document_type": "rdf-resource" }

Gremlin 文档 OpenSearch 示例

数据

# Vertex 1 simone label Person <== Label simone likes "spaghetti" <== Property simone likes "rice" <== Property simone age 40 <== Property # Vertex 2 michael label Person <== Label # Edge 1 simone knows michael <== Edge e1 updated "2019-07-03" <== Edge Property e1 through "company" <== Edge Property e1 since 10 <== Edge Property

Documents

{ "entity_id": "simone", "entity_type": ["Person"], "document_type": "vertex", "predicates": { "likes": [ { "value": "spaghetti" }, { "value": "rice" } ] } }
{ "entity_id" : "michael", "entity_type" : ["Person"], "document_type": "vertex" }
{ "entity_id": "e1", "entity_type": ["knows"], "document_type": "edge" "predicates": { "through": [ { "value": "company" } ] } }

本页内容

隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。