py2neo

Is py2neo caching burning me?

与世无争的帅哥 提交于 2019-12-24 11:45:14
问题 I am running this code: c = """ match(r:XX) optional match(r)-[]-(m) with count(m) as mc, r match(x) return count(x) as all, r, mc """ (snip!) while(True): tx = remote_graph.cypher.begin() res = remote_graph.cypher.execute(c) tx.rollback() time.sleep(15) (snip!) I know for a fact the XX node's properties are changing every second - there a daemon running. However, when I run this, I always get the same values back in res but for r only - all is changing. The query isn't changing. I wonder if

SocketError: Connection refused using py2neo to a remote server

雨燕双飞 提交于 2019-12-24 11:37:55
问题 While this issue has been addressed a couple of times in the past at SO and I tried all the suggestions, the problem still remains and I am hoping someone would shine a light on this. My company set up a neo4j (v2.1.6) graph database at a remote ubuntu server. In order to modify and update data into the server, I am using a python package, py2neo. The server's endpoint address is http://fake-address.com/db/data and the authentication Id/password are 'fakeId' and 'fakePassWord'. In order to

py2neo - How can I use merge_one function along with multiple attributes for my node?

若如初见. 提交于 2019-12-24 03:53:10
问题 I have overcome the problem of avoiding the creation of duplicate nodes on my DB with the use of merge_one functions which works like that: t=graph.merge_one("User","ID","someID") which creates the node with unique ID. My problem is that I can't find a way to add multiple attributes/properties to my node along with the ID which is added automatically (date for example). I have managed to achieve this the old "duplicate" way but it doesn't work now since merge_one can't accept more arguments!

py2neo - How can I use merge_one function along with multiple attributes for my node?

柔情痞子 提交于 2019-12-24 03:53:01
问题 I have overcome the problem of avoiding the creation of duplicate nodes on my DB with the use of merge_one functions which works like that: t=graph.merge_one("User","ID","someID") which creates the node with unique ID. My problem is that I can't find a way to add multiple attributes/properties to my node along with the ID which is added automatically (date for example). I have managed to achieve this the old "duplicate" way but it doesn't work now since merge_one can't accept more arguments!

Working with indexes in neo4j and py2neo

回眸只為那壹抹淺笑 提交于 2019-12-23 20:21:22
问题 I have just started working with py2neo and neo4j. I am confused about how to go about using indices in my database. I have created a create_user function: g = neo4j.GraphDatabaseService() users_index = g.get_or_create_index(neo4j.Node, "Users") def create_user(name, username, **kwargs): batch = neo4j.WriteBatch(g) user = batch.create(node({"name" : name, "username" : username})) for key, value in kwargs.iteritems(): batch.set_property(user, key, value) batch.add_labels(user, "User") batch

py2neo raised finished(self) error

妖精的绣舞 提交于 2019-12-23 19:09:44
问题 Working with py2neo and I'm getting the error below when trying to append a transaction: statement ="MERGE (a:Person {name:\""+actorName+"\"}) "\ "\n"\ "MERGE (b:Series {title:\""+actorsFields[3]+"\", year:\""+actorsFields[5]+"\"}) "\ "\n"\ "CREATE UNIQUE (a)-[:ACTED_IN]->(b)"\ "RETURN a,b" print(statement) tx.append(statement) The traceback is: Traceback (most recent call last): File "/Volumes/PyCharm CE/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 2222, in <module> globals =

Importing a large xml file to Neo4j with Py2neo

岁酱吖の 提交于 2019-12-23 02:45:16
问题 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 =

Modify or change relationship properties in py2neo

只愿长相守 提交于 2019-12-23 02:36:30
问题 Is there a way to change a relationship property once it has been set using py2neo or cypher? I'm creating an inventory tracker and once an item is "CHECKED_OUT" a property called "status" in the relationship is set to "True". Ideally, once the item is returned or checked in, I'd like to change the "status" property to "False". This way I can keep track of the item and prevent it from being checked out twice. Here is my code for creating the relationship for a checkout transaction: def check

Check whether nodes exist in a neo4j graph

戏子无情 提交于 2019-12-22 13:32:33
问题 NOTE I let this become several questions instead of the simple one I asked, so I am breaking the follow-ups off into their own question here. ORIGINAL QUESTION I'm receiving a list of IDs that I am first testing whether any of them are in my graph, and if they /are/ I am processing those nodes further. So, for example... fids = get_fids(record) # [100001, 100002, 100003, ... etc] ids_in_my_graph = filter(id_is_in_graph, fids) # [100002] def id_is_in_graph(id): val = False query = """MATCH

Check whether nodes exist in a neo4j graph

♀尐吖头ヾ 提交于 2019-12-22 13:31:31
问题 NOTE I let this become several questions instead of the simple one I asked, so I am breaking the follow-ups off into their own question here. ORIGINAL QUESTION I'm receiving a list of IDs that I am first testing whether any of them are in my graph, and if they /are/ I am processing those nodes further. So, for example... fids = get_fids(record) # [100001, 100002, 100003, ... etc] ids_in_my_graph = filter(id_is_in_graph, fids) # [100002] def id_is_in_graph(id): val = False query = """MATCH