我有一个Spring Data Neo4j应用程序需要对Neo4j Community Edition(3.2)进行批量数据写入/读取.
我的系统配置(Macbook pro)16GB RAM,2.5 GHz Intel Core i7.
总节点:120,000.(每个节点有5个属性.)
我每个节点有500个关系.
上面的节点/关系是我需要的其他应用程序部分工作所需的初始数据的一部分.
我使用Spring Data Neo4j进行读/写事务.每个节点按顺序构建其对应的500个关系.显然,构建所有上述节点和关系需要花费大量时间.
示例代码:
实体:
//Neo4j entity class
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
@NodeEntity
public class SamplePojo {
@GraphId
public Long id;
private String property1;
private String property2;
private Integer property3;
private Double property4;
private Integer property5;
@Relationship(type="has_sample_relationship",direction="OUTGOING")
List<SamplePojo> sampleList = new ArrayList<>();
//Getters and setters...
}
Run Code Online (Sandbox Code Playgroud)
库:
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;
@Repository
public interface SamplePojoRepository extends GraphRepository<SamplePojo> …
Run Code Online (Sandbox Code Playgroud)