向Edge添加属性将删除与inV的连接

时间:2018-05-16 23:06:27

标签: graph azure-cosmosdb gremlin

运行以下命令后,我的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"
}
}]

1 个答案:

答案 0 :(得分:3)

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

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

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