删除边缘 属性 是否预期会删除其边缘?
Is dropping an edge property expected to drop its edge?
在 DSE v5.0.3 中,我遇到了丢弃边缘 属性 也会丢弃其边缘的情况。
两个 gremlin 控制台示例都使用以下架构配置:
gremlin> system.graph('example').create()
==>null
gremlin> :remote config alias g example.g
==>g=example.g
gremlin> schema.propertyKey('notes').Text().single().create()
==>null
gremlin> schema.vertexLabel('person').create()
==>null
gremlin> schema.edgeLabel('knows').properties('notes').create()
==>null
gremlin> schema.edgeLabel('knows').connection('person', 'person').add()
==>null
在以下示例中,删除边 属性 会导致删除边本身:
gremlin> person1 = g.addV('person').next()
==>v[{~label=person, community_id=1566048896, member_id=0}]
gremlin> person2 = g.addV('person').next()
==>v[{~label=person, community_id=1062113536, member_id=0}]
gremlin> knows = g.V(person1).addE('knows').to(V(person2)).property('notes', 'online').next()
==>e[{~type=knows, out_vertex={~label=person, community_id=1566048896, member_id=0}, in_vertex={~label=person, community_id=1062113536, member_id=0}, local_id=4cd8f8e2-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1566048896, member_id=0}-knows->{~label=person, community_id=1062113536, member_id=0}]
gremlin> g.E(knows)
==>e[{~type=knows, out_vertex={~label=person, community_id=1566048896, member_id=0}, in_vertex={~label=person, community_id=1062113536, member_id=0}, local_id=4cd8f8e2-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1566048896, member_id=0}-knows->{~label=person, community_id=1062113536, member_id=0}]
gremlin> g.E(knows).properties('notes')
==>p[notes->online]
gremlin> g.E(knows).properties('notes').drop()
gremlin> g.E(knows)
gremlin>
下一个示例创建了相同的数据集,但不是在与 addE
步骤相同的遍历中设置 'notes' 属性,而是创建 属性 在一个单独的遍历中。与上面的示例不同,删除 'notes' 属性 会删除 属性,同时保持边缘完好无损。
gremlin> person1 = g.addV('person').next()
==>v[{~label=person, community_id=1437137920, member_id=0}]
gremlin> person2 = g.addV('person').next()
==>v[{~label=person, community_id=1317720192, member_id=0}]
gremlin> knows = g.V(person1).addE('knows').to(V(person2)).next()
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).property('notes', 'online')
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).properties()
==>p[notes->online]
gremlin> g.E(knows).properties('notes').drop()
gremlin> g.E(knows)
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).properties()
gremlin>
感谢您对 Leifur 的反馈。这似乎是一个错误,我们已经提交了内部 JIRA,工程团队正在调查。
在 DSE v5.0.3 中,我遇到了丢弃边缘 属性 也会丢弃其边缘的情况。
两个 gremlin 控制台示例都使用以下架构配置:
gremlin> system.graph('example').create()
==>null
gremlin> :remote config alias g example.g
==>g=example.g
gremlin> schema.propertyKey('notes').Text().single().create()
==>null
gremlin> schema.vertexLabel('person').create()
==>null
gremlin> schema.edgeLabel('knows').properties('notes').create()
==>null
gremlin> schema.edgeLabel('knows').connection('person', 'person').add()
==>null
在以下示例中,删除边 属性 会导致删除边本身:
gremlin> person1 = g.addV('person').next()
==>v[{~label=person, community_id=1566048896, member_id=0}]
gremlin> person2 = g.addV('person').next()
==>v[{~label=person, community_id=1062113536, member_id=0}]
gremlin> knows = g.V(person1).addE('knows').to(V(person2)).property('notes', 'online').next()
==>e[{~type=knows, out_vertex={~label=person, community_id=1566048896, member_id=0}, in_vertex={~label=person, community_id=1062113536, member_id=0}, local_id=4cd8f8e2-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1566048896, member_id=0}-knows->{~label=person, community_id=1062113536, member_id=0}]
gremlin> g.E(knows)
==>e[{~type=knows, out_vertex={~label=person, community_id=1566048896, member_id=0}, in_vertex={~label=person, community_id=1062113536, member_id=0}, local_id=4cd8f8e2-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1566048896, member_id=0}-knows->{~label=person, community_id=1062113536, member_id=0}]
gremlin> g.E(knows).properties('notes')
==>p[notes->online]
gremlin> g.E(knows).properties('notes').drop()
gremlin> g.E(knows)
gremlin>
下一个示例创建了相同的数据集,但不是在与 addE
步骤相同的遍历中设置 'notes' 属性,而是创建 属性 在一个单独的遍历中。与上面的示例不同,删除 'notes' 属性 会删除 属性,同时保持边缘完好无损。
gremlin> person1 = g.addV('person').next()
==>v[{~label=person, community_id=1437137920, member_id=0}]
gremlin> person2 = g.addV('person').next()
==>v[{~label=person, community_id=1317720192, member_id=0}]
gremlin> knows = g.V(person1).addE('knows').to(V(person2)).next()
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).property('notes', 'online')
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).properties()
==>p[notes->online]
gremlin> g.E(knows).properties('notes').drop()
gremlin> g.E(knows)
==>e[{~type=knows, out_vertex={~label=person, community_id=1437137920, member_id=0}, in_vertex={~label=person, community_id=1317720192, member_id=0}, local_id=847ebaf0-a6b8-11e6-aa90-df2b21a156a2}][{~label=person, community_id=1437137920, member_id=0}-knows->{~label=person, community_id=1317720192, member_id=0}]
gremlin> g.E(knows).properties()
gremlin>
感谢您对 Leifur 的反馈。这似乎是一个错误,我们已经提交了内部 JIRA,工程团队正在调查。