在py2neo中标记一个历史性的帖子

时间:2017-09-21 20:18:51

标签: neo4j py2neo

如果我使用selector.select按时间戳选择历史帖子&然后尝试与历史帖子创建一个新的标记关系,结果发现历史帖子实际上没有被标记!但是,在我的图表和图表中会出现一个灰色的圆圈,其中包含与历史帖子相同的信息。最终被标记而不是历史性的帖子...为什么是&更重要的是 - 我如何实际标记历史性帖子?

>>> import py2neo

>>> from py2neo import Graph, Node, Relationship

>>> from pandas import DataFrame

>>> graph = Graph(user='neo4j', password='notmypassword')

>>> t = Node("Tag", name="ANOTHER_TAG")

>>> graph.merge(t)     # put the Tag into the graph

>>> selected = selector.select("Post", timestamp=1505826314) 

>>> list(selected)

>>> [(deefe72:Post {date:"2017-09-19",id:"e0f08d21-afeb-49b7-b841-c6c366d11b62",text:"30 years in the building trade have injured my back & my joints",timestamp:1505826314,title:"building is bad for my back"})]

>>> rel=Relationship(t, "TAGGED", selected)

>>> graph.create(rel)

1 个答案:

答案 0 :(得分:0)

Gaaargghh !!!

selected = selector.select(" Post",timestamp = 1505826314).first()

而不是

selected = selector.select(" Post",timestamp = 1505826314)