顶点和边的模型模式
如何像 OrientDB 中发生的那样验证图(顶点和边)数据?例如,如果我的图形具有格式的顶点/边
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)?
在 OrientDB 中,也有在顶点和边中存储数据的特性,并且每个模式都被很好地定义.我怎样才能在 arangoDB 中做到这一点?
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?
开箱即用"ArangoDB 不支持模式强制.显然,这在某些用例中可能是一个明显的缺点.
"Out-of-the-box" ArangoDB does not support schema enforcement. Clearly that is potentially a signficant drawback in some use-cases.
然而,ArangoDB 的 Max Neunhöffer 认为,通过一些工作,人们可以关闭标准数据库 API,留下一个基于 ArangoDB 的系统来强制执行模式:
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:
因此,ArangoDB 可以变成一个严格的模式强制持久化引擎,因为它的 HTTP API 可以通过用 JavaScript 编写的用户代码进行扩展,这些代码在数据库服务器中执行并直接访问数据.人们可以逐渐改进客户端代码使用数据存储的方式,并将其慢慢转移到特殊的、用户定义的路由,这些路由强制执行目前稳定的数据库模式,特别是对于写入操作.因此,可以简化许多客户端代码,因为一旦涵盖所有写入操作,您就可以依赖 API 强制执行的严格架构.
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.
最后,当我们为应用程序定制了整个 API 时,甚至可以关闭标准的数据库 API,这进一步提高了安全性和清洁度.通过这最后一步,我们已经获得了一种软件架构,该架构以特定于应用程序的方式直接在数据库服务器中实现以数据为中心的微服务,这有利于防止错误,有利于性能(复杂查询可以在靠近数据的地方运行),有利于应用程序设计的简单性和可维护性.即使是 DevOps 也是这样,因为微服务可以独立部署和更新.
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