将 SPARQL 和 Gremlin 数据类型映射到 OpenSearch - Amazon Neptune
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

将 SPARQL 和 Gremlin 数据类型映射到 OpenSearch

OpenSearch 中的新数据类型映射是根据属性或对象中使用的数据类型创建的。由于某些字段包含不同类型的值,因此初始映射可能会排除该字段的某些值。

Neptune 数据类型映射到 OpenSearch 数据类型,如下所示:

SPARQL 类型 Gremlin 类型 OpenSearch 类型

XSD:int

XSD:unsignedInt

XSD:integer

XSD:byte

XSD:unsignedByte

XSD:short

XSD:unsignedShort

XSD:long

XSD:unsignedLong

byte

short

int

long

long

XSD:float

XSD:double

XSD:decimal

float

double

double

XSD:boolean

bool

boolean

XSD:datetime

XSD:date

date

date

XSD:string

XSD:time

string

text

自定义数据类型

不适用

text

任何其它数据类型

不适用

text

例如,以下 Gremlin 更新查询会导致向 OpenSearch 中添加“newField”的新映射,即 { "type" : "double" }

g.V("1").property("newField" 10.5)

同样,以下 SPARQL 更新查询会导致向 OpenSearch 中添加“ex:byte”的新映射,即 { "type" : "long" }

PREFIX ex: <http://my/example#> PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> INSERT DATA { ex:test ex:byte "123"^^xsd:byte }.
注意

如您所见,从 Neptune 映射到 OpenSearch 的项目在 OpenSearch 中的数据类型可能与它在 Neptune 中具有的数据类型不同。但是,OpenSearch 中有一个显式文本字段,即“datatype”,用于记录该项目在 Neptune 中的数据类型。