Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j 2.0M3空间0.12-空间不';我不会为我的查询返回任何结果_Neo4j_Spatial - Fatal编程技术网

Neo4j 2.0M3空间0.12-空间不';我不会为我的查询返回任何结果

Neo4j 2.0M3空间0.12-空间不';我不会为我的查询返回任何结果,neo4j,spatial,Neo4j,Spatial,我正在按照上的教程使用Neo4j 2.0M03测试Spatial 0.12。我正在尝试SimplePointLayer示例,以获取半径范围内的节点 尽管看起来一切都按预期创建(层、索引等),并且我的域节点都已正确索引,但我的Cypher查询或java spatial查询代码不会返回任何结果 当我在Neo4j 1.9和Spatial 0.11上尝试完全相同的方法时,效果很好 在进一步挖掘这个问题之前,我想先问问Neo4j社区这是否是一个已知的问题。提前谢谢 --基于Peter评论的测试步骤-- g

我正在按照上的教程使用Neo4j 2.0M03测试Spatial 0.12。我正在尝试SimplePointLayer示例,以获取半径范围内的节点

尽管看起来一切都按预期创建(层、索引等),并且我的域节点都已正确索引,但我的Cypher查询或java spatial查询代码不会返回任何结果

当我在Neo4j 1.9和Spatial 0.11上尝试完全相同的方法时,效果很好

在进一步挖掘这个问题之前,我想先问问Neo4j社区这是否是一个已知的问题。提前谢谢

--基于Peter评论的测试步骤--

geo_layer.json:

{
    "layer" : "geom",
    "lat" : "lat",
    "lon" : "lon"
}

curl -H "Content-Type: application/json" -X POST -d @geo_layer.json http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
geo_index.json:

{
    "name" : "geom",
    "config" : {
            "provider" : "spatial",
            "geometry_type" : "point",
            "lat" : "lat",
            "lon":"lon"
            }
}

curl -H "Content-Type: application/json" -X POST -d @geo_index.json http://localhost:7474/db/data/index/node
geo_node.json:

{
    "lat" : 60.1,
    "lon" : 15.2
}

curl -H "Content-Type: application/json" -X POST -d @geo_node.json http://localhost:7474/db/data/node
{
    "value": "dummy",
    "key": "dummy",
    "uri": "http://localhost:7474/db/data/node/5"
}

curl -H "Content-Type: application/json" -X POST -d @domain_node.json http://localhost:7474/db/data/index/node/geom
新节点的id为5-我从一个空图开始

domain_node.json:

{
    "lat" : 60.1,
    "lon" : 15.2
}

curl -H "Content-Type: application/json" -X POST -d @geo_node.json http://localhost:7474/db/data/node
{
    "value": "dummy",
    "key": "dummy",
    "uri": "http://localhost:7474/db/data/node/5"
}

curl -H "Content-Type: application/json" -X POST -d @domain_node.json http://localhost:7474/db/data/index/node/geom
cypher_query.json:

{
    "query": "start node = node:geom('withinDistance:[60.0,15.0, 100.0]') return node;"
}

curl -H "Content-Type: application/json" -X POST -d @cypher_query.json http://localhost:7474/db/data/cypher
{
    "layer" : "geom",
    "distanceInKm" : "100",
    "pointX" : "15",
    "pointY" : "60"
}

curl -H "Content-Type: application/json" -X POST -d @geo_query.json http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance
结果是:

{
  "message" : "org.neo4j.gis.spatial.indexprovider.GeoPipeFlowHits.iterator()Lorg/neo4j/graphdb/ResourceIterator;",
  "exception" : "AbstractMethodError",
  "fullname" : "java.lang.AbstractMethodError",
  "stacktrace" : [ "org.neo4j.cypher.internal.spi.gdsimpl.TransactionBoundQueryContext$NodeOperations.indexQuery(TransactionBoundQueryContext.scala:120)", "org.neo4j.cypher.internal.spi.DelegatingOperations.indexQuery(DelegatingQueryContext.scala:107)", "org.neo4j.cypher.internal.executionplan.builders.EntityProducerFactory$$anonfun$2$$anonfun$applyOrElse$2.apply(EntityProducerFactory.scala:70)", "org.neo4j.cypher.internal.executionplan.builders.EntityProducerFactory$$anonfun$2$$anonfun$applyOrElse$2.apply(EntityProducerFactory.scala:68)", "org.neo4j.cypher.internal.executionplan.builders.EntityProducerFactory$$anon$1.apply(EntityProducerFactory.scala:38)", "org.neo4j.cypher.internal.executionplan.builders.EntityProducerFactory$$anon$1.apply(EntityProducerFactory.scala:37)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:34)", "org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:33)", "scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)", "org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:84)", "org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35)", "org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:157)", "scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)", "scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)", "org.neo4j.cypher.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:73)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:58)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:83)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.assemble(OutputFormat.java:185)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:133)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:119)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:57)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:96)", "java.lang.reflect.Method.invoke(Method.java:601)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)" ]
--或者--

location.json:

{
    "layer" : "geom",
    "node" : "http://localhost:7474/db/data/node/5"
}

curl -H "Content-Type: application/json" -X POST -d @location.json http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
geo_query.json:

{
    "query": "start node = node:geom('withinDistance:[60.0,15.0, 100.0]') return node;"
}

curl -H "Content-Type: application/json" -X POST -d @cypher_query.json http://localhost:7474/db/data/cypher
{
    "layer" : "geom",
    "distanceInKm" : "100",
    "pointX" : "15",
    "pointY" : "60"
}

curl -H "Content-Type: application/json" -X POST -d @geo_query.json http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance

返回空结果集。

在通过Cypher查询之前,请确保将节点添加到索引中,因为这会在数据库中创建必要的结构,请参阅

感谢您的回复。我列出了一个新测试的结果,它模拟了您建议我查看的单元测试。我不知道我得到的错误意味着什么。我已经从github克隆了最新的空间代码并用于此测试。我的Neo4j版本是2.0M3,我从网站上下载的-我还没有建立自己的版本。我不知道这是否意味着什么,但当我按照上面的步骤操作时,我看到结果创建了两个索引。第一个是“geom__neo4j-spatial__LayerNodeIndex__内部__空间节点Lookup__”,第二个是“geom”。有什么想法吗?最后一个音符。当我在1.9.1上进行相同的测试时,它就像一个符咒。