假设我有一组有向图.我需要查询这些图表.我想感受一下图形建模任务的最佳选择.到目前为止,我有这些选择,但请不要犹豫,建议其他人:
>专有实施(矩阵)
和图遍历算法.
> RDBM和SQL选项(太占用空间)
> RDF和SPARQL选项(太慢)
你们会建议什么?问候.
编辑:只是回答Mad的问题:
>每个都相对较小,不超过200个顶点,400个边缘.但是,有数百个.
>查询频率:很难说,这是一个实验系统.
>速度:不是实时,但实用,比如说4-5秒.
最佳答案 你没有给我们足够的信息来回答一个深思熟虑的答案.例如:这些图表的大小是多少?您期望查询这些图表的频率是多少?您是否需要对这些查询进行实时响应?有关您的应用程序的用途,目的是什么的更多信息将会有所帮助.
无论如何,为了对抗假设基于SQL的DBMS无法有效处理图形结构的常见响应,我将给出一些参考:
> Graph Transformation in Relational Databases(.pdf),作者:G.Varro,K.Friedl,D.Varro,于International Workshop on Graph-Based Tools (GraBaTs) 2004年提出;
5 Conclusion and Future Work
In the paper, we proposed a new graph transformation engine based on off-the-shelf
relational databases. After sketching the main concepts of our approach, we carried
out several test cases to evaluate our prototype implementation by comparing it to
the transformation engines of the AGG [5] and PROGRES [18] tools.The main conclusion that can be drawn from our experiments is that relational
databases provide a promising candidate as an implementation framework for graph
transformation engines. We call attention to the fact that our promising experimental
results were obtained using a worst-case assessment method i.e. by recalculating
the views of the next rule to be applied from scratch which is still highly inefficient,
especially, for model transformations with a large number of independent matches
of the same rule. …
他们使用PostgreSQL作为DBMS,这在这种应用中可能不是特别好.你可以试试LucidDB,看看它是否更好,我怀疑.
> Incremental SQL Queries(这里不止一篇论文,你应该专注于“维护SQL中图形的传递关闭”):“
.. we showed that transitive closure, alternating paths, same generation, and other recursive queries, can be maintained in SQL if some auxiliary relations are allowed. In fact, they can all be maintained using at most auxiliary relations of arity 2. ..
> Incremental Maintenance of Shortest Distance and Transitive Closure in First Order Logic and SQL.
编辑:你提供更多详细信息……我认为最好的方法是使用主存储器专用图形库和基于DBMS的解决方案进行一些实验,然后仔细评估两种解决方案的优缺点.
例如:需要安装DBMS(如果您不使用像“SQLite”这样的“可嵌入”DBMS),只有您知道是否需要部署应用程序以及用户是什么.另一方面,DBMS为您提供直接的好处,例如持久性(我不知道图形库为持久化图形提供了什么支持),事务管理和无数其他.这些与您的申请相关吗?再一次,只有你知道.