|
Post by account_disabled on Jan 28, 2024 3:44:52 GMT -5
文由Wern Ancheta和Christophe Willemsen进行了同行评审。感谢所有 SitePoint 的同行评审者使 SitePoint 内容达到最佳状态! 为什么要使用图表? 无论你从哪里看,都不存在孤立的信息——人物、事件、地点、事物、文档、应用程序以及它们的信息都是紧密相连的。随着数据量的增长,其连接的数量和动态性也随之增加。如果您过去尝试过在任何数据库中存储和查询高度连接的半结构化数据,您可能会遇到很多挑战。 示例图 本机图数据库中的标记属性图 Neo4j 的构建是为了准确处理这些现实世界的信息,而不影响您可以拥有的与实体相关的连接的数量和类型。它是一个开源 NoSQL 数据库,它使用标记属性图将域模型(图)的实体存储为节点,并将它们的连接存储为关系,每个关系都可以具有任意属性。 节点和具有属性的关系 Neo4j 不仅仅是另一个数据库之上的图形层,而是一个成熟的事务性 (ACID) 数据库,其功能包括从管理磁盘上的记录页面到提供可扩展的安全集群。 作为原生图形数据库,它使用专用的数据结构来有效地存储和查询高度连接的数据。与其他数据库不同,(复杂)JOIN 查询在查询时不会重复计算。相反,实体之间的关系是直接存储的。在查询期间,数据库引擎可以使用直接记录指针进行恒定时间查找。 开放的 Cypher 查询语言 这不仅仅扩展到建模或存储,甚至 Neo4j 附带的 Cypher 图形查询语言也专注于图形模式,这次在查询中表示为 ASCII-art:这使得您的查询 WhatsApp 号码数据 即使对于非开发人员也非常具有可读性,例如,这是一个推荐查询(“像您这样的客户也买了这个”PHP 快速开发框架 Symfony 是现代 PHP 框架的典范。该框架采用得益于组件方法,其他项目和框架可以轻松地重用 Symfony 的代码。Laravel、Silex、Sylius、Drupal、phpBB、eZ 等项目都使用 Symfony 组件。 Symfony 成功的一个关键因素是框架的灵活性和易用性。Symfony 标准版以 Doctrine 作为默认数据库层抽象,支持一些主要数据库,如 MySQL 和 MongoDB。但数据库层和 Doctrine 都不是 Symfony 的主要公民。 它封装了 Graphaware 优秀的 PHP 社区客户端,并创建了可靠的 Symfony 体验。由于 WebProfiler 集成,您将看到所有数据库调用、所有查询及其结果。您甚至可以查看与数据库交互时引发的任何异常。您还将获得有关每个数据库调用的详细统计信息。这使得调试您的应用程序变得更加容易。 该捆绑包还将客户端事件与 Symfony 事件调度程序集成。您现在可以创建事件订阅者来侦听与 Neo4j 的交互,例如与 MonologBundle 集成以记录所有数据库查询。 该捆绑包不限制您如何使用 Neo4j。使用 OGM 是可选的。高级 Neo4j 用户将完全控制客户端以及 Cypher 的执行内容。 类似 Doctrine,开发人员使用 Neo4j 的 OGM 模型将获得完全相同的体验。 配置 与大多数现代框架一样,Symfony 将配置与代码分开。这是 Neo4jBundle 遵循的良好软件实践。它提供了轻松配置多个连接、多个客户端和多个实体管理器的能力。对于每个连接,您可以决定是使用 HTTP 还是新的二进制“bolt”协议。 感谢 Symfony 的配置组件,您可以使用 Yaml、XML 或 PHP 来指定您的配置。
|
|