2017-03-12 111 views
0

我py2neo版本3.1.2安装在python 3.5上,当我运行下面的代码时,我收到关于Graph.find_one的弃用警告,并被告知使用NodeSelector。 v3 Documentation未提及此折旧。当我在下面的代码中使用NodeSelector方法时,最终会有许多重复的日历节点链接到单个事件节点。如何更新我的代码以防止此警告?py2neo Graph.find_one()弃用警告?

我的图表上已经有许多日历节点。我希望通过这本词典并将它们追加到图表并将它们与相应的日历节点相关联。

for k,v in calendar_dict.items(): 
    calendar = graph.find_one("Calendar", property_key='url', property_value=v[2]) 
    calendar_event = Node("CalendarEvent", event=k, date=str(v[0])) 
    graph.create(calendar_event) 
    calendar_rel = Relationship(calendar_event, "POSTED_ON", calendar, 
           scrape_date=str(datetime.date.today())) 
    graph.create(calendar_rel) 

警告

/home/mcamp/anaconda3/envs/py3.5/lib/python3.5/site-packages/ipykernel/__main__.py:2: DeprecationWarning: Graph.find_one is deprecated, use NodeSelector instead 
    from ipykernel import kernelapp as app 

回答