我正在尝试运行代码:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="#">
<p><strong>Action 1</strong></p> Some Text</a>
</li>
<hr/>
<li>
<a href="#">
<p><strong>Action 2</strong></p> Some Text</a>
</li>
<li>
<a href="#">
<p><strong>Action 3</strong></p> Some Text</a>
</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<br/><br/><br/><br/>
Sample Content
</div>
<!-- /container -->
然而我收到错误消息:
from py2neo import Graph
graph = Graph(config['DATABASE']['ENDPOINT'])
graph.data("MATCH (u:Users) return u.id, u.email LIMIT 4")
这与py2neo网站上提供的格式完全相同
AttributeError: 'Graph' object has no attribute 'data'
有关错误消息的任何想法? 感谢
答案 0 :(得分:2)
我想你不在py2neo的第3版,尝试升级:
pip install py2neo --upgrade
这个简单的脚本工作正常:
from py2neo import Graph
graph = Graph(host="localhost")
d = graph.data("MATCH (t:TwitterAccount) RETURN t.user_screen_name LIMIT 4")
print(d)
-
ikwattro@graphaware ~/dev> python test.py
[{u't.user_screen_name': u'meichsnerbros'}, {u't.user_screen_name': u'renato_umeton'}, {u't.user_screen_name': u'kdnuggets'}, {u't.user_screen_name': u'sabrinaDijkhuiz'}]
ikwattro@graphaware ~/dev>
答案 1 :(得分:1)
Graph.data
。如果你没有,那就不可用了。
答案 2 :(得分:1)
在最新版本的py2neo(版本:4.3.0)中,此方法有效:
graph.run("MATCH (n:Document) RETURN n.title LIMIT 5").data()
更多信息可以在这里找到:https://py2neo.org/v4/database.html#the-graph