利用python构建知识图谱,在创建关系时一直报错,内容如下
Traceback (most recent call last):
File "F:/pythonProject/Hot spot tracking.py", line 166, in <module>
handler.create_graphrels() # 建立实体关系边
File "F:/pythonProject/Hot spot tracking.py", line 109, in create_graphrels
self.create_relationship('author', 'article', rels_writer, 'first_author', '第一作者')
File "F:/pythonProject/Hot spot tracking.py", line 121, in create_relationship
set_edges.append('###'.join(edge))
TypeError: sequence item 0: expected str instance, list found
对应代码如下
```python
def create_graphrels(self):
author, article, year, direction, field, rels_writer, rels_publish, rels_prefer, rels_major = self.read_nodes()
self.create_relationship('author', 'article', rels_writer, 'first_author', '第一作者')
self.create_relationship('article', 'year', rels_publish, 'publish_time', '发表于')
self.create_relationship('article', 'direction', rels_prefer, 'art_direction', '研究方向')
self.create_relationship('article', 'field', rels_major, 'art_field', '研究领域')
求助一下大神们