0

My graph contains a single aggregation node (:Group) which just groups various other nodes (:User) together. My Cypher representation for my graph would look like this:

(rootGroup:Group)-[:HAS_MEMBER]->(user:User)

In Spring Data Neo4j i used a property with an unique index to prevent the creation of other (:Group) aggregation nodes:

@Indexed(unique = true)
private String unique = ObjectSchemaRoot.class.getSimpleName();

What would the tinkerpop analog look like? How can i set an index to a property using Tinkerpop Frames?

Jotschi
  • 3,270
  • 3
  • 31
  • 52
  • This is a little note, not an answer. You may have noticed that the `@Indexed` annotation has been removed in SDN4. From this you may want to think why it is a bad idea to have as annotation or more generally at the application? We personally think there should be no way that developers put schema indexes everywhere they want, this should be left to DBA's or even if you work alone, you're the DBA then and you can easily create indexes/constraints at the database level. – Christophe Willemsen Jun 06 '15 at 11:47
  • Could you eleborate that? I don't see why it is a bad idea to create a (unique) index within the entity definitions of my application. I'm creating those to speedup those parts that are most frequent accessed and to prevent inconsistencies. Both aspects are directly coupled to the application and should therefore be handled/configured by it. Personally i don't like SDN4 because it relies on the remote API and it is no longer possible to directly switch between core API and SDN. (e.g: when you want to use the traversal API for example) – Jotschi Jun 06 '15 at 11:59
  • Ok one example then, assume you define a constraint on the Entity User for his userId. How the application knows if the constraint is created in the database ? What the repository has to do with that, does it have to check first if the constraint exist and then issue the query ? – Christophe Willemsen Jun 06 '15 at 12:04
  • you'll need to do it everytime then ? – Christophe Willemsen Jun 06 '15 at 12:05
  • I see. I don't know whether SDN is checking the index/constraint on every entity save. I have to verify that. If it does it that way i see your point and i have to rethink my approach. In this case it would still be possible to setup those constraints/indices on application startup. – Jotschi Jun 06 '15 at 12:12

0 Answers0