You forgot tx.finish(); What is the content of your wkt field?
Transaction tx = graphService.beginTx(); do-stuff tx.succes(); tx.finish(); Am 10.02.2014 um 19:49 schrieb Pattabi <[email protected]>: > Thanks Michael. I will try this. > > I tried the following and getting an error while adding the > SpatialDatabaseRecord to the Spatial Index Impl. > The error is > Caused by: javax.transaction.RollbackException: Tx status is: > STATUS_MARKED_ROLLBACK > at > org.neo4j.kernel.impl.transaction.TransactionImpl.enlistResource(TransactionImpl.java:237) > at > org.neo4j.kernel.impl.transaction.xaframework.XaConnectionHelpImpl.enlistResource(XaConnectionHelpImpl.java:103) > at > org.neo4j.kernel.impl.index.IndexConnectionBroker.acquireResourceConnection(IndexConnectionBroker.java:56) > ... 6 more > > > > IndexImplementation indexImpl = new SpatialIndexImplementation > (graphService); > Index<Node> nodeIndex = indexImpl.nodeIndex("Geocode", > SpatialIndexProvider.SIMPLE_WKT_CONFIG); > Iterable<Node> allNodes = graphService.getAllNodes(); > for(Node node: allNodes){ > Transaction tx = graphService.beginTx(); > try{ > if(node.hasProperty("addressLine1")){ > Node added = graphService.createNode(); > added.setProperty("wkt", node.getProperty("wkt")); > System.out.println("Adding node " + added.getId()); > nodeIndex.add(added, "addressLine1", > node.getProperty("addressLine1")); > } > }catch(Exception e){ > e.printStackTrace(System.out); > tx.failure(); > } > tx.success(); > > > On Monday, February 10, 2014 1:12:16 PM UTC-5, Michael Hunger wrote: > Just with the core api. > > db.index().forNodes("spatial").add(node, "dummy","dummy"); > > depending on the config > > node has to have geo-properties (lat, lon) > or > node has to have geo-properties (point in well-known-text (wkt)) > > SDN uses this index-config: > > MapUtil.stringMap( > IndexManager.PROVIDER, "spatial", "geometry_type" , > "point","wkt","wkt") > > and "wkt" as property-name for the well-known-text-point. > > http://docs.spring.io/spring-data/data-neo4j/docs/2.3.x/reference/htmlsingle/#reference_spatial > > Michael > > Am 10.02.2014 um 19:08 schrieb Pattabi <[email protected]>: > >> MH, >> If I have to replicate the SDN's behavior for adding a Node to spatial >> index, do I need to do all the following? >> Create a Geom node, add to index by calling add(node,key, value) and create >> relationship types - RTREE_REFERENCE? >> >> >> >> >> On Friday, February 7, 2014 9:05:29 PM UTC-5, Michael Hunger wrote: >> How many nodes are you adding at once and how big is your Java heap? >> >> You don't have to create a layer, the index automatically creates the layer. >> >> Michael >> >> Am 07.02.2014 um 21:55 schrieb Pattabi <[email protected]>: >> >>> Getting this error while loading bean which has a 'wkt/spatial' index >>> using - Spring data-neo4j 3.0.0.BUILD-20140207...., neo4j 2.0.0 >>> >>> Note: I do not know how to do batch insert a spatial (as it is my >>> understanding that I need to create a layer with that WKT, add these nodes >>> to that layer) >>> I looked at the code 'SpatialIndexImplementation' nodeIndex. If I have to >>> do batch insert, adding to this index would be sufficient? >>> >>> The stack trace is as shown below: >>> >>> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space >>> at >>> org.apache.lucene.store.BufferedIndexOutput.<init>(BufferedIndexOutput.java:26) >>> at >>> org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:438) >>> at >>> org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:306) >>> at >>> org.apache.lucene.index.FormatPostingsPositionsWriter.<init>(FormatPostingsPositionsWriter.java:43) >>> at >>> org.apache.lucene.index.FormatPostingsDocsWriter.<init>(FormatPostingsDocsWriter.java:57) >>> at >>> org.apache.lucene.index.FormatPostingsTermsWriter.<init>(FormatPostingsTermsWriter.java:33) >>> at >>> org.apache.lucene.index.FormatPostingsFieldsWriter.<init>(FormatPostingsFieldsWriter.java:51) >>> at >>> org.apache.lucene.index.FreqProxTermsWriter.flush(FreqProxTermsWriter.java:85) >>> at org.apache.lucene.index.TermsHash.flush(TermsHash.java:113) >>> at org.apache.lucene.index.DocInverter.flush(DocInverter.java:70) >>> at >>> org.apache.lucene.index.DocFieldProcessor.flush(DocFieldProcessor.java:60) >>> at >>> org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:581) >>> at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3587) >>> at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3552) >>> at org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:450) >>> at org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:399) >>> at >>> org.apache.lucene.index.DirectoryReader.doOpenFromWriter(DirectoryReader.java:413) >>> at >>> org.apache.lucene.index.DirectoryReader.doOpenIfChanged(DirectoryReader.java:432) >>> at >>> org.apache.lucene.index.DirectoryReader.doOpenIfChanged(DirectoryReader.java:375) >>> at >>> org.apache.lucene.index.DirectoryReader.doOpenIfChanged(DirectoryReader.java:392) >>> at >>> org.apache.lucene.index.IndexReader.openIfChanged(IndexReader.java:634) >>> at >>> org.neo4j.index.impl.lucene.LuceneDataSource.refreshSearcher(LuceneDataSource.java:505) >>> at >>> org.neo4j.index.impl.lucene.LuceneDataSource.refreshSearcherIfNeeded(LuceneDataSource.java:635) >>> at >>> org.neo4j.index.impl.lucene.LuceneDataSource.getIndexSearcher(LuceneDataSource.java:577) >>> at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:293) >>> at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:251) >>> at >>> org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.findExistingNode(LayerNodeIndex.java:152) >>> at >>> org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:132) >>> at >>> org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:1) >>> at >>> org.springframework.data.neo4j.fieldaccess.IndexingPropertyFieldAccessorListenerFactory$IndexingPropertyFieldAccessorListener.valueChanged(IndexingPropertyFieldAccessorListenerFactory.java:86) >>> at >>> org.springframework.data.neo4j.fieldaccess.DefaultEntityState.notifyListeners(DefaultEntityState.java:137) >>> at >>> org.springframework.data.neo4j.fieldaccess.DefaultEntityState.setValue(DefaultEntityState.java:114) >>> >>> >>> -- >>> 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/groups/opt_out. >> >> >> -- >> 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/groups/opt_out. > > > -- > 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/groups/opt_out. -- 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/groups/opt_out.
