neo4j

Neo4j: Assign unique values to all nodes matching query

邮差的信 提交于 2019-12-06 21:48:37
I want to implement a unique ID property on all nodes in my database but need to apply it to existing data. I'm using Ruby to perform generate the IDS and then running the Cypher query from there. I want to avoid one query to find nodes missing the property, another to set the property on each node individually, since that would require total_nodes + 1 queries. Initially, I was thinking I could do something like this: MATCH (n:`#{label}`) WHERE NOT HAS(n.my_id) SET n.my_id = '#{gen_method}' RETURN DISTINCT(true) Of course, this wouldn't work because it would call gen_method once in Ruby and

How to set relationship type and label in LOAD CSV?

萝らか妹 提交于 2019-12-06 20:29:27
I have a database of existing nodes and would like to add in additional relationships from a CSV file which looks like this: stype,sname,sver,rel,dtype,dname,dver A,aname,1.1,FRIEND,A,bname,2.2 B,bbb,1.2,ENEMY,A,bname,2.2 My LOAD CSV looks like this. The intent is to match two existing nodes then link with the values in the CSV: LOAD CSV WITH HEADERS FROM "file:///c:/workspace/neo/demo.csv" as line MATCH (s:line.stype {name:line.sname,version:line.sver}), (d:line.dtype {name:line.dname,version:line.dver}) CREATE (s)-[:line.rel}]->(d) RETURN COUNT(*); Am getting this error when I try to set

Importing a large xml file to Neo4j with Py2neo

懵懂的女人 提交于 2019-12-06 18:58:31
I have a problem in importing a very big XML file with 36196662 lines. I am trying to create a Neo4j Graph Database of this XML file with Py2neo my xml file look like that: http://imgur.com/pLylHeG and My python code to import the xml data into Neo4j is like that: from xml.dom import minidom from py2neo import Graph, Node, Relationship, authenticate from py2neo.packages.httpstream import http http.socket_timeout = 9999 import codecs authenticate("localhost:7474", "neo4j", "******") graph = Graph("http://localhost:7474/db/data/") xml_file = codecs.open("User_profilesL2T1.xml","r", encoding=

In my tests, NE4J seems so slow compared to MySQL. How can I make it faster?

我是研究僧i 提交于 2019-12-06 18:04:45
问题 I am new to NEO4J and I wanted to see how fast it is. I started to test it and I created a table in both MySQL and NEO4J, with these properties (fields): id random_number time_stamp And I wrote a program to generate mass data and inserted about 150 million rows (and Nodes in Neo4J). I can say the write speed was almost same. So, I tested a select query in both databases. "I wanted to get one of the rows(nodes) with the random_id of 255454" (we know from this random id there are more than 30

py2neo 2.0: ERROR:httpstream:! SocketError: timed out

半世苍凉 提交于 2019-12-06 17:29:06
问题 I execute a long running (5 mintues) Cypher query with py2neo 2.0: graph.cypher.run(query) or result = graph.cypher.execute(query) The query fails after ~60 sec with a Socket Error from httpstream: ERROR:httpstream:! SocketError: timed out The same happens when I use a Cypher transaction. This did not happen with the same query and py2neo 1.6.4. Can I increase the time py2neo waits for a response? I didn't find anything in the docs. Update I found a hard coded socket_timeout in py2neo

How to get node's id with cypher request?

混江龙づ霸主 提交于 2019-12-06 17:02:47
问题 I'm using neo4j and making executing this query: MATCH (n:Person) RETURN n.name LIMIT 5 I'm getting the names but i need the ids too. Please help! 回答1: Since ID isn't a property, it's returned using the ID function. MATCH (n:Person) RETURN ID(n) LIMIT 5 回答2: Or you can take a look on the Neo4j Cypher Refcard You can get a short look to a lots of functions and patterns you can write. And more about functions on The Neo4j Developer Manual - Chapter 3. Cypher - 3.4. Functions 回答3: Not sure how

Neo4j and Php handle counter within transaction

本秂侑毒 提交于 2019-12-06 16:45:25
Well scenario is like this: I create a one node called counter node . Its initial value is 0 and incremented as user create its account on my website. So there are three operation happen to operate this: Read counter node value Do some logic in php . Here like +1 to previous value of counter node Write new value of counter node Now problem is, If two or more users are coming exactly same time and creating such a condition that Before first user write new value to counter node , it is being read by second user. Thus this will leave value of my 'counter node' in unstable condition. Hope you got

Upload files to Graphileon InterActor as node background

爱⌒轻易说出口 提交于 2019-12-06 16:12:13
I installed Graphileon InterActor using Docker on Windows. The Styling Documentation says that files can be uploaded using the following command in style menu: "image": "(%).properties.file", // image as node background When starting InterActor I follow this command: You can run the InterActor image using the following command, which will also create a volume "interactor" where persistent data (the config, and files you upload to InterActor) will be stored. And type in: $ docker run -t -d -p 8000:80 --name interactor -v interactor:/persistent/ graphileon/interactor-community

Neo4j Client, how to retrieve node by id?

旧城冷巷雨未停 提交于 2019-12-06 16:03:23
I am trying to figure out the way to retrieve node by id. MATCH (n) WHERE ID(n) = {id} RETURN n , is the Cypher I used with REST interface. Now using fluent syntax of Neo4j Client for .net I cannot find the function name in Neo4J.Cypher namespace, like for instance ALL. Anybody knows how to re-write that query in fluent syntax? client.Cypher .Match("(node:Employee)") .Where(node=>**?**(node)== 3) .Return(node) There is no ID function name in the codebase, so you have to go old skool I'm afraid - the code below still uses parameters... client.Cypher .Match("(node:Employee)") .Where("ID(n) =

How do I properly manage a neo4j-community-3.1.0 lucene legacy index? (really weird issues)

心不动则不痛 提交于 2019-12-06 16:02:07
I am having weird issues with Neo4j's legacy indexing, and got stuck today. I need full text support, as I wish to run a performance comparison against Solr (which uses Lucene full text) to see how the different data model compares. I have been following a few guides online, as well as various posts around here on stack. I had success up until yesterday, where all of a sudden I had corrupted index files, as range queries were returning invalid and inconsistent results. So I am trying to set in stone exactly the steps I need to take. I use the CSV bulk import tool to populate my database with