【问题标题】:Titan DB how to define propertiesTitan DB如何定义属性
【发布时间】:2015-07-05 18:52:24
【问题描述】:

我是 Titan DB 的新手,我想制作自己的 DB。

我想制作两种类型的顶点:用户和特征。两个顶点都将具有索引属性creation_date

更好的方法是只使用索引或两个z_creation_datef_creation_date 创建一个属性类型creation_date?

【问题讨论】:

    标签: indexing titan


    【解决方案1】:

    您可以对两种顶点类型使用相同的属性,这就是 .indexOnly() 的用途。

    mgmt = graph.getManagementSystem()
    user = mgmt.makeVertexLabel("user").make()
    feature = mgmt.makeVertexLabel("feature").make()
    creation_date = mgmt.makePropertyKey("creation_date").dataType(Long.class).make()
    mgmt.buildIndex("user_creation_date", Vertex.class).addKey(creation_date).indexOnly(user).buildCompositeIndex()
    mgmt.buildIndex("feature_creation_date", Vertex.class).addKey(creation_date).indexOnly(feature).buildCompositeIndex()
    

    另见:Label Constraints

    【讨论】:

      猜你喜欢
      • 2016-08-05
      • 2013-01-15
      • 2017-10-16
      • 2017-06-07
      • 1970-01-01
      • 2017-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多