SDN 4.0.0.M1扩展配置

时间:2015-06-27 08:08:28

标签: neo4j spring-data-neo4j spring-data-neo4j-4

我在某个时候使用SDN 3.3.0做过POC。

目前,我正在尝试在SDN 4.0.0.M1上进行POC。我能够创建一个正在运行的项目,其中在应用程序端存在查询数据库的存储库。但它的表现并不那么好。

我正在尝试创建一个可以作为服务器内部插件运行的扩展程序。但问题是SDN API在3.3.0和4.0.0.M1之间发生了很大的变化。

我目前停留在扩展程序中公开我的域对象。在3.3.0中,我们有SpringPluginInitializer,它可以用于相同的但不能在4.0中找到类似的东西。 任何人都可以提供有关如何使用SDN 4.0配置插件的任何指针或教程吗?

PFB域对象和存储库:

package org.neo4j.domain;

import org.neo4j.ogm.annotation.EndNode;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.annotation.StartNode;

@RelationshipEntity(type = "HAS_ADDRESS")
public class EmployeeToAddressRelationship {

    @GraphId
    private Long id;

    @StartNode  private Employee employee;
    @EndNode  private Address address;
    //@RelationshipType private relationshipType;

    public EmployeeToAddressRelationship()
    {
        super();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public Employee getEmployee() {
        return employee;
    }
    public void setEmployee(Employee employee) {
        this.employee = employee;
    }
    public Address getAddresss() {
        return address;
    }
    public void setAddresss(Address address) {
        this.address = address;
    }


}




package org.neo4j.domain;

import org.springframework.data.annotation.TypeAlias;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;

@NodeEntity
@TypeAlias("ADDRESS")
public class Address {

@GraphId
private Long id;

public String property1;
public String property2;
public String property3;
public String property4;


Address(){}

//getters and setters for all properties

}







package org.neo4j.repository;

import java.util.Map;
import org.neo4j.domain.Employee2Result;
import org.neo4j.domain.Address;
import org.neo4j.domain.Employee;
import org.neo4j.domain.EmployeeToAddressRelationship;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface EmployeeRepository extends CrudRepository<Employee, String> {

@Query("MATCH p=(node1:NODE1)<-[rel1:REL1]-(node2:NODE2)<-[rel2:REL2]-(node3:NODE3)<-[rel3:REL3]-(node4:NODE4)<-[empRel:REL4]-(emp:EMPLOYEE) WHERE node1.property1={0} AND node2.property2={1} AND node3.property3={2} RETURN emp ORDER BY emp.timestamp DESC")
public Iterable<Employee> method1(String property1, String property2, String property3);

@Query("MATCH p=(node1:NODE1)<-[rel1:REL1]-(node2:NODE2)<-[rel2:REL2]-(node3:NODE3)<-[rel3:REL3]-(node4:NODE4)<-[empRel:REL4]-(emp:EMPLOYEE)-[addressRel:HAS_ADDRESS]->(address:ADDRESS) WHERE node1.property1={0} AND node2.property2={1} AND node3.property3={2} RETURN emp,addressRel,address ORDER BY emp.timestamp DESC")
public Iterable<Employee2Result> method2(String property1, String property2, String property3);

}




package org.neo4j.domain;

import java.util.Set;
import org.springframework.data.annotation.TypeAlias;
import  org.neo4j.ogm.annotation.GraphId;
import  org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
import org.neo4j.ogm.annotation.typeconversion.DateString;
import org.neo4j.ogm.annotation.typeconversion.NumberString;

@NodeEntity(label="EMPLOYEE")
public class Employee {

@GraphId
private Long id;

public String property1;

public String property2;

public String property3;

public String property4;

@Relationship(type = "HAS_ADDRESS", direction = Relationship.UNDIRECTED)
Set<Address> address;


public Searchspace()
{}

//getters and setters for all properties

}






package org.neo4j.domain;

import org.neo4j.ogm.annotation.ResultColumn;
import org.springframework.data.neo4j.annotation.QueryResult;

@QueryResult
public class Employee2Result {

@ResultColumn("emp")
Employee emp;

@ResultColumn("address")
Address address;

@ResultColumn("addressRel")
EmployeeToAddressRelationship addressRel;

//getters and setters for all properties


}

PS - 什么时候发布SDN 4.0 GA?

提前致谢,

的Rahul

0 个答案:

没有答案