Skip to content

Commit 3f83c28

Browse files
authored
cleanup code (apply intellij code inspection fixes) (#398)
1 parent 4ed2740 commit 3f83c28

File tree

132 files changed

+1119
-1250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1119
-1250
lines changed

README.md

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ highlighted the need for a new approach to spatial libraries for Neo4j.
4545

4646
This library was originally written in 2010 when Neo4j was still releasing early 1.x versions.
4747
This means it made use of internal Java API's that were deprecated over the years, some as early as Neo4j 2.x.
48-
When Neo4j 4.0 was released, many deprecated API's were entirely removed.
48+
When Neo4j 4.0 was released, many deprecated APIs were entirely removed.
4949
And the transaction API was changed in a fundamental way.
5050
This has meant that the spatial library needed a major refactoring to work with Neo4j 4.x:
5151

@@ -69,7 +69,7 @@ This has meant that the spatial library needed a major refactoring to work with
6969
It was therefor necessary to upgrade the GeoTools libraries to version 24.2.
7070
This in turn required a re-write of the Neo4jDataStore interface since the older API had
7171
long been deprecated, and was entirely unavailable in newer versions.
72-
* Neo4j 4.1 was slightly stricter with regards to passing nodes as parameters, requiring the nodes
72+
* Neo4j 4.1 was slightly stricter in regard to passing nodes as parameters, requiring the nodes
7373
objects to have been created in the current transaction.
7474
To work around this we added `.byId` versions of the `spatial.addNode` and `spatial.removeNode` procedures.
7575
We also changed the `spatial.removeNode` procedures to return `nodeId` instead of `node`.
@@ -82,7 +82,7 @@ This has meant that the spatial library needed a major refactoring to work with
8282
* 0.28.0 tackles the ability to import multiple OSM files. The initial solution for Neo4j 4.x made use
8383
of schema indexes keyed by the label and property. However, that means that all OSM imports would share
8484
the same index. If they are completely disjointed data sets, this would not matter. But if you import
85-
overlapping OSM files or different versions of the same file file, a mangled partial merger would result.
85+
overlapping OSM files or different versions of the same file, a mangled partial merger would result.
8686
0.28.0 solves this by using different indexes, and keeping all imports completely separate.
8787
The more complex problems of importing newer versions, and stitching together overlapping areas, are not
8888
yet solved.
@@ -132,7 +132,7 @@ The key concepts of this library include:
132132
* Multile CoordinationReferenceSystem support using GeoTools
133133
* Support the concept of multiple geographic layers, each with its own CRS and Index
134134
* Include an index capable of searching for complex geometries (in-graph RTree index)
135-
* Support import and export in a number of known formats (eg. Shapefile and OSM)
135+
* Support import and export in a number of known formats (e.g. Shapefile and OSM)
136136
* Embed the library and Neo4j within GIS tools like uDig and GeoServer
137137

138138
Some key features include:
@@ -183,7 +183,7 @@ instructions on the spatial server plugin below.
183183
## Layers and GeometryEncoders ##
184184

185185
The primary type that defines a collection of geometries is the Layer. A layer contains an index for querying. In
186-
addition a Layer can be an EditableLayer if it is possible to add and modify geometries in the layer. The next most
186+
addition, a Layer can be an EditableLayer if it is possible to add and modify geometries in the layer. The next most
187187
important interface is the GeometryEncoder.
188188

189189
The DefaultLayer is the standard layer, making use of the WKBGeometryEncoder for storing all geometry types as byte[]
@@ -192,8 +192,9 @@ properties of one node per geometry instance.
192192
The OSMLayer is a special layer supporting Open Street Map and storing the OSM model as a single fully connected graph.
193193
The set of Geometries provided by this layer includes Points, LineStrings and Polygons, and as such cannot be exported
194194
to Shapefile format, since that format only allows a single Geometry per layer. However, OMSLayer extends DynamicLayer,
195-
which allow it to provide any number of sub-layers, each with a specific geometry type and in addition based on a OSM
196-
tag filter. For example you can have a layer providing all cycle paths as LineStrings, or a layer providing all lakes as
195+
which allow it to provide any number of sub-layers, each with a specific geometry type and in addition based on an OSM
196+
tag filter. For example, you can have a layer providing all cycle paths as LineStrings, or a layer providing all lakes
197+
as
197198
Polygons. Underneath these are all still backed by the same fully connected graph, but exposed dynamically as apparently
198199
separate geometry layers.
199200

@@ -204,17 +205,17 @@ separate geometry layers.
204205
Spatial data is divided in Layers and indexed by a RTree.
205206

206207
~~~java
207-
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(storeDir);
208-
try{
208+
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(storeDir);
209+
try{
209210
ShapefileImporter importer = new ShapefileImporter(database);
210-
importer.
211+
importer.
211212

212213
importFile("roads.shp","layer_roads");
213-
}finally{
214-
database.
214+
}finally{
215+
database.
215216

216217
shutdown();
217-
}
218+
}
218219
~~~
219220

220221
If using the server, the same can be achieved with spatial procedures (3.x only):
@@ -232,35 +233,35 @@ read this that will already be available. Refer to the unit tests in classes Tes
232233
latest code for importing OSM data. At the time of writing the following worked:
233234

234235
~~~java
235-
OSMImporter importer = new OSMImporter("sweden");
236-
Map<String, String> config = new HashMap<String, String>();
237-
config.put("neostore.nodestore.db.mapped_memory", "90M" );
238-
config.put("dump_configuration", "true");
239-
config.put("use_memory_mapped_buffers", "true");
240-
BatchInserter batchInserter = BatchInserters.inserter(new File(dir), config);
241-
importer.importFile(batchInserter, "sweden.osm", false);
242-
batchInserter.shutdown();
243-
244-
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(dir);
245-
importer.reIndex(db, 10000);
246-
db.shutdown();
236+
OSMImporter importer = new OSMImporter("sweden");
237+
Map<String, String> config = new HashMap<String, String>();
238+
config.put("neostore.nodestore.db.mapped_memory", "90M" );
239+
config.put("dump_configuration", "true");
240+
config.put("use_memory_mapped_buffers", "true");
241+
BatchInserter batchInserter = BatchInserters.inserter(new File(dir), config);
242+
importer.importFile(batchInserter, "sweden.osm", false);
243+
batchInserter.shutdown();
244+
245+
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(dir);
246+
importer.reIndex(db, 10000);
247+
db.shutdown();
247248
~~~
248249

249250
### Executing a spatial query ###
250251

251252
~~~java
252-
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(storeDir);
253-
try {
254-
SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
255-
Layer layer = spatialService.getLayer("layer_roads");
256-
SpatialIndexReader spatialIndex = layer.getIndex();
257-
258-
Search searchQuery = new SearchIntersectWindow(new Envelope(xmin, xmax, ymin, ymax));
259-
spatialIndex.executeSearch(searchQuery);
260-
List<SpatialDatabaseRecord> results = searchQuery.getResults();
261-
} finally {
253+
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(storeDir);
254+
try {
255+
SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
256+
Layer layer = spatialService.getLayer("layer_roads");
257+
SpatialIndexReader spatialIndex = layer.getIndex();
258+
259+
Search searchQuery = new SearchIntersectWindow(new Envelope(xmin, xmax, ymin, ymax));
260+
spatialIndex.executeSearch(searchQuery);
261+
List<SpatialDatabaseRecord> results = searchQuery.getResults();
262+
} finally {
262263
database.shutdown();
263-
}
264+
}
264265
~~~
265266

266267
If using the server, the same can be achieved with spatial procedures (3.x only):
@@ -360,7 +361,7 @@ This has not been tested at all in any GeoTools enabled application, but could p
360361
~~~
361362

362363
The version specified on the version line can be changed to match the version you wish to work with (based on the
363-
version of Neo4j itself you are using). Too see which versions are available see the list
364+
version of Neo4j itself you are using). To see which versions are available see the list
364365
at [Neo4j Spatial Releases](https://github.com/neo4j-contrib/m2/tree/master/releases/org/neo4j/neo4j-spatial).
365366

366367
* start the GeoServer webapp again with the added neo4j profile
@@ -437,7 +438,7 @@ The server plugin provides access to the internal spatial capabilities using thr
437438
* A REST API for creating layers and adding nodes or geometries to layers.
438439
* For usage information
439440
see [Neo4j Spatial Manual REST](http://neo4j-contrib.github.io/spatial/#spatial-server-plugin)
440-
* Note that this API provides only limited access to Spatial, with no access the the GeoPipes or import utilities
441+
* Note that this API provides only limited access to Spatial, with no access the GeoPipes or import utilities
441442
* This API was entirely removed when support for Neo4j 4.0 was added (version 0.27)
442443
* An IndexProvider API (2.x only) for Cypher access using START node=node:geom({query})
443444
* It is only possible to add nodes and query for nodes, and the resulting graph structure is not compatible with any
@@ -473,7 +474,7 @@ for examples.
473474

474475
### Building Neo4j Spatial Documentation ###
475476

476-
Add your Github credentials in your `~/.m2/settings.xml`
477+
Add your GitHub credentials in your `~/.m2/settings.xml`
477478

478479
~~~xml
479480
<settings>
@@ -531,17 +532,17 @@ Add the following repositories and dependency to your project's pom.xml:
531532
~~~
532533

533534
The version specified on the last version line can be changed to match the version you wish to work with (based on the
534-
version of Neo4j itself you are using). Too see which versions are available see the list
535+
version of Neo4j itself you are using). To see which versions are available see the list
535536
at [Neo4j Spatial Releases](https://github.com/neo4j-contrib/m2/tree/master/releases/org/neo4j/neo4j-spatial).
536537

537538
## Running Neo4j spatial code from the command-line ##
538539

539540
Some of the classes in Neoj4-Spatial include main() methods and can be run on the command-line.
540541
For example there are command-line options for importing SHP and OSM data. See the main methods
541-
in the OSMImporter and ShapefileImporter classes. Here we will describe how to setup the dependencies
542+
in the OSMImporter and ShapefileImporter classes. Here we will describe how to set up the dependencies
542543
for running the command-line, using the OSMImporter and the sample OSM file two-street.osm.
543544
We will show two ways to run this on the command line, one with the java command itself, and the
544-
other using the 'exec:java' target in maven. In both cases we use maven to setup the dependencies.
545+
other using the 'exec:java' target in maven. In both cases we use maven to set up the dependencies.
545546

546547
### Compile ###
547548

neo.sld.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<StyledLayerDescriptor version="1.0.0"
2424
xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
2525
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26-
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
26+
xsi:schemaLocation="http://www.opengis.net/sld https://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
2727
<NamedLayer>
2828
<Name>Example Neo4j Spatial OSM Style</Name>
2929
<UserStyle>

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
44
<properties>
55
<neo4j.version>5.13.0</neo4j.version>
66
<neo4j.java.version>17</neo4j.java.version>
@@ -23,11 +23,11 @@
2323
<version>0.30.0-neo4j-5.13.0</version>
2424
<name>Neo4j - Spatial Components</name>
2525
<description>Spatial utilities and components for Neo4j</description>
26-
<url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>
26+
<url>https://components.neo4j.org/${project.artifactId}/${project.version}</url>
2727
<inceptionYear>2010</inceptionYear>
2828
<packaging>jar</packaging>
2929
<scm>
30-
<url>http://github.com/neo4j/spatial/</url>
30+
<url>https://github.com/neo4j/spatial/</url>
3131
<connection>scm:git:git://github.com/neo4j/spatial.git</connection>
3232
<developerConnection>scm:git:git@github.com:neo4j/spatial.git</developerConnection>
3333
<tag>HEAD</tag>
@@ -261,7 +261,7 @@
261261
<licenses>
262262
<license>
263263
<name>GNU General Public License, Version 3</name>
264-
<url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
264+
<url>https://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
265265
<comments>The software ("Software") developed and owned by Neo4j Sweden AB
266266
(referred to in this notice as "Neo4j") is licensed under the GNU
267267
GENERAL PUBLIC LICENSE Version 3 to all third parties and that license

src/docs/dev/examples.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Also review the classes in the +org.neo4j.gis.spatial.query package+ for the ful
4747
[[spatial-export-shapefile]]
4848
== Export a shapefile
4949

50-
The ESRI Shapefile that we imported in the first example above was actually created by Neo4j-Spatial. It is possible to use the results of a query, or a DynamicLayer, to create a new Shapefile using the ShapefileExporter. If we were to export the complete layer created from importing a shapefile, we would not achieve much, but we can could use this capability to create shapefiles that are subsets of other layers, or that are created from data in another format.
50+
The ESRI Shapefile that we imported in the first example above was actually created by Neo4j-Spatial. It is possible to use the results of a query, or a DynamicLayer, to create a new Shapefile using the ShapefileExporter. If we were to export the complete layer created from importing a shapefile, we would not achieve much, but we could use this capability to create shapefiles that are subsets of other layers, or that are created from data in another format.
5151

5252
[source,java,indent=0]
5353
----
@@ -61,7 +61,7 @@ This example shows how we can import an OSM dataset, which contains data with a
6161
include::{sourceDir}/org/neo4j/gis/spatial/TestsForDocs.java[tags=exportShapefileFromQuery]
6262
----
6363

64-
This time we import the same OSM model, but query for all geometries inside a envelope, and export that to a new Shapefile.
64+
This time we import the same OSM model, but query for all geometries inside an envelope, and export that to a new Shapefile.
6565

6666
[[spatial-geopipes]]
6767
== GeoPipes

src/docs/dev/geoserver2.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Here we provide very basic instructions, with factors to consider regarding inst
1212
* Choose the right version for the version of Neo4j Spatial you are going to use:
1313
* Neo4j-Spatial trunk is currently coded to work with GeoTools 2.7, so this means we need to load it into GeoServer 2.1 or later. The version we tested against was geoserver-2.1-beta1
1414
* If you want to deploy on the stable release of GeoServer 2.0.2, then you can use an older Neo4j-Spatial, or modify the code to work with GeoTools 2.6 (the differences are small). The last version of Neo4j Spatial that works with the GeoServer 2.0 series, is from the end of September 2010.
15-
* If you already have a servlet container running, you can download the WAR version, otherwise download the BIN version (or the windows installer if on windows). Install and run using the included instructions in geoserver.
16-
* Once installed, open a web browser on on http://localhost:8080/geoserver/web/ (or other location is you configured it differently) to test that geoserver is runnning correctly.
15+
* If you already have a servlet container running, you can download the WAR version, otherwise download the BIN version (or the Windows installer if on Windows). Install and run using the included instructions in geoserver.
16+
* Once installed, open a web browser on http://localhost:8080/geoserver/web/ (or other location is you configured it differently) to test that geoserver is runnning correctly.
1717

1818
=== Adding Neo4j Spatial
1919

@@ -25,7 +25,7 @@ Install Neo4j-Spatial by copying the following JAR files into the in the GeoServ
2525
* neo4j-index-1.2-1.2.M03.jar
2626
* neo4j-spatial.jar
2727

28-
Getting this last jar can be achieved by using maven to compile from source, or by simply browsing to the maven repository website at http://m2.neo4j.org/org/neo4j/neo4j-spatial/
28+
Getting this last jar can be achieved by using maven to compile from source, or by simply browsing to the maven repository website at http://m2.neo4j.org/org/neo4j/neo4j-spatial/
2929

3030
At the time of writing the latest JAR was:
3131

@@ -57,7 +57,7 @@ image::Geoserver-3-path-to-neo4j-db.png[]
5757

5858
* One option for the database location is a database created using the unit tests in Neo4j Spatial. The rest of this wiki assumes that you ran the TestDynamicLayers unit test which loads an OSM dataset for the city of Malmö in Sweden, and then creates a number of Dynamic Layers (or views) on this data, which we can publish in GeoServer.
5959
* If you do use the unit test for the sample database, then the location of the database will be in the target/var/neo4j-db directory of the Neo4j Source code.
60-
* Type the URL as the full path to the neostore.id file in the database directory
60+
* Type the URL as the full path to the neostore-id file in the database directory
6161

6262
== Publish from data source
6363

@@ -117,6 +117,6 @@ image::Geoserver-12-layer-group-preview.png[]
117117

118118
== Controlling layer style
119119

120-
If you want to change the styles of the layers, one option is to go back to the layers list, select a layer, click the display tab and edit the styling information. This will also effect the preview in openlayers.
120+
If you want to change the styles of the layers, one option is to go back to the layers list, select a layer, click the display tab and edit the styling information. This will also affect the preview in openlayers.
121121

122-
image::Geoserver-13-layers-preview-with-styles.png[]
122+
image::Geoserver-13-layers-preview-with-styles.png[]

0 commit comments

Comments
 (0)