简体   繁体   中英

Gremlin schema validation

I'm Gremlin nub, and may be I missed some basics in Gremlin docs, but I didn't found a way to define a schema validation rules for Gremlin.

I mean how can I allow in my graph DB (Gremlin Api in Azure Cosmos DB) the relations: person->creates->software and person->knows-person,

but restrict: person->knows->software or software->creates->person?

Gremlin and TinkerPop have no notion of a graph schema. The approaches to schema from different graph systems are too diverse to generalize (some don't even support a schema). If you need a schema, you need to either choose a TinkerPop-enabled system that has that support and use their APIs to define that schema or you need to handle such logic yourself in your application.

For the latter, you might consider a couple of options outside of just encapsulating that logic somewhere in your code:

  • Write a DSL for graph mutations - that can help enforce the schema you want at the API level
  • Develop a TraversalStrategy that will verify the mutations made as being schema-compliant. This is a Java only approach at this time and requires bytecode based traversals which CosmosDB doesn't yet support (though that support is currently under development ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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