From 9403f3c0284bd3193aa6fd5ebd38367b3dfe2707 Mon Sep 17 00:00:00 2001 From: David Fauth Date: Wed, 22 Nov 2023 13:27:41 -0500 Subject: [PATCH] Updates for Neo4j 5.13 Updated for Neo4j 5.13 --- CHANGELOG.md | 3 +++ README.md | 9 +++++-- pom.xml | 31 ++++++++++++---------- src/main/java/com/neo4jh3/uber/Uberh3.java | 6 +++-- src/test/java/com/neo4jh3/Neo4jH3Test.java | 4 +-- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f06aed..d09ea98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # CHANGELOG - Neo4jH3 +* [ Added ] Tested through Neo4j 5.13 +* [ Added ] Updated README.md to mention that /tmp directory needs to have execute privileges. +* [ Fixed ] Ensure the version value returned is correct. ## 5.12 2023-10-20 * [Added] Tested through Neo4j 5.12 diff --git a/README.md b/README.md index 17ec76f..353c422 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ project, simply package the project with maven: mvn clean package -This will produce a jar-file, `neo4jh3-5.5.0.jar`, +This will produce a jar-file, `neo4jh3-5.13.0.jar`, that can be copied to the `plugin` directory of your Neo4j instance. - cp target/neo4jh3-5.5.0.jar neo4j-enterprise-5.x.0/plugins/. + cp target/neo4jh3-5.13.0.jar neo4j-enterprise-5.x.0/plugins/. Edit your Neo4j/conf/neo4j.conf file by adding this line: @@ -28,3 +28,8 @@ Edit your Neo4j/conf/neo4j.conf file by adding this line: # Documentation Refer to the Documentation.md file for detailed documenation on the functions / procedures. +# Note +The Neo4jH3 plugin requires the ability to write to the temp directory. If the temp directory configured with noexec, then you need to update the neo4j.conf with these two lines: + server.jvm.additional=-Djava.io.tmpdir=/path_to_a_new_directory/temp + server.jvm.additional=-Djna.tmpdir=/path_to_a_new_directory/temp + diff --git a/pom.xml b/pom.xml index bca2fb1..35c8ba0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,10 +6,10 @@ com.neo4jh3 neo4jh3 - 5.12.0 + 5.13.0 - 5.12.0 + 5.13.0 1.2 3.13.0 4.1.1 @@ -20,10 +20,7 @@ 3.4.1 3.10.1 3.22.0 - 3.0.0-M7 - - - + 3.0.0-M7 @@ -75,7 +72,7 @@ h3 ${uber.version} - + org.apache.commons commons-collections4 @@ -96,7 +93,7 @@ org.neo4j.driver neo4j-java-driver - 5.9.0 + 5.13.0 test @@ -118,13 +115,19 @@ + + osgeo + OSGeo Release Repository + https://repo.osgeo.org/repository/release/ + false + true + + diff --git a/src/main/java/com/neo4jh3/uber/Uberh3.java b/src/main/java/com/neo4jh3/uber/Uberh3.java index 02a9792..491d968 100755 --- a/src/main/java/com/neo4jh3/uber/Uberh3.java +++ b/src/main/java/com/neo4jh3/uber/Uberh3.java @@ -28,6 +28,7 @@ public class Uberh3 { public Transaction tx; private final static int DEFAULT_H3_RESOLUTION = 9; + private final static String NEO4J_H3_VERSION = "5.13.0"; private static H3Core h3 = null; @@ -519,6 +520,7 @@ public double distanceBetweenHexes(@Name("fromHexAddress") Long fromHexAddress, @UserFunction(name = "com.neo4jh3.distanceBetweenHexesString") @Description("CALL com.neo4jh3.distanceBetweenHexesString(fromHexAddress, toHexAddress)") public double distanceBetweenHexesString(@Name("fromHexAddress") String fromHexAddress, @Name("toHexAddress") String toHexAddress) throws InterruptedException { + double returnDistance = 0.0; if (h3 == null) { throw new InterruptedException("h3 failed to initialize"); } @@ -528,7 +530,7 @@ public double distanceBetweenHexesString(@Name("fromHexAddress") String fromHexA if (h3.isValidCell(fromHexAddress) && h3.isValidCell(fromHexAddress)){ LatLng fromGeoCoord = h3.cellToLatLng(fromHexAddress); LatLng toGeoCoord = h3.cellToLatLng(toHexAddress); - return h3.greatCircleDistance(fromGeoCoord, toGeoCoord, LengthUnit.km); + return returnDistance = Precision.round(h3.greatCircleDistance(fromGeoCoord, toGeoCoord, LengthUnit.km),6); } else { return -1.0; } @@ -754,7 +756,7 @@ public String pointash3String( @Description("com.neo4jh3.version() - Returns the version of the plugin.") public String neo4jH3Version() throws InterruptedException { - String h3Version = "5.11.0"; + String h3Version = NEO4J_H3_VERSION; if (h3 == null) { throw new InterruptedException("h3 failed to initialize"); } diff --git a/src/test/java/com/neo4jh3/Neo4jH3Test.java b/src/test/java/com/neo4jh3/Neo4jH3Test.java index 14517cc..f4b862c 100644 --- a/src/test/java/com/neo4jh3/Neo4jH3Test.java +++ b/src/test/java/com/neo4jh3/Neo4jH3Test.java @@ -122,7 +122,7 @@ public void should_return_hex_address() throws InterruptedException { } result = session.run("RETURN com.neo4jh3.version() AS value"); - assertEquals("\"5.11.0\"", result.single().get("value").toString()); + assertEquals("\"5.13.0\"", result.single().get("value").toString()); result = session.run("RETURN com.neo4jh3.cellToLatLngString('892830926cfffff') AS value"); assertEquals("\"37.564248,-122.325306\"", result.single().get("value").toString()); @@ -280,7 +280,7 @@ public void should_return_hex_address() throws InterruptedException { assertEquals(-1.0,result.single().get("value").asDouble(),0); result = session.run("return com.neo4jh3.distanceBetweenHexesString('8a2989352777fff','8a498935223ffff') as value"); - assertEquals(2360.8203881920604,result.single().get("value").asDouble(),0); + assertEquals(2360.820388,result.single().get("value").asDouble(),0); result = session.run("return com.neo4jh3.distanceBetweenHexesString('123','8a498935223ffff') as value"); assertEquals(-1.0,result.single().get("value").asDouble(),0);