简体   繁体   English

Neo4j提取子图的交互式查询

[英]Interactive Querying of Neo4j extracted subgraph

I need to extract a subgraph (a subset of nodes and edges) based on a user defined conditions such as attributes values and labels. 我需要根据用户定义的条件(例如属性值和标签)提取一个子图(节点和边的子集)。 This is already feasible using either a query language such as cypher or gremlin, or simply coded using a java methods. 使用诸如cypher或gremlin之类的查询语言,或者使用java方法进行简单编码,这已经是可行的。

However, since I'm dealing with large graphs, I wish to keep the extracted subgraph for further querying, and even iterate the subextraction-querying process. 但是,由于我要处理大型图,因此我希望保留提取的子图以进行进一步查询,甚至迭代子提取查询过程。

I've seen these discussions : Extract subgraph in neo4j , Extracting subgraph from neo4j database . 我已经看过这些讨论: 在neo4j提取子图,从neo4j数据库中提取子图 However, I couldn't figure out the answer for my case. 但是,我无法弄清楚我的案子的答案。

I was thinking of some alternatives : 我在想一些替代方案:

  1. Building a new index each time I need to extract a subgraph 每次需要提取子图时都要建立一个新索引
  2. Use a cache to store the nodes/edges which might be useful for arithmetic computation such as average etc. 使用高速缓存存储可能对算术计算(例如平均值等)有用的节点/边。
  3. Create a new instance of embedded ne4j, however this is really costly ! 创建一个嵌入式ne4j的新实例,但这确实很昂贵!

Another point, is getByID cheaper than index lookup. 另一点是,getByID比索引查找便宜。 I know this depends on the case: large graphs or small index ... 我知道这取决于情况:大图或小索引...

You could just create a new neo4j java embedded database to hold your results and query further? 您可以只创建一个新的neo4j Java嵌入式数据库来保存结果并进一步查询? No need to boot up another server IMHO. 无需启动另一台服务器恕我直言。

Also, getByID is generally cheaper than index lookup, since you avoid the index roundtrip. 另外,由于可以避免索引往返,因此getByID通常比索引查找便宜。 Index lookups are great for more complax lookups like text matching etc. 索引查找非常适合进行更复杂的查找,例如文本匹配等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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