neo4j

How to import relationships between nodes of the same label from a csv file in neo4j?

眉间皱痕 提交于 2019-12-11 12:17:05
问题 I have two separate csv files that I need to import into my neo4j database. The first file contains all the nodes that I wish to import. The information is classified as follows: id, Name 1, Earth science To import it, I successfully used the following code: LOAD CSV WITH HEADERS FROM 'file:///Node_test.csv' AS line CREATE (:Discipline { id: toInt(line.id), name: line.Name}) Now, I want to import my relationship file and create all the relationship between the nodes I just imported. The

How to CRUD @RelationshipEntity in SDN 4.0

爷,独闯天下 提交于 2019-12-11 12:16:09
问题 If I have a rich relationship entity, for example @NodeEntity public class Actor { Long id; private Role playedIn; } @RelationshipEntity(type="PLAYED_IN") public class Role { @GraphId private Long relationshipId; @Property private String title; @StartNode private Actor actor; @EndNode private Movie movie; } @NodeEntity public class Movie { private Long id; private String title; } To CRUD both @NodeEntity , just simply create a @Repository each, for example @Repository public interface

neo4j Auto indexing for a REST Server

隐身守侯 提交于 2019-12-11 12:09:56
问题 Im trying to use auto indexing with the neo4j REST server (Community - 1.4.M04). This is in a Rails project, so im using the neography wrapper. I couldnt find a consolidated tutorial online, from what i could follow from multiple blogs, here is what i did: In conf/neo4j.properties: node_keys_indexable=title,bucket_type node_auto_indexing=true relationship_auto_indexing=true After that, using a rails console: neo = Neography::Rest.new neo.create_node_index("node_auto_index", "fulltext",

Neo4j jexp/batch-import weird error: java.lang.NumberFormatException

与世无争的帅哥 提交于 2019-12-11 12:07:30
问题 I'm trying to import around 6M nodes using Michael Hunger's batch importer but I'm getting this weird error: java.lang.NumberFormatException: For input string: "78rftark42lp5f8nadc63l62r3" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) It is weird because 78rftark42lp5f8nadc63l62r3 is the very first value of the big CSV file that I'm trying to import and its datatype is set to string. These are the first three lines of that file: name:string:sessions labels

use spring-data-neo4j in grails get UnsatisfiedDependencyException

拟墨画扇 提交于 2019-12-11 12:07:12
问题 i want to use spring-data-neo4j in my grails application. i've added the compile 'org.springframework.data:spring-data-neo4j:3.1.1.RELEASE' dependency in BuildConfig. After adding <neo4j:config storeDirectory="data/graph.db" /> to the applicationContext.xml i get following exception at application start: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Unsatisfied dependency expressed

What should I do to setup a new Gremlin version for Neo4j?

[亡魂溺海] 提交于 2019-12-11 11:54:34
问题 I am using Neo4j - Graph Database Kernel 1.8 It uses this gremlin version: gremlin> Gremlin.version() ==> 1.5 which is very old version. I want to upgrade to gremlin 2.0 or 2.1 from the github project, since I can't run this command on gremlin 1.5 : gremlin> g.v(1).outE.has("weight", T.gte, 0.5f).weight ==> No such property: T for class: groovysh_evaluate My question is what should I do, so I won't mess up all the entire environment of neo4j . 回答1: You can run: import com.tinkerpop.gremlin

Nearest nodes to a give node, assigning dynamically weight to relationship types

青春壹個敷衍的年華 提交于 2019-12-11 11:43:13
问题 I need to find the N nodes "nearest" to a given node in a graph, meaning the ones with least combined weight of relationships along the path from given node. Is is possible to do so with a pure Cypher only solution? I was looking about path functions but couldn't find a viable way to express my query. Moreover, is it possible to assign a default weight to a relationship at query time, according to its type/label (or somehow else map the relationship type to the weight)? The idea is to

how to traverse first neighbors and their relationships

岁酱吖の 提交于 2019-12-11 11:38:11
问题 I guess this can be trivially achieved but can't figure it out. Is it possible to achieve the following in one traversal (Neo4j 1.9RC2): starting from a node, include all its first neighbors (depth 1) and include all links between it's neighbors (if any). The direction is irrelevant. Here's a test scenario: +-+ +-+ +-+ |7+----->5| |4+------+ +++ +-+-----------------+-+ | | | | | | | +--+ | | | +------|1 |-------+ | ++> +-++ +-+ +-+ |8| | |2+-----|6| +-+ +----------------+++ +-+ | | +-+ |3| +-

SDN 4 + OGM 1.1.1 @Index(unique = true) is not working

核能气质少年 提交于 2019-12-11 11:28:02
问题 I know this question has been asked before, but looks like not with SDN 4 and OGM 1.1.1 Here is my code on the @NodeEntity @NodeEntity public class Company { @GraphId private Long id; @Index(unique = true) private String name; private String description; Here is the repo @Repository public interface CompanyRepository extends GraphRepository<Company> { Company findByName(String name); and I have a unit test class with methods @Autowired private CompanyRepository companyRepository; @Before

Creating Neo4j Relationships in java

送分小仙女□ 提交于 2019-12-11 11:22:41
问题 I am creating unique neo4j relationships in java class based on no. of column values in database. Value of column "Interface_Name" will be assigned to each relationship.My Code : while (rs.next()){ String rel = rs.getString("Interface_Name"); GraphDatabaseService graphDb = new EmbeddedGraphDatabase("D://My Graph"); Transaction tx = graphDb.beginTx(); try { RelationshipType rel = DynamicRelationshipType.withName(rel); **//Gives error since rel is string** ..... tx.success(); } } How can i