I did a POC using SDN 3.3.0 sometime back.
Currently, I'm trying to do a POC on SDN 4.0.0.M1. I was able to create a running project in which repositories querying the DB exist on the application side. But it's performance isn't that great.
I'm trying to create a extension which can run as a plugin inside the server. But the problem here is that SDN API is quite changed between 3.3.0 and 4.0.0.M1.
I'm currently stuck at exposing my domain objects in the extension. In 3.3.0, we have SpringPluginInitializer which can be used for the same but couldn't find anything similar in 4.0. Can anyone give any pointers or tutorials on how to configure a plugin using SDN 4.0?
PFB the domain objects and repositories:
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 - Any idea when SDN 4.0 GA release is?
Thanks in advance,
Rahul