In py2neo a Node is defined in following manner:
class Node(*labels, **properties)
Each node
has a label
and can have many properties
. In this case, Investor node can de defined by setting the label investor and properties of the node to be name and CIK.
investor_node = Node('investor', name = owner['name'], CIK = owner['CIK'])
Similarly, company node would look like:
company_node = Node('company', name = json['issuerName'], SIC = json['issuerSIC'])
Relationship are defined in following manner :
class Relationship(start_node, type, end_node, **properties)
In this case Relationship can be defined using:
investor_company_relationship = Relationship(investor_node, "is_director", company_node)
You can find one sample implementation of neo4j graph here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…