gpt4 book ai didi

java - 泰坦图 : Edge property with Cardinality. 列表? StandardEdge.addProperty() 在哪里?

转载 作者:行者123 更新时间:2023-12-02 03:06:43 26 4
gpt4 key购买 nike

我们使用泰坦 0.5.4。我们使用 Frames 框架进行 OGM,我们对其进行了定制以支持继承。我们有一个Titan index设置包含“类型鉴别器”的属性(请参阅 Hibernate):

PropertyKey propKey = getOrCreatePropertyKey(titan, "w:type", String.class), Cardinality.LIST);
titan.buildIndex("edge-type", Edge.class).addKey("w:type").buildCompositeIndex();

现在,buildIndex 的第二个参数的存在表明边也应该能够容纳 Cardinality.LIST 属性。
但是,当您想添加这些属性时,没有方法可以实现:

if (abstractElement instanceof StandardEdge)
((StandardEdge) abstractElement).addProperty(propertyName, propertyValue);

除了没有 addProperty(),只有 setProperty() 会覆盖该值,Javadoc 特别指出:

Sets the value for the given key on this element. The key must be defined to have Cardinality.SINGLE, otherwise this method throws an exception

所以我想知道,

如何为边缘的属性添加多个值?

最佳答案

我在 Titan 0.5.4 中也遇到了同样的问题。不幸的是,Titan 中的边属性不允许使用多属性(基数与 Cardinality.SINGLE 不同)。 Titan 0.5.4 文档here中没有明确描述.

Titan supports multiple properties with the same key on a single vertex

Titan 1.0.0 中的情况相同,唯一的区别是方法 addPropery 更改为 property。文档是here .

关于java - 泰坦图 : Edge property with Cardinality. 列表? StandardEdge.addProperty() 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41622083/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com