mgeide / poortego

Open-source python project to handle the storage and linking of open-source intelligence (ala Maltego)
MIT License
117 stars 32 forks source link

py2neo compatibility #5

Open pcexhaust opened 7 years ago

pcexhaust commented 7 years ago

I understand this might be a dead project... anyhow I think the imports and related for py2neo in neo4j_database.py no longer work because they have been deprecated. See https://neo4j.com/blog/py2neo-2-0-unleashed/ (Nov 2014)

e.g. I think from py2neo import neo4j, node, rel

should now be from py2neo import Graph, Node, Relationship

e.g.

Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from py2neo import neo4j, node, rel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name neo4j
>>> from py2neo import Graph, Node, Relationship
>>>

But then there are more issues like "get_or_create_index" which doesn't seem to exist anymore...

  File "/home/user/poortego-master/poortego/data_management/neo4j/neo4j_database.py", line 24, in set_database_defaults
    self.indexes.append( self.db_conn.get_or_create_index(neo4j.Node, "NameIdx") )
AttributeError: 'Graph' object has no attribute 'get_or_create_index'

Tested with py2neo 3.1.2 and neo4j community 3.1.0

JamesClarke7283 commented 2 years ago

Thank you for this, this will make my job easier.