【问题标题】:Adding property to Edge removes connection to inV向 Edge 添加属性会删除与 inV 的连接
【发布时间】:2018-05-16 23:06:27
【问题描述】:

运行下面的命令后,我的 Edge 是这样的:

[
 {
 "id": "ee186ef3-5b0d-4257-a0ab-cc13dbac1c84",
 "label": "parent",
 "type": "edge",
 "outVLabel": "person",
 "outV": "74e99ad8-a6f8-4580-918c-2446acaae48c",
 "properties": {
  "type": "Mother",
  "age": "56"
  }
 }
]

注意边缘上没有 inV。

运行的命令是这样的:

g.V('74e99ad8-a6f8-4580-918c-2446acaae48c')
 .inE('parent')
 .has('type', 'Mother')
 .property('age', '56')

在运行命令之前,关系是正确的 V -> E -> V

这是通过 C# .net 应用程序执行的

***** 编辑 -- 复制信息 ******

        var query = client.CreateGremlinQuery<dynamic>(graph, gremlin);
        var result = (await query.ExecuteNextAsync() as FeedResponse<object>);

运行命令前:

[{
"id": "7d3f2d1e-fb73-4e5d-a1b1-ea27fc429ce6",
"label": "parent",
"type": "edge",
"inVLabel": "person",
"outVLabel": "person",
"inV": "1c0d509f-6741-4555-8081-536b0c0b8667",
"outV": "f8da3c1c-0f32-4b5c-ace3-1673836807a1",
"properties": {
  "type": "Mother"
}
}]

下一步是运行这个:

g.V('1c0d509f-6741-4555-8081-536b0c0b8667').inE('parent').has('type', 'Mother').property('age', '56')

服务器返回的结果:

{{
"id": "7d3f2d1e-fb73-4e5d-a1b1-ea27fc429ce6",
"label": "parent",
"type": "edge",
"inVLabel": "person",
"outVLabel": "person",
"inV": "1c0d509f-6741-4555-8081-536b0c0b8667",
"outV": "f8da3c1c-0f32-4b5c-ace3-1673836807a1",
"properties": {
  "type": "Mother"
}
}}

在上面之后,我运行这个: g.E("7d3f2d1e-fb73-4e5d-a1b1-ea27fc429ce6")

结果:

[{
"id": "7d3f2d1e-fb73-4e5d-a1b1-ea27fc429ce6",
"label": "parent",
"type": "edge",
"outVLabel": "person",
"outV": "1c0d509f-6741-4555-8081-536b0c0b8667",
"properties": {
  "type": "Mother",
  "age": "56"
}
}]

【问题讨论】:

    标签: graph azure-cosmosdb gremlin


    【解决方案1】:

    如果您使用的是 Microsoft.Azure.Graphs,请切换到 Gremlin .Net

    https://docs.microsoft.com/en-us/azure/cosmos-db/create-graph-dotnet

    Gremlin .Net 是 Azure Cosmos DB 推荐的库,它包含最新的功能、错误修复和性能改进。

    【讨论】:

    • 我正在使用:Azure.DocumentDB v1.22.0 Azure.Graphs v0.3.1-preview var query = client.CreateGremlinQuery(graph, gremlin); var result = (await query.ExecuteNextAsync() asFeedResponse);
    • 在 gremlin 页面上:“警告 Gremlin.Net 尚未正式发布。它适用于希望在 .NET 生态系统中试验 TinkerPop 的开发人员。”
    • FWIW - 因为这个文档docs.microsoft.com/en-us/azure/cosmos-db/…,我正在使用这些库。
    • Gremlin.Net 的作者之一:您现在可以忽略该警告。版本 3.2.7 是 Gremlin.Net 的第一个正式版本。我们只是忘记删除该版本的警告,但现在已删除:tinkerpop.apache.org/docs/3.2.9/reference/#gremlin-DotNet 请确保您使用 Cosmos DB 的 3.2.z 版本,因为它不支持 TinkerPop(因此不支持 Gremlin.Net)3.3。 z.
    • 不知道为什么这会修复它..但更改为 Gremlin.net 已修复。其他所有命令都可以在 MS 驱动程序中正常运行,但添加该属性会产生副作用。
    猜你喜欢
    • 2016-01-08
    • 2011-11-01
    • 2015-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多