Prakash P
Prakash P

Reputation: 4056

Dse graph indexing on vertex label using Java

I am using Datastax Dse grap (5.x) java driver version 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()

But, this datastax tutorial lacks two things

My question is how to index Dse graph on Vertex label using java?

Upvotes: 0

Views: 135

Answers (2)

polandll
polandll

Reputation: 96

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()

Upvotes: 0

jlacefie
jlacefie

Reputation: 614

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.

Upvotes: 0

Related Questions