Skip to content

Commit

Permalink
doc fix (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
baifuyu authored Jan 9, 2024
1 parent 29dbc1b commit 8f88553
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 37 deletions.
2 changes: 1 addition & 1 deletion docs/examples/medicine/medicine.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ title: 医疗图谱
### Step1:进入案例目录

```shell
cd /openspg/python/knext/knext/examples/medicine/
cd python/knext/knext/examples/medicine/
```

### Step2:项目初始化
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/riskmining/riskmining.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ title: 黑产挖掘
### step1:进入案例目录

```shell
cd /openspg/python/knext/knext/examples/riskmining/
cd python/knext/knext/examples/riskmining/
```

### step2:项目初始化
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/supplychain/supplychain.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ nav:
### Step1:进入案例目录

```shell
cd /openspg/python/knext/examples/supplychain/
cd python/knext/knext/examples/supplychain/
```

### Step2:项目初始化
Expand Down Expand Up @@ -85,7 +85,7 @@ knext builder execute Company,CompanyFundTrans,Person
最后提交事件

```shell
knext builder submit ProductChainEvent
knext builder execute ProductChainEvent
```

### Step5:执行图谱任务
Expand Down
45 changes: 14 additions & 31 deletions docs/tutorial/installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ docker-compose -f docker-compose.yml up -d
docker pull --platform linux/x86_64 openspg/openspg-python:latest
```

### 案例体验
下载完镜像后,可以克隆OpenSPG源码:
```bash
git clone git@github.com:OpenSPG/openspg.git
```

拉取完镜像后,如果想体验OpenSPG提供的案例,可以启动容器后,进入案例的目录执行相应knext命令
源码克隆完成后,可以体验源码中自带的案例

```bash
# 启动容器
docker run --rm --net=host \
-it openspg/openspg-python-amd64:latest \
# 启动容器,将其中的${project_dir}替换成源码目录
docker run --rm --net=host -v ${project_dir}:/code \
-it openspg/openspg-python:latest \
"/bin/bash"

# 容器启动后,进入/code目录,即openspg项目源码目录
cd /code

# 容器启动后,可以直接进入openspg提供的案例目录,就可以按照教程体验例案例了
cd /openspg/python/knext/knext/examples
# 后续可以安装案例教程,比如进入riskmining目录
cd python/knext/knext/examples/riskmining

# 参考案例教程,执行相应的knext命令,比如
knext project create --prj_path .
Expand All @@ -54,30 +60,7 @@ knext builder execute ...
knext reasoner execute ...
```

### 项目开发

如果期望基于OpenSPG新建项目,可以使用下面的命令启动容器

```bash
# 启动容器,并将本地的项目目录挂载到docker的/code目录中
docker run --rm --net=host -v ${project_dir}:/code \
-it openspg/openspg-python-amd64:latest \
"/bin/bash"

# 容器启动后,可以直接进入/code目录
cd /code

# 创建OpenSPG项目
knext project create --name ${项目名} --namespace ${项目命名空间}

# 上述命令执行成功后,会在/code下创建一个名称为${项目命名空间}的knext工程目录
# 进入该目录后,可以看到schema、builder、reasoner三个目录
cd ${项目命名空间}
```

如果使用PyCharm等IDE来开发该knext工程,也可以将${project_dir}目录下的${项目命名空间}拖到PyCharm中。

同时本地安装openspg-knext进入开发。由于本目录已挂在到docker中,开发完成后在docker中执行knext命令即可
另外,当本地基于IDE去编写图谱项目时,可以执行以下命令安装knext:

```bash
pip install openspg-knext
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorial/knext/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ class CompanyFuseOp(FuseOp):
def link(self, subject_record: SPGRecord) -> SPGRecord:
name = subject_record.get_property("name")
linked_record = self.search_client.fuzzy_search(subject_record, "name")

return output
return linked_record

def merge(
self, subject_record: SPGRecord, linked_record: SPGRecord
Expand Down

0 comments on commit 8f88553

Please sign in to comment.