Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
8541f928
Commit
8541f928
authored
Mar 03, 2022
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20220303
parent
3b26c391
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
apps/models.py
+0
-0
apps/view_atlas/view_es_con.py
+13
-9
No files found.
apps/models.py
View file @
8541f928
This diff is collapsed.
Click to expand it.
apps/view_atlas/view_es_con.py
View file @
8541f928
...
...
@@ -8,10 +8,10 @@ from apps.utils.neo4j_conn import conn_neo4j
from
..models
import
Enterprise
from
py2neo
import
Graph
# graph = conn_neo4j()
graph1
=
Graph
(
"http://39.100.39.50:7475"
,
username
=
"neo4j"
,
password
=
"century-english-almanac-havana-golf-9040"
)
# 太原的neo4j,测试是借用
graph
=
conn_neo4j
()
# graph1 = Graph("http://39.100.39.50:7475", username="neo4j",
# password="century-english-almanac-havana-golf-9040") # 太原的neo4j,测试是借用
def
deleteDuplicate
(
li
):
...
...
@@ -32,7 +32,8 @@ def check(name):
:return:
'''
Cypher
=
"match (n)-[r]->(m) WHERE m.name='{}' or n.name='{}' return r.type"
.
format
(
name
,
name
)
res
=
graph1
.
run
(
Cypher
)
.
data
()
# res = graph1.run(Cypher).data()
res
=
graph
.
run
(
Cypher
)
.
data
()
res
=
list
(
set
([
i
[
"r.type"
]
for
i
in
res
]))
if
res
.
__contains__
(
"上游行业"
)
or
res
.
__contains__
(
"下游行业"
):
return
True
...
...
@@ -137,7 +138,8 @@ def findCenterProducts(product_name):
else
:
sql
=
"match (n)-[r]->(m) WHERE m.name='{}' return n.name,r.type"
.
format
(
product_name
)
# print(sql)
res
=
graph1
.
run
(
sql
)
.
data
()
# res = graph1.run(sql).data()
res
=
graph
.
run
(
sql
)
.
data
()
final_result
=
[]
# 最终产品集
for
i
in
res
:
if
check
(
i
[
"n.name"
]):
# 判断是否有上下游关系(添加到最终产品集)
...
...
@@ -182,7 +184,8 @@ def findUpDownCompany(name_query, name): # 对中间产品进行上下游产品
"match (n) -[r:`下游行业`]->(m) WHERE m.name='{}' return n.name as bname,r.type,m.name as sname "
.
format
(
name
,
name
,
name
,
name
)
res_product
=
graph1
.
run
(
sql_all
)
.
data
()
# res_product = graph1.run(sql_all).data()
res_product
=
graph
.
run
(
sql_all
)
.
data
()
res_product
=
trans_formet
(
name
,
res_product
)
nodes
=
[]
links
=
[]
...
...
@@ -244,7 +247,8 @@ def findUDP(product_name): # 对中间产品进行上下游产品查询
"match (n) -[r:`上游行业`]->(m) WHERE n.name='{}' return n.name as bname,r.type,m.name as sname UNION "
\
"match (n) -[r:`下游行业`]->(m) WHERE m.name='{}' return n.name as bname,r.type,m.name as sname "
.
format
(
product_name
,
product_name
,
product_name
,
product_name
)
res_product
=
graph1
.
run
(
sql_all
)
.
data
()
# res_product = graph1.run(sql_all).data()
res_product
=
graph
.
run
(
sql_all
)
.
data
()
res_product
=
trans_formet
(
product_name
,
res_product
)
products
=
list
()
for
i
in
res_product
:
...
...
@@ -358,8 +362,8 @@ def get_semic_map():
# print("直接产品:", products)
# 2、查询上下游产品
products_center
=
list
()
#
for product_name in products:
for
product_name
in
[
'地铁运营'
,
'轨道交通装备'
]:
for
product_name
in
products
:
#
for product_name in ['地铁运营', '轨道交通装备']:
products_center
.
extend
(
findCenterProducts
(
product_name
))
# 查找中间产品
products_uad
=
list
()
for
product_name
in
products_center
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment