2facd966a7258e97bdb04431d43a46632c5212ec,demo/Model/neo_models.py,Neo4j,findOtherEntities2,#Neo4j#Any#Any#,48
Before Change
//根据entity2和关系查找enitty1
def findOtherEntities2(self,entity,relation):
answer = self.graph.data("MATCH (n1)- [rel:RELATION {type:\""+relation+"\"}] -> (n2:HudongItem {title:\"" + entity + "\"}) RETURN n1,rel,n2" )
if(len(answer) == 0):
answer = self.graph.data("MATCH (n1)- [rel:RELATION {type:\""+relation+"\"}] -> (n2:NewNode {title:\"" + entity + "\"}) RETURN n1,rel,n2" )
return answer
//根据两个实体查询它们之间的关系
After Change
//根据entity2和关系查找enitty1
def findOtherEntities2(self,entity,relation):
answer = self.graph.run("MATCH (n1)- [rel:RELATION {type:\""+relation+"\"}] -> (n2:HudongItem {title:\"" + entity + "\"}) RETURN n1,rel,n2" ).data()
print(answer)
if(answer is None):
answer = self.graph.run("MATCH (n1)- [rel:RELATION {type:\""+relation+"\"}] -> (n2:NewNode {title:\"" + entity + "\"}) RETURN n1,rel,n2" ).data()
return answer
//根据两个实体查询它们之间的最短路径
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
Instances
Project Name: qq547276542/Agriculture_KnowledgeGraph
Commit Name: 2facd966a7258e97bdb04431d43a46632c5212ec
Time: 2018-10-25
Author: kjmd2d@sina.cn
File Name: demo/Model/neo_models.py
Class Name: Neo4j
Method Name: findOtherEntities2
Project Name: qq547276542/Agriculture_KnowledgeGraph
Commit Name: 2facd966a7258e97bdb04431d43a46632c5212ec
Time: 2018-10-25
Author: kjmd2d@sina.cn
File Name: demo/Model/neo_models.py
Class Name: Neo4j
Method Name: findOtherEntities
Project Name: qq547276542/Agriculture_KnowledgeGraph
Commit Name: 2facd966a7258e97bdb04431d43a46632c5212ec
Time: 2018-10-25
Author: kjmd2d@sina.cn
File Name: demo/Model/neo_models.py
Class Name: Neo4j
Method Name: findRelationByEntity2
Project Name: qq547276542/Agriculture_KnowledgeGraph
Commit Name: 2facd966a7258e97bdb04431d43a46632c5212ec
Time: 2018-10-25
Author: kjmd2d@sina.cn
File Name: demo/Model/neo_models.py
Class Name: Neo4j
Method Name: findRelationByEntity