neo4j

How to run tests against Neo4j with custom unmanaged extension?

╄→гoц情女王★ 提交于 2019-12-10 21:11:26
问题 I have my own custom-written unmanaged extension for Neo4j database. I want to run integration tests againt fully-functional database, with unmanaged extension available there. 回答1: Neo4j provides tool called neo4j-harness that makes it easier to write integration tests for unmanged extensions. More iformation is available here. Blog post 1) Determine Neo4j version that is needed (used). Maven: <properties> <version.neo4j>2.2.5</version.neo4j> </properties> 2) Add dependency for neo4j-harness

update relationship property if previous relationship exists in NEO4J

拟墨画扇 提交于 2019-12-10 21:07:14
问题 I want to construct a query in cypher that does the following: create a relationship between 2 nodes with a property containing a time duration if no relationship exists already if a relationship is already present, update the time duration property to be the shortest duration of the two relationships The compare and update part is something that I am not able to achieve in cypher. So any assistence on this part is greatly appreciated. 回答1: You need combine MERGE ON CREATE | ON MATCH and CASE

Order by relationship properties neo4j

本小妞迷上赌 提交于 2019-12-10 20:54:29
问题 Using Neo4j 1.9.3 - I want to create a music program listing. On a given program there may be three pieces being performed. Each piece has a composer associated with them, and may appear on many different programs, so I can't put sequence numbers on the piece nodes. I assume I can create the program, with relationships to each piece like so: (program1)-[:PROGRAM_PIECE {program_seq: 1}]->(piece1) (program1)-[:PROGRAM_PIECE {program_seq: 2}]->(piece2) (program1)-[:PROGRAM_PIECE {program_seq: 3}

SyntaxException with Neo4j LOAD command

这一生的挚爱 提交于 2019-12-10 20:42:41
问题 I'm using neo4j 2.1.2 for windows I was attempting to use Neo4j's load csv command but I get the following error... neo4j-sh (?)$ load csv with headers "file:../test/unclaimed.csv" AS csvLine MERGE (o:Original_Transaction_Number { value: csvLine.OTN }) MERGE (i:Institution {name: csvLine.Institution }) MERGE (i)<-[:TRANSACTION_OF]-(o) ; SyntaxException: Invalid input 'l': expected <init> (line 1, column 1) "load csv with headers "file:../test/unclaimed.csv" AS csvLine" ^ infact I get the same

NotSerializableException org.neo4j.kernel.EmbeddedGraphDatabase

泄露秘密 提交于 2019-12-10 20:36:15
问题 I am working with neo4j to create graph, taking data from mongodb as document. Standalone code is working fine without storm. But while integrating it with storm, I am getting - java.io.NotSerializableException: org.neo4j.kernel.EmbeddedGraphDatabase exception. Dont know the exact reason why i am getting this. If anybody faced such issue please let me know how to resolve it. 回答1: Because you are trying to pass an object to the serializer that does not implement Serializable interface. 回答2:

Deleting old relationships and create new ones with the same label in the same query

自古美人都是妖i 提交于 2019-12-10 20:17:13
问题 Let's suppose Person and Car nodes. I want in the same cypher query to delete all relationships APerson-[:OWNS]-SomeCar and inserts new ones. Basically I had tried this query: MATCH (p:Person {_id: {personId}}) WITH p MATCH (c:Car) WITH p, c MATCH p-[r:OWNS]->c DELETE r //deleting all "old" relationships WITH c //a with is expected here by cypher syntax => dummy value that shouldn't impact the remaining of the query MATCH (p:Person {_id: {personId}}), (c:Car) WHERE c._id IN {cars} WITH p, c

Inserting large graph data into Neo4j using py2neo WriteBatch

你离开我真会死。 提交于 2019-12-10 19:59:28
问题 I have a graph represented by the following files: VertexLabel.txt -> each line contains properties for each vertex. EdgeLabel.txt -> each line contains properties for each edge. EdgeID.txt -> each line contains 3 separated integers which correspond to indexes in the label files: source_index target_index edge_index. There are roughly 44K vertices with 240K edges. I'm trying to use neo4j.Writebatch to batch insert the graph data. from py2neo import Graph, neo4j, node, rel graph_db = Graph()

Set up In-Memory database instance of Neo4j

你离开我真会死。 提交于 2019-12-10 19:32:22
问题 I'd like to run neo4j 2.3 completely in-memory as a standalone executable with a configurable port for test suites. My project's test suites are written in another language (NOT Java!) , and will communicate with neo via the HTTP API. Here is what I've discovered so far: The files in the standard build conf/ directory don't seem to have a way to configure this. There is a class CommunityServerBuilder that a public build method that returns a TestCommunityNeoServer server that is pre

Selective indexing in bulbflow without using Models

本小妞迷上赌 提交于 2019-12-10 19:16:50
问题 I'm using bulbflow (python) with Neo4j and I'm trying to add an index only on a subset of my keys (for now, simply keys named 'name' for optional index-based lookup). I don't love the bulbflow Models (too restrictive) and I couldn't figure out how to do selective indexing without changing code since the 'autoindex' is a global setting -- I don't see how to configure it based on the key. Has anyone done something like this? -Andrew 回答1: You can disable Bulbs auto-indexing by setting g.config

Is it better to make one MERGE request for multiple nodes / edges creation in Neo4J Cypher 2.0 or to split it into transactions?

旧城冷巷雨未停 提交于 2019-12-10 19:09:58
问题 I have a long Cypher query (the new Neo4J 2.0 version), which creates multiple nodes and connections using the MERGE command. The question is: do you think I'm better off splitting it into different parts and submitting it as a transaction (for robustness) or should I keep the long single one (for speed)? Here's the query: MATCH (u:User {name: "User"}) MERGE (tag1:Hashtag {name:"tag1"}) MERGE (tag2:Hashtag {name:"tag2"}) MERGE (tag3:Hashtag {name:"tag3"}) MERGE (tag4:Hashtag {name:"tag4"})