Ben,
the deletion code is in Andreas fork, see
https://github.com/AndreasWilhelm/neo4j-spatial/blob/master/src/test/java/org/neo4j/gis/spatial/LayersTest.java#L82
for a test.

We are about to release Neo4j Spatial 0.6, and after that merge this
into the master. Just a heads-up.

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Jul 29, 2011 at 6:27 PM, Ben Galon <bga...@gmail.com> wrote:
> Hi Peter
> I don't have git installed on my computer. so I opened a fork and
> commit my solution from the web UI. I could not find a way to upload
> the Test file, sorry for that.
>
> Best regards
> Ben
>
>
> On Fri, Jul 29, 2011 at 5:37 PM, Peter Neubauer
> <neubauer.pe...@gmail.com> wrote:
>> Ben,
>> The first bug is fixed in Andreas Wilhelms fork, thanks for pointing it out!
>> Can't comment on the second from my mobile :) could you fork, add the test
>> and see if you can fix it?
>>
>> /peter
>>
>> Sent from my phone.
>> On Jul 29, 2011 7:29 AM, "Ben Galon" <bga...@gmail.com> wrote:
>>> Hello,
>>>
>>> I started working with neo4j-spatial a while ago. i found it very
>>> useful and the first thing i would like to say is Thanks for your
>>> wonderful work.
>>> While working on a project that require large amount of insert/delete
>>> operation I think i found two bugs.
>>> The first one is in EditableLayerImpl.java. When adding an object and
>>> immediately delete it, and then insert another object, you will get an
>>> error because the previousGeomNode field will refer to a node that
>>> have been deleted.
>>>
>>> The second bug is in the Rtree implementation (RTreeIndex.java). When
>>> removing an object from a leaf and the tree is need to be reorganize a
>>> null exception is raise at line 124.
>>> This happens because deleteRecursivelyEmptySubtree (at line 121)
>>> method delete the relationship from the lastParentNodeToDelete to it's
>>> parent (at line 740) and than the getIndexNodeParent method ant line
>>> 124 returns null.
>>> I think that this can be solved easily by applying the following
>>> changes to lines 120-126:
>>>
>>> Node lastParentNodeToDelParent =
>> getIndexNodeParent(lastParentNodeToDelete);
>>>
>>> deleteRecursivelyEmptySubtree(lastParentNodeToDelete);
>>>
>>> // adjust tree
>>> adjustParentBoundingBox(lastParentNodeToDelParent,
>>> SpatialRelationshipTypes.RTREE_CHILD);
>>> adjustPathBoundingBox(lastParentNodeToDelParent);
>>>
>>> the line number are the same as in the github repository.
>>>
>>> I will be happy to your opinion about these issues.
>>>
>>> here is a short code that generate the second bug:
>>>
>>> import org.neo4j.gis.spatial.EditableLayer;
>>> import org.neo4j.gis.spatial.EditableLayerImpl;
>>> import org.neo4j.gis.spatial.RTreeIndex;
>>> import org.neo4j.gis.spatial.SpatialDatabaseService;
>>> import org.neo4j.gis.spatial.WKTGeometryEncoder;
>>> import org.neo4j.graphdb.GraphDatabaseService;
>>> import org.neo4j.kernel.EmbeddedGraphDatabase;
>>>
>>> import com.vividsolutions.jts.geom.Coordinate;
>>>
>>>
>>> public class RteeTest {
>>>
>>> /**
>>> * @param args
>>> */
>>> public static void main(String[] args) {
>>> final String dbFolder = "c:\\RtreeTest";
>>> GraphDatabaseService graphDB = new EmbeddedGraphDatabase(dbFolder);
>>> SpatialDatabaseService sgDB = new SpatialDatabaseService(graphDB);
>>>
>>> EditableLayer testLayer =
>>> (EditableLayer)sgDB.createLayer("RtreeTest", WKTGeometryEncoder.class,
>>> EditableLayerImpl.class);
>>>
>>> for (int i = 0; i < 15; i++){
>>> for (int j = 0; j < 10; j++){
>>> testLayer.add(testLayer.getGeometryFactory().createPoint(new
>>> Coordinate(i, j)));
>>> }
>>> }
>>>
>>> ((RTreeIndex)testLayer.getIndex()).debugIndexTree();
>>> testLayer.delete(60); // raise an java.lang.NullPointerException exception
>>>
>>> ((RTreeIndex)testLayer.getIndex()).debugIndexTree();
>>>
>>> graphDB.shutdown();
>>> }
>>>
>>> }
>>>
>>> Thanks again
>>> Ben
>>> _______________________________________________
>>> Neo4j mailing list
>>> User@lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to