14 changed files with 418 additions and 77 deletions
			
			
		- 
					3package.json
- 
					11src/api/archivesManage/library.js
- 
					BINsrc/assets/images/test/1.png
- 
					BINsrc/assets/images/test/2.png
- 
					BINsrc/assets/images/test/3.png
- 
					BINsrc/assets/images/test/4.png
- 
					48src/neo4j.js
- 
					149src/views/AIAssistant/AIKeywords/index.vue
- 
					1src/views/archivesManage/managementLibrary/juannei/index.vue
- 
					6src/views/archivesManage/managementLibrary/module/archivesInfo/index.vue
- 
					92src/views/archivesManage/managementLibrary/module/handleInfo/index.vue
- 
					6src/views/collectReorganizi/collectionLibrary/module/archivesInfo/index.vue
- 
					92src/views/collectReorganizi/collectionLibrary/module/handleInfo/index.vue
- 
					87src/views/components/echarts/graph.vue
| After Width: 1036 | Height: 1500 | Size: 171 KiB | 
| After Width: 1036 | Height: 1500 | Size: 120 KiB | 
| After Width: 1036 | Height: 1500 | Size: 149 KiB | 
| After Width: 1653 | Height: 2339 | Size: 500 KiB | 
| @ -0,0 +1,48 @@ | |||||
|  | import neo4j from 'neo4j-driver' | ||||
|  | 
 | ||||
|  | const driver = neo4j.driver( | ||||
|  |   'bolt://192.168.99.107:7687', | ||||
|  |   neo4j.auth.basic('neo4j', 'ftzn83560792') | ||||
|  | ) | ||||
|  | 
 | ||||
|  | export async function getGraphData() { | ||||
|  |   const session = driver.session() | ||||
|  |   console.log('session', session) | ||||
|  |   try { | ||||
|  |     const result = await session.run('MATCH (n)-[r]->(m) RETURN n, r, m') | ||||
|  |     // const result = await session.run('MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 25')
 | ||||
|  | 
 | ||||
|  |     const nodes = [] | ||||
|  |     const edges = [] | ||||
|  |     console.log('result', result) | ||||
|  |     result.records.forEach(record => { | ||||
|  |       const sourceNode = record.get('n') | ||||
|  |       console.log('sourceNode', sourceNode) | ||||
|  |       const targetNode = record.get('m') | ||||
|  |       console.log('targetNode', targetNode) | ||||
|  |       const relationship = record.get('r') | ||||
|  |       console.log('relationship', relationship) | ||||
|  | 
 | ||||
|  |       // 添加节点
 | ||||
|  |       if (!nodes.some(node => node.id === sourceNode.identity.low)) { | ||||
|  |         // nodes.push({ id: sourceNode.identity.low, label: sourceNode.labels[0] })
 | ||||
|  |         nodes.push({ id: sourceNode.identity.low, text: sourceNode.properties.title, type: sourceNode.labels[0] }) | ||||
|  |       } | ||||
|  |       if (!nodes.some(node => node.id === targetNode.identity.low)) { | ||||
|  |         // nodes.push({ id: targetNode.identity.low, label: targetNode.labels[0] })
 | ||||
|  |         nodes.push({ id: targetNode.identity.low, text: targetNode.properties.title, type: targetNode.labels[0] }) | ||||
|  |       } | ||||
|  | 
 | ||||
|  |       // 添加边
 | ||||
|  |       edges.push({ from: sourceNode.identity.low, to: targetNode.identity.low, text: relationship.type }) | ||||
|  |     }) | ||||
|  |     console.log(nodes, edges) | ||||
|  |     return { nodes, edges } | ||||
|  |   } finally { | ||||
|  |     await session.close() | ||||
|  |   } | ||||
|  | } | ||||
|  | 
 | ||||
|  | export function closeDriver() { | ||||
|  |   driver.close() | ||||
|  | } | ||||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue