简体   繁体   English

使用Java在顶点标签上的DSE图索引

[英]Dse graph indexing on vertex label using Java

I am using Datastax Dse grap (5.x) java driver version 1.1.1 beta. 我正在使用Datastax Dse grap (5.x) Java驱动程序 1.1.1 beta版。

My use case is that I can not allow more than one vertex to have same vertex label. 我的用例是, 我不能允许多个顶点具有相同的顶点标签。

For that I want to create index on vertex label . 为此,我想在顶点标签上创建索引

I found this below code on Datastax official website schema.vertexLabel('recipe').index('byRecipe').secondary().by('name').add() 我在Datastax官方网站 schema.vertexLabel('recipe').index('byRecipe').secondary().by('name').add()以下代码中找到了此代码

But, this datastax tutorial lacks two things 但是,此datastax教程缺少两件事

  • How to create index on vertex label 如何在顶点标签上创建索引
  • How to execute this using java 如何使用Java执行此操作

My question is how to index Dse graph on Vertex label using java ? 我的问题是如何使用Java在顶点标签上索引Dse图

To implement this, you would execute the example as a graph statement. 为此,您可以将示例作为图语句执行。 It is typically recommended to create your schema outside of your application, traversal code base. 通常建议在应用程序(遍历代码库)之外创建模式。

If you are correct in stating that "you cannot allow more than one vertex to have the same vertex label", I think you need to reconsider your data model. 如果您正确地说“您不能允许一个以上的顶点具有相同的顶点标签”,我认为您需要重新考虑数据模型。 A vertex label is intended to identify a group of vertices, with a vertex property distinguishing several vertices from one another. 顶点标签旨在标识一组顶点,其顶点属性将多个顶点彼此区分开。

If you created a vertex label "vtype" and a property "name" that identified each instance "vtype1, vtype2, etc.", then the index could be: schema.vertexLabel('vtype').index('byVType').secondary().by('name').add() 如果创建了顶点标签“ vtype”和属性“名称”,以标识每个实例“ vtype1,vtype2等”,则索引可以是:schema.vertexLabel('vtype')。index('byVType')。 secondary()。by('name')。add()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM