Howdy,
Setup:
neo4j 2.1.2
spatial plugin: neo4j-spatial-0.12
I'm trying to query on spatial index that I created via php, the cypher
query works in a browser when I run neo4j standalone eg:
START n = node:geo_main('withinDistance:[41.061878,-73.79705, 2.2]') where
> n.city = "white plains" return n
gives back results.
However, when I stop neo4j and load the db from java:
...
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
...
...
public List<Node> listOfNodesWithinDist(double lat, double lon, double
maxDist) {
ExecutionEngine engine = new ExecutionEngine( graphDb, StringLogger.SYSTEM
);
ExecutionResult result = null;
List<Node> nodes = new ArrayList<Node>();
try ( Transaction tx = graphDb.beginTx(); )
{
result = engine.execute( "START n =
node:geom('withinDistance:["+lat+","+lon+", "+maxDist+"]') return n" );
ResourceIterator<Node> n_column = result.columnAs("n");
for ( Node node : IteratorUtil.asIterable( n_column ) )
{
nodes.add(node);
}
tx.success();
}
catch(org.neo4j.cypher.SyntaxException E){
System.out.println(E.getMessage());
}
return nodes;
}
I get:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/lang/NotImplementedException
at
org.neo4j.gis.spatial.indexprovider.SpatialIndexImplementation.nodeIndex(SpatialIndexImplementation.java:47)
at
org.neo4j.kernel.impl.coreapi.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:318)
at
org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:302)
at
org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:294)
at
org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext$NodeOperations.indexQuery(TransactionBoundQueryContext.scala:172)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingOperations.indexQuery(DelegatingQueryContext.scala:128)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$indexQuery(ExceptionTranslatingQueryContext.scala:142)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$indexQuery$1.apply(ExceptionTranslatingQueryContext.scala:142)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$indexQuery$1.apply(ExceptionTranslatingQueryContext.scala:142)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:149)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.indexQuery(ExceptionTranslatingQueryContext.scala:142)
at
org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingOperations.indexQuery(DelegatingQueryContext.scala:128)
at
org.neo4j.cypher.internal.compiler.v2_1.commands.EntityProducerFactory$$anonfun$2$$anonfun$applyOrElse$2.apply(EntityProducerFactory.scala:69)
at
org.neo4j.cypher.internal.compiler.v2_1.commands.EntityProducerFactory$$anonfun$2$$anonfun$applyOrElse$2.apply(EntityProducerFactory.scala:67)
at
org.neo4j.cypher.internal.compiler.v2_1.commands.EntityProducerFactory$$anon$1.apply(EntityProducerFactory.scala:37)
at
org.neo4j.cypher.internal.compiler.v2_1.commands.EntityProducerFactory$$anon$1.apply(EntityProducerFactory.scala:36)
at
org.neo4j.cypher.internal.compiler.v2_1.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:37)
at
org.neo4j.cypher.internal.compiler.v2_1.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:37)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$failIfThrows$1.apply(ClosingIterator.scala:93)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.decoratedCypherException(ClosingIterator.scala:102)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.failIfThrows(ClosingIterator.scala:91)
at
org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.hasNext(ClosingIterator.scala:34)
at
org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult.hasNext(PipeExecutionResult.scala:166)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
at
scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)
at
org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:74)
I've also tried:
try (Transaction tx = graphDb.beginTx();) {
IndexManager index = graphDb.index();
// autoIndex = index.forNodes( "node_auto_index" );
geomIndex = index.forNodes("geo_main");
Map<String, Object> params = new HashMap<String, Object>();
params.put(LayerNodeIndex.POINT_PARAMETER, new Double[] { x, y });
params.put(LayerNodeIndex.DISTANCE_IN_KM_PARAMETER, maxDist);
IndexHits<Node> hits =
geomIndex.query(LayerNodeIndex.WITHIN_DISTANCE_QUERY, params);
for (Node stop : hits) {
nodes.add(stop);
}
tx.success();
} catch (org.neo4j.cypher.SyntaxException E) {
System.out.println(E.getMessage());
}
which gave me the same exception on line (geomIndex =
index.forNodes("geo_main");)
Is it a bug or am I doing something wrong ?
Thanks!!
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.