Skip to content

Commit

Permalink
Updates for Neo4j 5.13
Browse files Browse the repository at this point in the history
Updated for Neo4j 5.13
  • Loading branch information
davidfauth committed Nov 22, 2023
1 parent 06fde2a commit 9403f3c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

31 changes: 17 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<groupId>com.neo4jh3</groupId>
<artifactId>neo4jh3</artifactId>
<version>5.12.0</version>
<version>5.13.0</version>

<properties>
<neo4j.version>5.12.0</neo4j.version>
<neo4j.version>5.13.0</neo4j.version>
<csv.version>1.2</csv.version>
<lang3.version>3.13.0</lang3.version>
<uber.version>4.1.1</uber.version>
Expand All @@ -20,10 +20,7 @@
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<assertj.version>3.22.0</assertj.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>



<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -75,7 +72,7 @@
<artifactId>h3</artifactId>
<version>${uber.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
Expand All @@ -96,7 +93,7 @@
<!-- Used to send cypher statements to our procedure. -->
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>5.9.0</version>
<version>5.13.0</version>
<scope>test</scope>
</dependency>

Expand All @@ -118,13 +115,19 @@
</dependencies>

<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<!--
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<id>maven-repository</id>
<url>file:////Users/davidfauth/.m2/repository/com/uber/h3/4.1.2-SNAPSHOT</url>
</repository>
-->
</repositories>

<build>
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/neo4jh3/uber/Uberh3.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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");
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/neo4jh3/Neo4jH3Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9403f3c

Please sign in to comment.