我想在 Azure Cosmos DB Graph API 项目中将机场 GeoCoordinate 数据[ IATA Code , latitude , longitude ]转换为 Gremlin Vertex . Vertex 转换主要通过 Asp.Net Core 2.0 console application 使用 CSVReader 来传输和转换来自 airport.dat (csv)文件的数据 . 这个过程包括转换超过6,000行......
因此,例如,在原始 airport.dat 源文件中, Montreal Pierre Elliott Trudeau International Airport 将使用与下面类似的模型列出:
1,"Montreal / Pierre Elliott Trudeau International Airport","Montreal","Canada","YUL","CYUL",45.4706001282,-73.7407989502,118,-5,"A","America/Toronto","airport","OurAirports"
然后,如果我在我的鳕鱼中定义了一个 Gremlin Vertex 创建查询,如下所示:
var gremlinQuery = $"g.addV('airport').property('id', \"{code}\").property('latitude', {lat}).property('longitude', {lng})";
然后在启动控制台应用程序时,将以完全相似的方式成功生成 Vertex 转换过程:
1 g.addV('airport').property('id', "YUL").property('latitude', 45.4706001282).property('longitude', -73.7407989502)
请注意,对于 Montreal Airport (位于N.A而不是远东...), longitude 已正确格式化为 minus ( - ) prefix ,但在Azure门户上执行查询时似乎正在丢失 .
{
"id": "YUL",
"label": "airport",
"type": "vertex",
"properties": {
"latitude": [
{
"id": "13a30a4f-42cc-4413-b201-11efe7fa4dbb",
"value": 45.4706001282
}
],
"longitude": [
{
"id": "74554911-07e5-4766-935a-571eedc21ca3",
"value": 73.7407989502 <---- //Should be displayed as -73.7407989502
}
]
}
这有点尴尬 . 如果有人遇到类似的问题并且能够修复它,那么我完全愿意接受建议 .
谢谢
2 回答
根据你的描述,我刚刚在我身边执行了Gremlin查询,我可以检索插入的Vertex,如下所示:
然后,我只是在Azure Portal上查询并检索记录,如下所示:
根据我的理解,您需要检查代码的执行情况并验证查询的响应以缩小此问题的范围 .
感谢您的建议,但问题现在已经解决了 . 在 .Net 4.5.2 [& . ]的情况下,以前建议的工作答案方案[和投票1 ...]早已得到解决 . Net 4.6.1 ]版本与 Microsoft.Azure.Graph 0.2.4 -preview 结合使用 . 我的问题并没有真正关注那个问题而且可能有点微妙......或许我应该更加强调这个问题主要与 Core 2.0 dotnet CLI 场景中使用的 Microsoft.Azure.Graph 0.3.1 -preview 有关 .
根据以下图表 - Multiple issues with parsing of numeric constants in the graph gremlin query #438 对 Github 的评论,
https://github.com/Azure/azure-documentdb-dotnet/issues/438
确实有一些公平的理由相信这个问题是 Microsoft.Azure.Graph 0.3.1 -preview 的错误 . 我选择使用 Gremlin.Net 方法,并设法得到我预期的正确结果 .