问题
How to validate graph (vertices and edges) data like what happens in OrientDB? For example, If my graph has vertices/edges of format
{
"name": :any_name,
"age" : 13
}
How can I associate it with a well defined schema (with validations)?
In OrientDB, there is feature of storing data in vertices and edges also and each of the schemas are well defined. How can I do this in arangoDB?
回答1:
"Out-of-the-box" ArangoDB does not support schema enforcement. Clearly that is potentially a signficant drawback in some use-cases.
However, Max Neunhöffer of ArangoDB argues that with a bit of work, one can switch off the standard database API, leaving an ArangoDB-based system that does enforce schemas:
Therefore, ArangoDB can then be turned into a strict schema-enforcing persistence engine, because its HTTP API can be extended by user code written in JavaScript that is executed in the database server with direct access to the data. One can gradually evolve the way the data store is used by client code and move it slowly over to special, user defined routes that enforce the by now stable database schema, in particular for the write operations. As a consequence, a lot of client code can be simplified, because suddenly one can rely on a strict schema that is enforced by the API, once all write operations are covered.
In the end, when one has customized the whole API for the app, one can even switch off the standard database API, which further increases security and cleanliness. With this final step one has arrived at a software architecture that implements data-centric microservices in an application-specific way directly in the database server, which is good against bugs, good for performance (complex queries can be run close to the data), good for the simplicity of the application design and good for maintainability. Even the devops like this because the microservices can be deployed and updated independently.
https://www.arangodb.com/2015/03/agile-development-vs-schema-enforcement
来源:https://stackoverflow.com/questions/47828441/model-schema-for-vertices-and-edges