I produce the following node and relationship data in a for loop about 1 million times. The idea is that investor nodes connect to company nodes by relationship edges:
investor = {'name': owner['name'],
'CIK': owner['CIK']}
relationship = {'isDirector': owner['isDirector'],
'isOfficer': owner['isOfficer'],
'isOther': owner['isOther'],
'isTenPercentOwner': owner['isTenPercentOwner'],
'title': owner['title']}
company = {'Name': json['issuerName'],
'SIC': json['issuerSIC'],
'Ticker Symbol': json['issuerTradingSymbol'],
'CIK': json['issuerCIK'],
'EIN': json['issuerEIN']}
How do I complete the following code to get the dicts above into neo4j community edition?
from py2neo import Graph, authenticate
authenticate("localhost:7474", "neo4j", "neo")
graph = Graph()
for json in long_list_of_dicts:
investor = {...}
company = {...}
relationship = {...}
# Code to import investor, company, relationship data into neo4j
In py2neo a Node is defined in following manner:
class Node(*labels, **properties)Each
nodehas alabeland can have manyproperties. In this case, Investor node can de defined by setting the label investor and properties of the node to be name and CIK.Similarly, company node would look like:
Relationship are defined in following manner :
class Relationship(start_node, type, end_node, **properties)In this case Relationship can be defined using:
You can find one sample implementation of neo4j graph here.