5

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

Hema
  • 988
  • 1
  • 16
  • 38
  • @Indexed was removed, see https://stackoverflow.com/a/38576001/1209430 – Juan Mellado May 08 '18 at 19:08
  • @JuanMellado Thank you for your response. If its removed then can i knw any other way of saving polygon to neo4j database using spring boot 2+ – Hema May 09 '18 at 07:10
  • You should open a new question, I can't help you more, I just realized that the annotation was removed from API – Juan Mellado May 09 '18 at 09:48
  • Why is there any need for you to get the `GraphRepository` or `SpatialRepository`? Current versions of Spring Data Neo4j only have the `Neo4jRepository` interface to work with. – meistermeier Jul 05 '18 at 12:40
  • Yes now am using neo4jRepository. – Hema Jul 05 '18 at 12:41

0 Answers0