Skip to content

Commit

Permalink
update...
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakkwj committed Jul 21, 2020
1 parent 2f66723 commit 8d9a433
Show file tree
Hide file tree
Showing 8 changed files with 17,145 additions and 21,037 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,24 @@ df = ts.get_concept_classified()
## 任务5:利用上面的csv文件生成数据库

```shell
neo4j_home$ bin/neo4j-admin import --nodes executive.csv --nodes stock.csv -- nodes concept.csv --nodes industry.csv --relationships executive_stock.csv --relationships stock_industry.csv -- relationships stock_concept.csv
neo4j_home$ bin/neo4j-admin import --id-type=STRING --nodes executive.csv --nodes stock.csv --nodes concept.csv --nodes industry.csv --relationships executive_stock.csv --relationships stock_industry.csv --relationships stock_concept.csv
```

这个命令会把所有的数据导入到Neo4j中,数据默认存放在 graph.db 文件夹里。如果graph.db文件夹之前已经有数据存在,则可以选择先删除再执行命令。

把Neo4j服务重启之后,就可以通过`localhost:7474`观察到知识图谱了。

注意:这些csv要放到``~/.config/Neo4j Desktop/Application/neo4jDatabases/database-xxxx/installation-4.0.4``下,即与bin文件夹同级,否则需要绝对路径

简单查询命令

```bash
# 查询node
MATCH (n:Concept) RETURN n LIMIT 25
# 查询relationship
MATCH p=()-[r:industry_of]->() RETURN p LIMIT 100
```

## 任务6:基于构建好的知识图谱,通过编写Cypher语句回答如下问题

(1) 有多少个公司目前是属于“ST”类型的?
Expand Down
2 changes: 1 addition & 1 deletion data/import/concept.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
concept_id:ID,name,:LABEL
concept_id:ID(Concept),name,:LABEL
75e96079eda9b8f8ff26ec4d25a0dfc3,成渝特区,Concept
83ee0bcb7f4d04367e8834b88995bd8a,氢燃料,Concept
f1507f026988192110407ff48aebefa9,触摸屏,Concept
Expand Down
3,905 changes: 1 addition & 3,904 deletions data/import/executive.csv

Large diffs are not rendered by default.

20,996 changes: 10,498 additions & 10,498 deletions data/import/executive_stock.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/import/industry.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
industry_id:ID,name,:LABEL
industry_id:ID(Industry),name,:LABEL
2212c3e783d2b83a8532d98eeba1c4b2,仪器仪表,Industry
a2c6239da6b189ac41964eb35e313bb3,商业百货,Industry
3159a3474b29d95f46fa54b4ed7387c2,玻璃行业,Industry
Expand Down
Loading

0 comments on commit 8d9a433

Please sign in to comment.