Skip to content

Commit

Permalink
Port to Neo4j 4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner committed Oct 10, 2020
1 parent f6db5c0 commit 8cb121d
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 38 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The algorithms are designed to be used in two ways:
* or as a set of procedures directly in a running Neo4j server

The built-in procedures can be used as examples if you wish to build your own.
Otherwise simply copy the file named something like `dist/target/spatial-algorithms-dist-0.2.3-neo4j-4.0.8.jar`
Otherwise simply copy the file named something like `dist/target/spatial-algorithms-dist-0.2.3-neo4j-4.1.3.jar`
into the plugins folder of your Neo4j installation.

## Using the library in your Java project with Maven ##
Expand Down Expand Up @@ -104,14 +104,14 @@ Add the following repositories and dependency to your project's pom.xml:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-core</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-algo</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</dependency>
~~~

The version specified on the version line can be changed to match the version you wish to work with (based on the version of Neo4j itself you are using).
Too see which versions are available see the list at [Spatial Algorithms Releases](https://github.com/neo4j-contrib/m2/tree/master/releases/org/neo4j/spatial-algorithms-algo).
To see which versions are available see the list at [Spatial Algorithms Releases](https://github.com/neo4j-contrib/m2/tree/master/releases/org/neo4j/spatial-algorithms-algo).
9 changes: 1 addition & 8 deletions algo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>

<artifactId>spatial-algorithms-algo</artifactId>
Expand All @@ -25,13 +25,6 @@
<artifactId>hamcrest-library</artifactId>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-slf4j</artifactId>
<version>${neo4j.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-collections</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>

<artifactId>spatial-algorithms-benchmarks</artifactId>
Expand Down Expand Up @@ -76,13 +76,13 @@ THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-neo4j</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-viewer</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import java.nio.file.Path;

import static org.neo4j.configuration.GraphDatabaseInternalSettings.databases_root_path;

@State(Scope.Benchmark)
@Fork(1)
@BenchmarkMode(Mode.AverageTime)
Expand All @@ -45,7 +47,7 @@ public static void main(String[] args) throws RunnerException {

@Setup
public void setup() {
databases = new TestDatabaseManagementServiceBuilder().setConfig(GraphDatabaseSettings.databases_root_path, Path.of("benchmarks/data")).build();
databases = new TestDatabaseManagementServiceBuilder().setConfig(databases_root_path, Path.of("benchmarks/data")).build();
db = databases.database("sweden");

long[] ids = new long[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import java.nio.file.Path;

import static org.neo4j.configuration.GraphDatabaseInternalSettings.databases_root_path;

@State(Scope.Benchmark)
@Fork(1)
@BenchmarkMode(Mode.AverageTime)
Expand All @@ -42,7 +44,7 @@ public static void main(String[] args) throws RunnerException {

@Setup
public void setup() {
databases = new TestDatabaseManagementServiceBuilder().setConfig(GraphDatabaseSettings.databases_root_path, Path.of("benchmarks/data")).build();
databases = new TestDatabaseManagementServiceBuilder().setConfig(databases_root_path, Path.of("benchmarks/data")).build();
db = databases.database("sweden");

long[] ids = new long[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import java.nio.file.Path;

import static org.neo4j.configuration.GraphDatabaseInternalSettings.databases_root_path;

@State(Scope.Benchmark)
@Fork(1)
@BenchmarkMode(Mode.AverageTime)
Expand Down Expand Up @@ -50,7 +52,7 @@ public static void main(String[] args) throws RunnerException {

@Setup
public void setup() {
databases = new TestDatabaseManagementServiceBuilder().setConfig(GraphDatabaseSettings.databases_root_path, Path.of("benchmarks/data")).build();
databases = new TestDatabaseManagementServiceBuilder().setConfig(databases_root_path, Path.of("benchmarks/data")).build();
db = databases.database("sweden");

long[] ids = new long[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.nio.file.Path;
import java.util.Random;

import static org.neo4j.configuration.GraphDatabaseInternalSettings.databases_root_path;

@State(Scope.Benchmark)
@Fork(1)
@BenchmarkMode(Mode.AverageTime)
Expand Down Expand Up @@ -52,7 +54,7 @@ public static void main(String[] args) throws RunnerException {

@Setup
public void setup() {
databases = new TestDatabaseManagementServiceBuilder().setConfig(GraphDatabaseSettings.databases_root_path, Path.of("benchmarks/data")).build();
databases = new TestDatabaseManagementServiceBuilder().setConfig(databases_root_path, Path.of("benchmarks/data")).build();
db = databases.database("sweden");

long[] ids = new long[]{
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>

<artifactId>spatial-algorithms-dist</artifactId>
Expand Down
9 changes: 1 addition & 8 deletions neo4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>

<artifactId>spatial-algorithms-neo4j</artifactId>
Expand Down Expand Up @@ -64,13 +64,6 @@
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-slf4j</artifactId>
<version>${neo4j.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
10 changes: 6 additions & 4 deletions neo4j/src/main/java/org/neo4j/spatial/neo4j/Neo4jIDPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import org.neo4j.internal.helpers.collection.Iterators;
import org.neo4j.internal.kernel.api.NodeCursor;
import org.neo4j.internal.kernel.api.PropertyCursor;
import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.impl.api.TokenAccess;
import org.neo4j.memory.EmptyMemoryTracker;
import org.neo4j.spatial.core.CRS;
import org.neo4j.spatial.core.Point;

Expand Down Expand Up @@ -39,8 +41,8 @@ public boolean equals(Object other) {
@Override
public double[] getCoordinate() {
double[] coordinates = new double[2];
try ( NodeCursor nodeCursor = ktx.cursors().allocateNodeCursor();
PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor() ) {
try (NodeCursor nodeCursor = ktx.cursors().allocateNodeCursor(PageCursorTracer.NULL);
PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor(PageCursorTracer.NULL, EmptyMemoryTracker.INSTANCE)) {
ktx.dataRead().singleNode(nodeId, nodeCursor);
outer:
while (nodeCursor.next()) {
Expand All @@ -60,8 +62,8 @@ public double[] getCoordinate() {
@Override
public CRS getCRS() {
CRS crs = CRS.Cartesian;
try ( NodeCursor nodeCursor = ktx.cursors().allocateNodeCursor();
PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor() ) {
try ( NodeCursor nodeCursor = ktx.cursors().allocateNodeCursor(PageCursorTracer.NULL);
PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor(PageCursorTracer.NULL, EmptyMemoryTracker.INSTANCE) ) {
ktx.dataRead().singleNode(nodeId, nodeCursor);
outer:
while (nodeCursor.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import static java.lang.String.format;

public abstract class Neo4jSimpleGraphPolygon implements Polygon.SimplePolygon {
private long osmRelationId;
private CRS crs;
final private long osmRelationId;
final private CRS crs;
private Iterator<Node> nodeIterator;
boolean traversing;
Node start;
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
<packaging>pom</packaging>
<name>Spatial Algorithms</name>
<description>Utilities and Algorithms for Spatial Analysis</description>
Expand All @@ -20,7 +20,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<neo4j.version>4.0.8</neo4j.version>
<neo4j.version>4.1.3</neo4j.version>
<jmh.version>1.19</jmh.version>
<javac.target>11</javac.target>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion viewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>spatial-algorithms-parent</artifactId>
<version>0.2.3-neo4j-4.0.8</version>
<version>0.2.3-neo4j-4.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 8cb121d

Please sign in to comment.