本文整理汇总了Python中py2neo.Graph.get_or_create方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.get_or_create方法的具体用法?Python Graph.get_or_create怎么用?Python Graph.get_or_create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Graph
的用法示例。
在下文中一共展示了Graph.get_or_create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: authenticate
# 需要导入模块: from py2neo import Graph [as 别名]
# 或者: from py2neo.Graph import get_or_create [as 别名]
neo_instance = "192.168.1.4:7474"
neo_username = "neo4j"
neo_password = "password"
authenticate(neo_instance,neo_username,neo_password)
neo = Graph("http://192.168.1.4:7474/db/data")
try:
neo.schema.create_uniqueness_constraint("Function", "name")
except:
pass
target = idaapi.get_root_filename()
for f in Functions():
callee_name = GetFunctionName(f)
callee = neo.merge_one("Function","name",callee_name)
if target not in callee.labels:
callee.labels.add(target)
callee.push()
for xref in XrefsTo(f):
caller_name = GetFunctionName(xref.frm)
if caller_name == '':
print "Indirect call to " + callee_name + " ignored."
continue
caller = neo.merge_one("Function","name",caller_name)
if target not in callee.labels:
callee.labels.add(target)
callee.push()
caller_callee = Relationship(caller, "CALLS", callee)
neo.get_or_create(caller_callee)
print "Export finished"