实体分析

诗名实体

属性

包含:作诗时间,诗名,内容,翻译,背景。

关系

实体1 关系 实体2
诗名 形式 诗词形式
诗名 作者 诗人
诗名 分类 类别
诗名 词牌名 词牌名
诗名 曲牌名 曲牌名
诗名 朝代 朝代

诗人实体

属性

包含:出生时间,头像链接,去世时间,诗词数量,字,号,名字,简介。

关系

实体1 关系 实体2
诗人 好友 诗人
诗人 合称 诗人合称
诗人 轨迹 地点
诗人 写作 诗名
诗人 朝代 朝代

朝代实体

属性

包含:朝代名称(唐宋元明清)

关系

实体1 关系 实体2
朝代 包含 诗人
朝代 包含 诗名

类别实体

属性

包含:类别名称(写景,抒怀,。。。)

关系

实体1 关系 实体2
类别 包含 诗名

诗词形式实体

属性

包含:诗词形式名称(五言律诗,五言绝句,五言,七言律诗,七言绝句,七言)

关系

实体1 关系 实体2
诗词形式 包含 诗名

词牌名实体

属性

包含:词牌名名称

关系

实体1 关系 实体2
词牌名 包含 诗名

曲牌名实体

属性

包含:曲牌名名称

关系

实体1 关系 实体2
曲牌名 包含 诗名

诗人合称实体

属性

诗人合称名称

关系

实体1 关系 实体2
诗人合称 包含 诗人

地点实体

属性

包含:古代地点名称,经纬度,现今名称

事件实体

属性

包含:时间,事件名称,地点

诗句实体与关键字实体

属性

数据内容,关键字内容

关系

实体1 关系 实体2
诗句 关键字
诗句 诗句

实体构建

构建顺序

构建的原则:

先构建单个实体,不易发生多种关系的单个实体。

例如:类别,诗词形式,词牌名,曲牌名,朝代,诗人合称,轨迹,事件

多关系实体:诗人,诗名

类别实体构建

create_tag.py

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_tag():
file = './data2/tag_name.xlsx'
data = pd.read_excel(file).fillna("无")
tag=list(data.tag)
tag_label="tag"
for it in tag:
attr1={"name":it}
CreateNode(graph, tag_label, attr1)
print("创建诗词分类:"+it+"成功!!") if __name__ == '__main__':
create_tag()

展示

诗词形式实体构建

create_formal.py

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_formal():
formal=['七言','五言','七言律诗','七言绝句','五言律诗','五言绝句']
formal_label="formal"
for it in formal:
attr1={"name":it}
CreateNode(graph, formal_label, attr1)
print("创建诗词形式:"+it+"成功!!") if __name__ == '__main__':
create_formal()

展示

词牌名与曲牌名实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_pai_name():
file = './data2/cipai_name.xlsx'
data = pd.read_excel(file).fillna("无")
title=list(data.title)
cipai_label="ci_pai"
for it in title:
attr1={"name":it}
CreateNode(graph, cipai_label, attr1)
print("创建词牌名"+it+"成功!!") file2 = './data2/qupai_name.xlsx'
data2 = pd.read_excel(file2).fillna("无")
title2 = list(data2.qu_name)
qupai_label = "qu_pai"
for it in title2:
attr1 = {"name": it}
CreateNode(graph, qupai_label, attr1)
print("创建曲牌名" + it + "成功!!") if __name__ == '__main__':
create_pai_name()

展示

飞花令关键字实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_word():
file = './data2/word.xlsx'
data = pd.read_excel(file).fillna("无")
word=list(data.word)
word_label="word"
for it in word:
attr1={"name":it}
CreateNode(graph, word_label, attr1)
print("创建飞花令:"+it+"成功!!") if __name__ == '__main__':
create_word()

展示

诗句实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
#根绝节点name属性,查找节点
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') #获取指定文件夹下的excel
import os
def get_filename(path,filetype): # 输入路径、文件类型例如'.xlsx'
name = []
for root,dirs,files in os.walk(path):
for i in files:
if os.path.splitext(i)[1]==filetype:
name.append(i)
return name # 输出由有后缀的文件名组成的列表 def create_sentence():
file = 'sentences/'
lists = get_filename(file, '.xlsx')
for it in lists:
newfile = file + it
print(newfile) # 获取诗词内容
data = pd.read_excel(newfile).fillna("无") sentens = list(data.sentens)
author = list(data.author)
title = list(data.title)
keys = list(data.word) sentence_label='sentence'
word_label='word'
if len(sentens)>50000:
lenth=50000
else:
lenth=len(sentens)
for i in range(lenth):
print("第" + str(i) + "个")
attr1 = {"name": sentens[i], "author": author[i], "title": title[i]}
CreateNode(graph, sentence_label, attr1)
print("创建诗句:" + sentens[i] + "成功!!")
word_list=keys[i].split(',')
for it in word_list:
attr2 = {"name": it}
# 创建关系
m_r_name1 = "关键字"
reValue1 = CreateRelationship(graph, sentence_label, attr1, word_label, attr2, m_r_name1)
print("创建关系:" + sentens[i] + "-关键字-" + it + "成功")
m_r_name2 = "诗句"
reValue2 = CreateRelationship(graph, word_label, attr2, sentence_label, attr1, m_r_name2)
print("创建关系:" + it + "-诗句-" + sentens[i] + "成功") if __name__ == '__main__':
create_sentence()

展示

诗人与朝代实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_author():
file='./data2/author.xlsx'
data=pd.read_excel(file).fillna("无")
author=list(data.author)
produce=list(data.produce)
num=list(data.num)
src=list(data.src)
desty=list(data.desty)
bg_time=list(data.begin_time)
ed_time=list(data.end_time)
zi_list=list(data.zi)
hao_list=list(data.hao)
author_label='author'
desty_label='desty'
for i in range(len(author)):
print("第"+str(i)+"个")
attr1 = {"name": author[i], "produce": produce[i], "num": num[i],
"src": src[i],"bg_time":bg_time[i],"ed_time":ed_time[i],"zi":zi_list[i],"hao":hao_list[i]}
CreateNode(graph, author_label, attr1)
print("创建诗人:" + author[i] + "成功!!")
attr2={"name":desty[i]}
if MatchNode(graph,desty_label,attr2)==None:
CreateNode(graph,desty_label,attr2)
print("创建朝代:"+desty[i]+"成功!!")
#创建关系
m_r_name1 = "朝代"
reValue1 = CreateRelationship(graph, author_label, attr1, desty_label, attr2, m_r_name1)
print("创建关系:"+author[i]+"-所属朝代-"+desty[i]+"成功")
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph,desty_label, attr2, author_label, attr1, m_r_name2)
print("创建关系:" + desty[i] + "-包含-" + author[i] + "成功") if __name__ == '__main__':
create_author()

展示

诗人好友关系构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
#根绝节点name属性,查找节点
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_friend():
file = 'data2/friend_ming.xlsx' # 获取诗词内容
data = pd.read_excel(file).fillna("无") author=list(data.author)
friend=list(data.friend) author_label='author' for i in range(len(author)):
print("第" + str(i) + "个")
attr1 = {"name": author[i]}
if MatchNode(graph, author_label, attr1) != None:
friend_list=friend[i].split(',')
for it in friend_list:
attr2 = {"name": it}
if MatchNode(graph, author_label, attr2) != None and it!=author[i]:
# 创建关系
m_r_name1 = "好友"
reValue1 = CreateRelationship(graph, author_label, attr1, author_label, attr2, m_r_name1)
print("创建关系:" + author[i] + "-好友-" + it + "成功")
m_r_name2 = "好友"
reValue2 = CreateRelationship(graph, author_label, attr2, author_label, attr1, m_r_name2)
print("创建关系:" + it + "-好友-" + author[i] + "成功") if __name__ == '__main__':
create_friend()

展示

诗人合称实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') def create_common_name():
file = './data2/common_name.xlsx'
data = pd.read_excel(file).fillna("无")
hc=list(data.hc)
author=list(data.author)
common_name_label="common_name"
author_label="author"
for i in range(len(hc)):
common_name=hc[i]
authors=author[i].split(',')
attr1={"name":common_name}
CreateNode(graph, common_name_label, attr1)
print("创建合称:"+common_name+"成功!!") for it in authors:
attr2={"name":it}
# 创建关系
m_r_name1 = "合称"
reValue1 = CreateRelationship(graph, author_label, attr2, common_name_label, attr1, m_r_name1)
print("创建关系:" + it + "-合称-" + common_name + "成功") # 创建关系
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph,common_name_label, attr1, author_label, attr2, m_r_name2)
print("创建关系:" + common_name + "-包含-" + it+ "成功") if __name__ == '__main__':
create_common_name()

展示

诗人事迹实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
#根绝节点name属性,查找节点
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') #获取指定文件夹下的excel
import os
def get_filename(path,filetype): # 输入路径、文件类型例如'.xlsx'
name = []
for root,dirs,files in os.walk(path):
for i in files:
if os.path.splitext(i)[1]==filetype:
name.append(i)
return name # 输出由有后缀的文件名组成的列表 def read_real_where_name():
file='data2/gu_jin_lng_lat.xlsx'
data=pd.read_excel(file)
gu_name=list(data.gu_name)
return gu_name def read_where(author,file,gu_name):
data=pd.read_excel(file)
date=list(data.data)
where_name=list(data.wheres)
things=list(data.things)
for i in range(len(date)):
#处理地区,满足我们需要的地区条件
where_list=where_name[i].split(',')
for it in where_list:
if it in gu_name and it!='无':
attr1={"name":things[i],"date":date[i],"where_name":where_name[i]}
CreateNode(graph, things_label, attr1)
print("创建事件:" + things[i] + "-成功!!") attr2 = {"name": author}
# 创建关系
m_r_name1 = "事迹"
reValue1 = CreateRelationship(graph, author_label, attr2, things_label, attr1, m_r_name1)
print("创建关系:" + author + "-事迹-" + things[i] + "-成功")
break if __name__ == '__main__':
file = 'author/'
lists = get_filename(file, '.xlsx')
gu_name = read_real_where_name()
author_label='author'
things_label='things'
for it in lists:
newfile = file + it
print(newfile)
author = it.split('.')[0]
print(author)
read_where(author,newfile,gu_name)

展示

诗人轨迹地点实体构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
#根绝节点name属性,查找节点
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') #获取指定文件夹下的excel
import os
def get_filename(path,filetype): # 输入路径、文件类型例如'.xlsx'
name = []
for root,dirs,files in os.walk(path):
for i in files:
if os.path.splitext(i)[1]==filetype:
name.append(i)
return name # 输出由有后缀的文件名组成的列表 def read_real_where_name():
file='data2/gu_jin_lng_lat.xlsx'
data=pd.read_excel(file)
gu_name=list(data.gu_name)
return gu_name def read_gu_dict():
file = 'data2/gu_jin_lng_lat.xlsx'
data = pd.read_excel(file)
gu_name = list(data.gu_name)
jin_name=list(data.jin_name)
lng=list(data.lng)
lat=list(data.lat)
gu_dict={}
for i in range(len(gu_name)):
gu=gu_name[i]
gu_dict[gu]={"jin_name":jin_name[i],"lng":lng[i],"lat":lat[i]}
return gu_dict def read_where(author,file,gu_name):
data=pd.read_excel(file)
wheres=data.wheres
real_where=[]
for i in range(len(wheres)):
where_name=wheres[i]
where_list=where_name.split(',')
for it in where_list:
if it in gu_name and it!='无':
real_where.append(it)
real_where=list(set(real_where))
if len(real_where)!=0:
for it in real_where:
jin=gu_dict[it]['jin_name']
lat=gu_dict[it]['lat']
lng=gu_dict[it]['lng']
attr1 = {"name":it,"jin_name": jin,"lng":lng,"lat":lat}
CreateNode(graph, where_name_label, attr1)
print("创建地点:" + it + "成功!!") attr2 = {"name": author}
# 创建关系
m_r_name1 = "轨迹"
reValue1 = CreateRelationship(graph, author_label, attr2, where_name_label, attr1, m_r_name1)
print("创建关系:" + author + "-轨迹-" + it + "成功") if __name__ == '__main__':
file = 'author/'
lists = get_filename(file, '.xlsx')
gu_name = read_real_where_name()
gu_dict = read_gu_dict()
author_label='author'
where_name_label='where_name'
for it in lists:
newfile = file + it
print(newfile)
author = it.split('.')[0]
read_where(author,newfile, gu_name)

展示

诗词实体关系构建

import pandas as pd
import numpy as np
import re
from py2neo import Node,Relationship,Graph,NodeMatcher,RelationshipMatcher # 创建节点
def CreateNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
#print(re_value)
if re_value is None:
m_mode = Node(m_label,**m_attrs)
n = graph.create(m_mode)
return n
return None
# 查询节点
def MatchNode(m_graph,m_label,m_attrs):
m_n="_.name="+"\'"+m_attrs['name']+"\'"
matcher = NodeMatcher(m_graph)
re_value = matcher.match(m_label).where(m_n).first()
return re_value
# 创建关系
def CreateRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph,m_label1,m_attrs1)
reValue2 = MatchNode(m_graph,m_label2,m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1,m_r_name,reValue2)
n = graph.create(m_r)
return n #查找关系
def findRelationship(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
m_r = Relationship(reValue1, m_r_name['name'], reValue2)
return m_r def updateRelation(m_graph,m_label1,m_attrs1,m_label2,m_attrs2,m_r_name):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
reValue2 = MatchNode(m_graph, m_label2, m_attrs2)
if reValue1 is None or reValue2 is None:
return False
print(m_r_name)
propertyes={'value': m_r_name['value'], 'danwei': m_r_name['danwei']}
m_r = Relationship(reValue1, m_r_name['name'], reValue2,**propertyes)
graph.merge(m_r) #修改节点属性
def updateNode(m_graph,m_label1,m_attrs1,new_attrs):
reValue1 = MatchNode(m_graph, m_label1, m_attrs1)
if reValue1 is None:
return False
reValue1.update(new_attrs)
graph.push(reValue1) graph = Graph('http://localhost:7474',username='neo4j',password='fengge666') #获取指定文件夹下的excel
import os
def get_filename(path,filetype): # 输入路径、文件类型例如'.xlsx'
name = []
for root,dirs,files in os.walk(path):
for i in files:
if os.path.splitext(i)[1]==filetype:
name.append(i)
return name # 输出由有后缀的文件名组成的列表 def create_poem():
file = 'data/'
lists = get_filename(file, '.xlsx')
for it in lists:
newfile = file + it
print(newfile)
# 获取诗词内容
data = pd.read_excel(newfile).fillna("无") title=list(data.title)
desty=list(data.desty)
author=list(data.author)
content=list(data.content)
trans_content=list(data.trans_content)
background=list(data.background)
tag=list(data.tag)
formal=list(data.formal)
date=list(data.data)
ci_name=list(data.ci_name)
qu_name=list(data.qu_name) poem_label='poem'
author_label='author'
desty_label='desty'
formal_label='formal'
tag_label='tag'
cipai_label='ci_pai'
qupai_label='qu_pai' for i in range(len(title)):
print("第"+str(i)+"个")
attr1 = {"name": title[i], "content": content[i], "trans_content": trans_content[i],
"background": background[i],"date":date[i]}
CreateNode(graph, poem_label, attr1)
print("创建诗词:" + title[i] + "成功!!")
if tag[i]!='无':
tag_list=tag[i].split(',')
for it in tag_list:
attr2={"name":it}
# 创建关系
m_r_name1 = "分类"
reValue1 = CreateRelationship(graph, poem_label, attr1, tag_label, attr2, m_r_name1)
print("创建关系:" + title[i] + "-所属类别-" + it + "成功")
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph, tag_label, attr2, poem_label, attr1, m_r_name2)
print("创建关系:" + it + "-包含-" + title[i] + "成功")
if formal[i]!='无':
attr2={"name":formal[i]}
# 创建关系
m_r_name1 = "形式"
reValue1 = CreateRelationship(graph, poem_label, attr1, formal_label, attr2, m_r_name1)
print("创建关系:" + title[i] + "-所属形式-" + formal[i] + "成功")
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph, formal_label, attr2, poem_label, attr1, m_r_name2)
print("创建关系:" + formal[i] + "-包含-" + title[i] + "成功")
if ci_name[i]!='无':
attr2 = {"name": ci_name[i]}
if MatchNode(graph, cipai_label, attr2) == None:
CreateNode(graph, cipai_label, attr2)
print("创建词牌名:" + ci_name[i] + "成功!!")
# 创建关系
m_r_name1 = "词牌名"
reValue1 = CreateRelationship(graph, poem_label, attr1, cipai_label, attr2, m_r_name1)
print("创建关系:" + title[i] + "-词牌名-" + ci_name[i] + "成功")
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph, cipai_label, attr2, poem_label, attr1, m_r_name2)
print("创建关系:" + ci_name[i] + "-包含-" + title[i] + "成功")
if qu_name[i]!='无':
attr2 = {"name": qu_name[i]}
if MatchNode(graph, qupai_label, attr2) == None:
CreateNode(graph, qupai_label, attr2)
print("创建曲牌名:" + qu_name[i] + "成功!!")
# 创建关系
m_r_name1 = "曲牌名"
reValue1 = CreateRelationship(graph, poem_label, attr1, qupai_label, attr2, m_r_name1)
print("创建关系:" + title[i] + "-曲牌名-" + qu_name[i] + "成功")
m_r_name2 = "包含"
reValue2 = CreateRelationship(graph, qupai_label, attr2, poem_label, attr1, m_r_name2)
print("创建关系:" + qu_name[i] + "-包含-" + title[i] + "成功")
if author[i]!='无':
#创建作者写作关系
attr2={"name":author[i]}
if MatchNode(graph,author_label,attr2)!=None:
#创建关系
m_r_name1 = "写作"
reValue1 = CreateRelationship(graph, author_label, attr2, poem_label, attr1, m_r_name1)
print("创建关系:"+author[i]+"-写作-"+title[i]+"成功")
m_r_name2 = "作者"
reValue2 = CreateRelationship(graph,poem_label, attr1, author_label, attr2, m_r_name2)
print("创建关系:" + title[i] + "-作者-" + author[i] + "成功")
if desty[i]!='无':
attr2 = {"name": desty[i]}
if MatchNode(graph, desty_label, attr2) == None:
CreateNode(graph, desty_label, attr2)
print("创建朝代:" + desty[i] + "成功!!")
# 创建关系
m_r_name1 = "朝代"
reValue1 = CreateRelationship(graph, poem_label, attr1, desty_label, attr2, m_r_name1)
print("创建关系:" + title[i] + "-所属朝代-" + desty[i] + "成功")
m_r_name2 = "包含诗词"
reValue2 = CreateRelationship(graph, desty_label, attr2, poem_label, attr1, m_r_name2)
print("创建关系:" + desty[i] + "-包含-" + title[i] + "成功") if __name__ == '__main__':
create_poem()

展示

总结

实体关系构建完成,基本的古诗词关系理清,之后可以进行相关的网页展示。

整个关系结构图,如下所示:

中华古诗词知识图谱之实体关系构建&导入neo4j数据库的更多相关文章

  1. 2. 知识图谱-命名实体识别(NER)详解

    1. 通俗易懂解释知识图谱(Knowledge Graph) 2. 知识图谱-命名实体识别(NER)详解 3. 哈工大LTP解析 1. 前言 在解了知识图谱的全貌之后,我们现在慢慢的开始深入的学习知识 ...

  2. 知识图谱实体对齐1:基于平移(translation)的方法

    1 导引 在知识图谱领域,最重要的任务之一就是实体对齐 [1](entity alignment, EA).实体对齐旨在从不同的知识图谱中识别出表示同一个现实对象的实体.如下图所示,知识图谱\(\ma ...

  3. 知识图谱实体对齐2:基于GNN嵌入的方法

    知识图谱实体对齐2:基于GNN嵌入的方法 1 导引 我们在上一篇博客<知识图谱实体对齐1:基于平移(translation)嵌入的方法>中介绍了如何对基于平移嵌入+对齐损失来完成知识图谱中 ...

  4. 1. 通俗易懂解释知识图谱(Knowledge Graph)

    1. 通俗易懂解释知识图谱(Knowledge Graph) 2. 知识图谱-命名实体识别(NER)详解 3. 哈工大LTP解析 1. 前言 从一开始的Google搜索,到现在的聊天机器人.大数据风控 ...

  5. 百度大脑UNIT3.0详解之知识图谱与对话

    如今,越来越多的企业想要在电商客服.法律顾问等领域做一套包含行业知识的智能对话系统,而行业或领域知识的积累.构建.抽取等工作对于企业来说是个不小的难题,百度大脑UNIT3.0推出「我的知识」版块专门为 ...

  6. Multi-Task Feature Learning for Knowledge Graph Enhanced Recommendation(知识图谱)

    知识图谱(Knowledge Graph,KG)可以理解成一个知识库,用来存储实体与实体之间的关系.知识图谱可以为机器学习算法提供更多的信息,帮助模型更好地完成任务. 在推荐算法中融入电影的知识图谱, ...

  7. 知识图谱顶刊综述 - (2021年4月) A Survey on Knowledge Graphs: Representation, Acquisition, and Applications

    知识图谱综述(2021.4) 论文地址:A Survey on Knowledge Graphs: Representation, Acquisition, and Applications 目录 知 ...

  8. 知识图谱学习与实践(4)——通过例句介绍Sparql的使用

    通过例句介绍Sparql的使用 1 简介 SPARQL的定义,是一个递归的定义,为SPARQL Protocal and RDF Query Language,是W3C制定的RDF知识图谱标准查询语言 ...

  9. 仿Neo4j里的知识图谱,利用d3+vue开发的一个网络拓扑图

    项目需要画一个类似知识图谱的节点关系图. 一开始用的是echart画的. 根据https://gallery.echartsjs.com/editor.html?c=xH1Rkt3hkb,成功画出简单 ...

随机推荐

  1. 大数据学习day11------hbase_day01----1. zk的监控机制,2动态感知服务上下线案例 3.HDFS-HA的高可用基本的工作原理 4. HDFS-HA的配置详解 5. HBASE(简介,安装,shell客户端,java客户端)

    1. ZK的监控机制 1.1 监听数据的变化  (1)监听一次 public class ChangeDataWacher { public static void main(String[] arg ...

  2. 【Python】【Basic】【数据类型】运算符与深浅拷贝

    运算符   1.算数运算: 2.比较运算: 3.赋值运算: 4.逻辑运算: 5.成员运算: 三元运算 三元运算(三目运算),是对简单的条件语句的缩写. # 书写格式 result = 值1 if 条件 ...

  3. zabbix之故障自治愈和分层报警

    在agent端修改配置文件 root@ubuntu:~# vim /etc/sudoers zabbix ALL=(ALL) NOPASSWD:ALL#:重启服务root@ubuntu:~# syst ...

  4. redis入门到精通系列(七):redis高级数据类型详解(BitMaps,HyperLogLog,GEO)

    高级数据类型和五种基本数据类型不同,并非新的数据结构.高级数据类型往往是用来解决一些业务场景. (一)BitMaps (1.1) BitMaps概述 在应用场景中,有一些数据只有两个属性,比如是否是学 ...

  5. 加密时java.security.InvalidKeyException: Illegal key size or default parameters解决办法

    需 Java几乎各种常用加密算法都能找到对应的实现.因为美国的出口限制,Sun通过权限文件(local_policy.jar.US_export_policy.jar)做了相应限制.因此存在一些问题: ...

  6. 使用CORS处理跨域请求

    package com.leyou.gateway.config;import org.springframework.context.annotation.Bean;import org.sprin ...

  7. java中子类继承父类什么?

    1.继承public和protected修饰的属性和方法,不管子类和父类是否在同一个包: 2.继承默认权限修饰符修饰的属性和方法,前提是子类和父类在同一个包.

  8. numpy基础教程--二维数组的转置

    使用numpy库可以快速将一个二维数组进行转置,方法有三种 1.使用numpy包里面的transpose()可以快速将一个二维数组转置 2.使用.T属性快速转置 3.使用swapaxes(1, 0)方 ...

  9. vm16虚拟机安装win11

    vm16虚拟机安装win11 参考https://baijiahao.baidu.com/s?id=1712702900207158969&wfr=spider&for=pc win1 ...

  10. tableau创建点位地图

    一.双击省/自治区字段 二.双击销售额字段,标记类型改为圆 三.省/自治区字段设置标签显示,圆的大小和颜色细节调整,最终结果如下图所示