neo4j-spatial:从空间索引中删除节点的官方方法是什么? [英] neo4j-spatial: What is the official way to delete a node from a spatial index?

查看:9
本文介绍了neo4j-spatial:从空间索引中删除节点的官方方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题肯定是 Neo4j Spatial - 如何删除 A节点,但是还没解决.

My question is most certainly a duplicate of Neo4j Spatial - How To Delete A Node, but it has not yet been solved.

据我所知,neo4j-spatial-plugin 目前没有实现(未记录)从空间索引中删除节点.

To my understanding removing a node from a spatial index is currently not implemented (not documented) within the neo4j-spatial-plugin.

现在我的问题是:我自己怎么做?"我可以看到索引的所有节点,但是如何查询引用我要删除的节点的那个节点?此外:我可以从索引中删除该节点而不损害其他任何东西吗?

Now my questions would be: "How do I do this myself?" I can see all the nodes of the index, but how do I query that very node that refers to the node I want to delete? And furthermore: May I just delete that node from the index without harming anything else?

谢谢:-)

推荐答案

是的.你是对的.正如 此链接 所说,这是一个已知问题,并且它仍然开放很长时间.

Yes. You are correct. As this link says,this is a known issue and its still open since very long.

现在,回到您的问题,您可以按照以下步骤手动完成.

Now, coming to your question, you can do it manually by following the below steps.

  1. 每当任何节点被添加到索引中(比如geom"),然后一个 UNIQUE RTREE_REFERENCE 被添加到该节点.NEO4J 为该引用分配一个唯一的 id.这个分配的id"与用于索引节点的id"不同.让我们考虑使用 localhost:7474/db/data/node/7577 将带有 id:7577 的User"节点添加到索引geom"中.

  1. Whenever any node is added to index (let's say 'geom'), then a UNIQUE RTREE_REFERENCE is added with that node. NEO4J assigns a unique id to that reference. This assigned "id" is different than the "id" which was used to index the node.e.g. Let's consider that "User" node with id:7577 is added to index "geom", using localhost:7474/db/data/node/7577.

现在,这个索引创建后,你可以在Neo4j浏览器中使用以下命令检查它的RTREE_REFERENCE.MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return b;

Now, after this index is created, you can check it's RTREE_REFERENCE, with the following command in Neo4j Browser.MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return b;

我们需要获取节点b"的内部"id,我们可以通过在 Neo4j 浏览器中触发以下命令来实现.MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return id(b);

We need to get the "internal" id of the node "b", we can do this by firing below command in the Neo4j Browser. MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return id(b);

使用内部"ID从索引中删除节点

  1. 假设从上面的步骤中,我们得到 7578 作为内部/实际"ID.
  2. 现在,我们可以在服务器上手动启动 curl 命令,如下所示curl -X DELETE http://localhost:7474/db/data/index/node/geom/7578

在数据库中交叉验证

  1. 现在,如果您从 Neo4j 浏览器重新查询,请使用以下相同的查询 MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return id(b); 你会得到没有行".因为 RTREE_REFERENCE 已被删除.
  1. Now, if you re-query from Neo4j browser,using the below same query MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=7577 return id(b); you will get "no rows". as the RTREE_REFERENCE has been deleted.

注意:上述所有步骤也可以从您的代码中自动化,使用来自 Java/.Net/PHP 的任何 HttpClient.

希望这能回答您的两个问题

Hope this answers both of your questions

谢谢

这篇关于neo4j-spatial:从空间索引中删除节点的官方方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆