How to save a polygon in neo4j using Spring boot

497 Views Asked by At

I am unable to import SpatialRepository and GraphRepository in Java for Neo4j spatial plugin in my interface.

I have to add polygon data using neo4j-spatial plugin to neo4j database.For this I am using wkt format. But nothing is importing due to version mismatch in my pom.xml.

I have tried changing the version of spatial plugin but still does not help. I am using embedded driver.

Am adding complete pom.xml configuration.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.neo4j</groupId>
<artifactId>Neo4j</artifactId>
<version>0.25.5-neo4j-3.3.5</version>
<packaging>jar</packaging>

<name>Neo4j</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
       <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-neo4j</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j</artifactId>
        <version>3.3.5</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-embedded-driver</artifactId>
        <version>${neo4j-ogm.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-bolt-driver</artifactId>
        <version>${neo4j-ogm.version}</version>
    </dependency>
   <dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
<dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-spatial</artifactId>
         <version>0.25.5-neo4j-3.3.5</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>

application.properties

spring.data.neo4j.uri=bolt://localhost
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=password

How can I resolve this issue?

Edit

With this gitRepo example clone also am getting same issue.

Edit:

Updated pom.xml

Edit

@NodeEntity
public class Geofence {

@Id
@GeneratedValue
private Long geofence_id;

private double latitude;

private double longitude;

@Indexed(indexName="GEOFENCE", indexType=IndexType.POINT)
private String wkt;
}

Here also am not able to import @Indexed, indexType=IndexType.POINT

Edit

If I add this dependency I get GraphRepository and SpatialRepository

<dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>3.3.1.RELEASE</version>
     </dependency>

But Neo4jRepository will not work in my spring boot project

0

There are 0 best solutions below