Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
74bf0a6
Add missing @Override annotations and remove unneeded else clauses
seabamirum Feb 27, 2024
c13d290
More code cleanup, mostly removing else clause and adding overrides
seabamirum Feb 28, 2024
4bc4dda
Match neo4j, java, and package versions of remote
seabamirum Feb 28, 2024
89f36d0
Merge remote-tracking branch 'refs/remotes/origin/master' into fork/s…
Andy2003 May 29, 2024
d889795
Merge remote-tracking branch 'refs/remotes/origin/master' into fork/s…
Andy2003 May 29, 2024
ba6b5ea
fix review comments
Andy2003 May 29, 2024
7d8c46f
neo4j 5.19, polishes
seabamirum May 29, 2024
65553b4
Merge remote-tracking branch 'refs/remotes/origin/master' into neo4j-…
Andy2003 May 30, 2024
b3134b7
Merge pull request #1 from neo4j-contrib/master
seabamirum May 30, 2024
c64dde2
Merge branch 'neo4j-latest-java21' of
seabamirum May 30, 2024
2cfb14b
Delete .factorypath
seabamirum May 30, 2024
f369c98
Added back newline at end of file
seabamirum May 30, 2024
5eefe69
Removed private unused methods, variables and unthrown exceptions
seabamirum May 30, 2024
aafc1cd
Added back line breaks at end of files
seabamirum May 31, 2024
ff475ad
Merge branch 'neo4j-contrib:master' into neo4j-latest-java21
seabamirum Jun 8, 2024
229e727
Merge branch 'neo4j-contrib:master' into neo4j-latest-java21
seabamirum Jun 23, 2024
f2b3f02
Merge pull request #2 from neo4j-contrib/master
seabamirum Nov 4, 2024
f77248a
Fix spatial procedures call to be compatible with 5.23+
seabamirum Nov 4, 2024
c979207
Fix compile errors with 5.26.0
seabamirum Jan 17, 2025
8af1164
Merge branch 'master' into neo4j-latest-java21
Andy2003 Feb 17, 2025
f08944c
cleanup
Andy2003 Feb 17, 2025
4f0a242
update images from test-run
Andy2003 Feb 17, 2025
4d6d082
Merge branch 'master' into neo4j-latest-java21
Andy2003 Feb 18, 2025
6d8c292
Merge remote-tracking branch 'origin/master' into neo4j-latest-java21
Andy2003 Apr 1, 2025
51d8400
Merge remote-tracking branch 'origin/master' into neo4j-latest-java21
Andy2003 Apr 1, 2025
6c9c6eb
remove generated docs/index.html
Andy2003 Apr 1, 2025
05cd90d
Merge remote-tracking branch 'origin/master' into neo4j-latest-java21
Andy2003 Apr 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup-jdk/action.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "Setups JDK"
description: "Setups JDK 17"
description: "Setups JDK 21"
runs:
using: "composite"
steps:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: adopt
2,160 changes: 2,160 additions & 0 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<properties>
<neo4j.version>5.26.2</neo4j.version>
<neo4j.java.version>17</neo4j.java.version>
<neo4j.java.version>21</neo4j.java.version>
<skinGroupId>org.neo4j.maven.skins</skinGroupId>
<skinArtifactId>default-skin</skinArtifactId>
<skinVersion>2</skinVersion>
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/org/geotools/data/neo4j/Neo4jSpatialDataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,4 @@ public Style getStyle(String typeName) {
}
return result;
}

private EditableLayer getEditableLayer(String typeName) throws IOException {
try (Transaction tx = database.beginTx()) {
Layer layer = spatialDatabase.getLayer(tx, typeName);
if (layer == null) {
throw new IOException("Layer not found: " + typeName);
}

if (!(layer instanceof EditableLayer)) {
throw new IOException("Cannot create a FeatureWriter on a read-only layer: " + layer);
}
tx.commit();

return (EditableLayer) layer;
}
}
}
8 changes: 0 additions & 8 deletions src/main/java/org/neo4j/gis/spatial/DynamicLayerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.neo4j.gis.spatial;

import java.io.File;
import java.io.PrintStream;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -169,12 +168,6 @@ public String[] getNames() {
public int getNodeCount() {
return nodeCount;
}

public void describeUsage(PrintStream out) {
for (String name : names.keySet()) {
out.println(name + "\t" + names.get(name));
}
}
}

/**
Expand All @@ -196,7 +189,6 @@ public void restrictLayerProperties(Transaction tx) {
System.out.println(
"After property scan of " + search.getNodeCount() + " nodes, we have " + getExtraPropertyNames(
tx).length + " known attributes for layer " + getName());
// search.describeUsage(System.out);
}

public Node configNode(Transaction tx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void refreshGeomNode(Transaction tx) {
* @deprecated This method is of questionable value, since it is better to
* query the geometry object directly, outside the result
*/
@Deprecated
public int getType() {
//TODO: Get the type from the geometryEncoder
return SpatialDatabaseService.convertJtsClassToGeometryType(getGeometry().getClass());
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/neo4j/gis/spatial/SpatialDatabaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;

/**
Expand Down Expand Up @@ -288,17 +287,6 @@ public Layer findLayerContainingGeometryNode(Transaction tx, Node geometryNode)
return null;
}

private Layer getLayerFromChild(Transaction tx, Node child, RelationshipType relType) {
Relationship indexRel = child.getSingleRelationship(relType, Direction.INCOMING);
if (indexRel != null) {
Node layerNode = indexRel.getStartNode();
if (layerNode.hasProperty(PROP_LAYER)) {
return LayerUtilities.makeLayerFromNode(tx, indexManager, layerNode);
}
}
return null;
}

public boolean containsLayer(Transaction tx, String name) {
return getLayer(tx, name) != null;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/neo4j/gis/spatial/WKBGeometryEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
import org.locationtech.jts.io.WKBReader;
import org.locationtech.jts.io.WKBWriter;
import org.neo4j.gis.spatial.encoders.AbstractSinglePropertyEncoder;
import org.neo4j.gis.spatial.encoders.Configurable;
import org.neo4j.graphdb.Entity;
import org.neo4j.graphdb.Transaction;

public class WKBGeometryEncoder extends AbstractSinglePropertyEncoder implements Configurable {
public class WKBGeometryEncoder extends AbstractSinglePropertyEncoder {

@Override
public Geometry decodeGeometry(Entity container) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/neo4j/gis/spatial/WKTGeometryEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.io.WKTWriter;
import org.neo4j.gis.spatial.encoders.AbstractSinglePropertyEncoder;
import org.neo4j.gis.spatial.encoders.Configurable;
import org.neo4j.graphdb.Entity;
import org.neo4j.graphdb.Transaction;

public class WKTGeometryEncoder extends AbstractSinglePropertyEncoder implements Configurable {
public class WKTGeometryEncoder extends AbstractSinglePropertyEncoder {

@Override
public Geometry decodeGeometry(Entity container) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.HashMap;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;

public abstract class PropertyMapper {

Expand All @@ -45,7 +44,7 @@ public boolean equals(Object obj) {
return false;
}

protected void save(Transaction tx, Node node) {
protected void save(Node node) {
node.setProperty("from", this.from);
node.setProperty("to", this.to);
node.setProperty("type", this.type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void save(Transaction tx) {
}
for (PropertyMapper mapper : toSave) {
Node node = tx.createNode();
mapper.save(tx, node);
mapper.save(node);
layer.getLayerNode(tx).createRelationshipTo(node, SpatialRelationshipTypes.PROPERTY_MAPPING);
}
}
Expand All @@ -89,14 +89,6 @@ private void addPropertyMapper(Transaction tx, PropertyMapper mapper) {
save(tx);
}

private PropertyMapper removePropertyMapper(Transaction tx, String to) {
PropertyMapper mapper = getPropertyMappers(tx).remove(to);
if (mapper != null) {
save(tx);
}
return mapper;
}

public PropertyMapper getPropertyMapper(Transaction tx, String to) {
return getPropertyMappers(tx).get(to);
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/neo4j/gis/spatial/filter/SearchCQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,19 @@
*/
public class SearchCQL implements SearchFilter {

private final Transaction tx;
private final Neo4jFeatureBuilder featureBuilder;
private final Layer layer;
private final org.geotools.api.filter.Filter filter;
private final Envelope filterEnvelope;

public SearchCQL(Transaction tx, Layer layer, org.geotools.api.filter.Filter filter) {
this.tx = tx;
this.layer = layer;
this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
this.filter = filter;
this.filterEnvelope = Utilities.extractEnvelopeFromFilter(filter);
}

public SearchCQL(Transaction tx, Layer layer, String cql) {
this.tx = tx;
this.layer = layer;
this.featureBuilder = Neo4jFeatureBuilder.fromLayer(tx, layer);
try {
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/neo4j/gis/spatial/index/IndexManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,9 @@ private String description() {
private class IndexRemover implements Runnable {

private final IndexDefinition index;
private Exception e;

private IndexRemover(IndexDefinition index) {
this.index = index;
this.e = null;
}

@Override
Expand All @@ -266,8 +264,7 @@ public void run() {
}
tx.commit();
}
} catch (Exception e) {
this.e = e;
} catch (Exception ignored) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.geotools.api.referencing.cs.CoordinateSystemAxis;
import org.locationtech.jts.geom.Geometry;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/neo4j/gis/spatial/osm/OSMImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void logNodesFound(long currentTime) {
LogCounter found = nodeFindStats.get(type);
double rate = 0.0f;
if (found.totalTime > 0) {
rate = (1000.0 * (float) found.count / (float) found.totalTime);
rate = (1000.0 * found.count / found.totalTime);
}
System.out.println("\t" + type + ": \t" + found.count
+ "/" + (found.totalTime / 1000)
Expand All @@ -531,8 +531,8 @@ void logNodeAddition(LinkedHashMap<String, Object> tags,
}
if (currentTime - logTime > 1432) {
System.out.println(
new Date(currentTime) + ": Saving " + type + " " + count + " \t(" + (1000.0 * (float) count
/ (float) (currentTime - firstLogTime)) + " " + type + "/second)");
new Date(currentTime) + ": Saving " + type + " " + count + " \t(" + (1000.0 * count
/ (currentTime - firstLogTime)) + " " + type + "/second)");
logTime = currentTime;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ public Stream<NameResult> listProcedures() {
GlobalProcedures procedures = ((GraphDatabaseAPI) db).getDependencyResolver()
.resolveDependency(GlobalProcedures.class);
Stream.Builder<NameResult> builder = Stream.builder();
procedures.getCurrentView().getAllProcedures(QueryLanguage.CYPHER_5).forEach(proc -> {
if (proc.name().namespace()[0].equals("spatial")) {
builder.accept(new NameResult(proc.name().toString(), proc.toString()));
}
});

procedures.getCurrentView().getAllProcedures(QueryLanguage.CYPHER_5)
.filter(proc -> proc.name().namespace()[0].equals("spatial"))
.map(proc -> new NameResult(proc.name().toString(), proc.toString()))
.forEach(builder);

return builder.build();
}

Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
Expand Down Expand Up @@ -237,7 +238,7 @@ public void add(Transaction tx, List<Node> geomNodes) {
}
nodesToAdd.addAll(geomNodes);
detachGeometryNodes(tx, false, getIndexRoot(tx), new NullListener());
deleteTreeBelow(tx, getIndexRoot(tx));
deleteTreeBelow(getIndexRoot(tx));
buildRtreeFromScratch(tx, getIndexRoot(tx), decodeGeometryNodeEnvelopes(nodesToAdd), 0.7);
countSaved = false;
totalGeometryCount = nodesToAdd.size();
Expand Down Expand Up @@ -1068,13 +1069,9 @@ private static Node chooseIndexNodeWithSmallestArea(List<Node> indexNodes) {
}

private static int countChildren(Node indexNode, RelationshipType relationshipType) {
int counter = 0;
try (var relationships = indexNode.getRelationships(Direction.OUTGOING, relationshipType)) {
for (Relationship ignored : relationships) {
counter++;
}
return (int) StreamSupport.stream(relationships.spliterator(), false).count();
}
return counter;
}

/**
Expand Down Expand Up @@ -1409,7 +1406,7 @@ private static double getArea(Envelope e) {
return e.getArea();
}

private static void deleteTreeBelow(Transaction ignored, Node rootNode) {
private static void deleteTreeBelow(Node rootNode) {
try (var relationships = rootNode.getRelationships(Direction.OUTGOING, RTreeRelationshipTypes.RTREE_CHILD)) {
for (Relationship relationship : relationships) {
deleteRecursivelySubtree(relationship.getEndNode(), relationship);
Expand Down
Loading