Skip to content

Commit

Permalink
docs: optimize docs and images (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanzhidongyzby authored Jan 18, 2025
1 parent 6eb7635 commit 19378b0
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 40 deletions.
19 changes: 15 additions & 4 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@

**[https://osgraph.com](https://osgraph.com)**


## 快速开始

当前OSGraph提供的默认6张基础开源图谱含义如下:

| 图谱名称 | 图谱ID | 功能 |
|----------|------------------------|-----------------------------------------------|
| 项目贡献图谱 | `project-contribution` | 根据项目开发者研发活动信息(Issue、PR、Commit、CR等),找到项目核心贡献者。 |
| 项目生态图谱 | `project-ecosystem` | 提取项目间的开发活动、组织等关联信息,构建项目核心生态关系。 |
| 项目社区图谱 | `project-community` | 根据项目的开发活动、开发者组织等信息,提取项目核心开发者社区分布。 |
| 开发活动图谱 | `developer-activity` | 根据开发者研发活动信息(Issue、PR、Commit、CR等),找到参与的核心项目。 |
| 开源伙伴图谱 | `os-partner` | 找到开发者在开源社区中,与之协作紧密的其他开发者。 |
| 开源兴趣图谱 | `os-interest` | 根据参与的项目主题、标签等信息,分析开发者技术领域与兴趣。 |

在这里你可以参考[图谱示例](docs/zh-CN/demo.md)进行产品体验。

使用Markdown直接引用OSGraph图谱?试试:
Expand All @@ -28,9 +42,6 @@

具体请参考:[OSGraph API设计规范](docs/zh-CN/api-reference.md)


## 快速开始

本地启动测试请参考:[快速开始](docs/zh-CN/quick-start.md)

如果你希望定制自己专有的图谱,可以参考:[开发手册](docs/zh-CN/developer-manual.md)
Expand All @@ -52,7 +63,7 @@



## 参与贡献
## 参与贡献

您可以参考[贡献手册](community/CONTRIBUTING.md)提交GitHub Issue/PR对OSGraph反馈建议与功能改进,也可以通过下面的联系方式加入TuGraph社区群与我们直接沟通交流。

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@

**[https://osgraph.com](https://osgraph.com)**

## QuickStart

The following are the meanings of the 6 default basic open source graphs currently provided by OSGraph:

| Graph Name | Graph ID | Function |
|----------|------------------------|-----------------------------------------------|
| Project Contribution Graph | `project-contribution` | Find core project contributors based on developer activity information (Issues, PRs, Commits, CRs, etc.). |
| Project Ecosystem Graph | `project-ecosystem` | Extract relationships between projects' development activities and organizations to build core project ecosystem relationships. |
| Project Community Graph | `project-community` | Extract core developer community distribution based on project development activities and developer organization information. |
| Developer Activity Graph | `developer-activity` | Find core projects participated in based on developer activity information (Issues, PRs, Commits, CRs, etc.). |
| Open Source Partner Graph | `os-partner` | Find other developers who collaborate closely with the developer in the open source community. |
| Open Source Interest Graph | `os-interest` | Analyze developer's technical domains and interests based on participated project topics, tags and other information. |

You can refer to [Graph Demo](docs/en-US/demo.md) for product experience.

Want to directly embed OSGraph graphs in Markdown? Try:
Expand All @@ -28,8 +41,6 @@ Want to directly embed OSGraph graphs in Markdown? Try:

For more details:[OSGraph API Reference](docs/en-US/api-reference.md)

## QuickStart

Startup and test on local machine: [Quick Start](docs/en-US/quick-start.md)

Customize your own graph (DIY): [Developer Manual](docs/en-US/developer-manual.md)
Expand Down
51 changes: 30 additions & 21 deletions docs/en-US/developer-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
## 1. Introduction
**OSGraph (Open Source Graph)** provides six open-source graph datasets for users to explore, including three project-related graphs (Contribution, Ecosystem, Community) and three development-related graphs (Activities, Partners, Interests). If these six graphs do not meet your needs, you can customize your own graphs following this document.

## 2. Local Setup
Refer to the [Quick Start](./quick-start.md) document to complete the local setup and testing of the OSGraph service.

## 2. Product Design

By writing GitHub Archive data into the [TuGraph](https://github.com/TuGraph-family) database, OSGraph builds a graph query service for open source, and uses [AntV](https://github.com/antvis) for graph visualization.

![](../img/arch.jpg)

Furthermore, by connecting different open source graphs, unlimited exploration and expansion of the open source graphs can be achieved.

![](../img/expand.jpg)

## 3. Project Structure

* Entry Point: `osgraph-service/server.py`
Expand All @@ -14,11 +23,11 @@ Refer to the [Quick Start](./quick-start.md) document to complete the local setu
* Service Layer: `osgraph-service/app/services`
* Data Layer: `osgraph-service/app/dal`

## 4. Development Details
## 4. Development

### 4.1 Interface Layer Development
### 4.1 Graph API Development

#### 4.1.1 Interface Design Specifications
#### 4.1.1 Graph API Design

URLs in the interface layer follow standardized design principles, using consistent formats for RESTful APIs, shared pages, and shared images.

Expand All @@ -30,7 +39,7 @@ URLs in the interface layer follow standardized design principles, using consist

For more details:[OSGraph API Reference](api-reference.md)

#### 4.1.2 Adding New Graph Interfaces
#### 4.1.2 Add Graph API

Create a new graph interface in the `osgraph-service/app/routes` directory and call the corresponding manager for implementation.

Expand All @@ -53,7 +62,7 @@ class OSInterestController:
...
```

### 4.2 Business Layer Development
### 4.2 Graph Manager Development

#### 4.2.1 Graph View Model

Expand Down Expand Up @@ -114,7 +123,7 @@ Meaning of edge models:
| `CommonDevelop` | Development activities that users jointly participate in |
| `ContributeRepo` | A user contributes to a repository |

#### 4.2.2 Adding New Graph Managers
#### 4.2.2 Add Graph Manager

Create a manager in the `osgraph-service/app/managers` directory and call the respective service for implementation.

Expand All @@ -126,14 +135,14 @@ class OSInterestManager:
```


### 4.3 Service Layer Development
### 4.3 Graph Service Development


#### 4.3.1 Adding New Graph Services
#### 4.3.1 Add Graph Service

Create a new service in the `osgraph-service/app/services/graph_services` directory.

Configure the required service parameters. Use inputTypes to declare the main query type and filterKeys to define query parameters for the service.
Configure the required service parameters. Use `inputTypes` to declare the main query type and `filterKeys` to define query parameters for the service.

```Python
class OSInterestServiceConfig(ServiceConfig):
Expand Down Expand Up @@ -168,7 +177,7 @@ class OSInterestService(BaseService):
```


### 4.4 Data Layer Development
### 4.4 Graph Data Development

#### 4.4.1 Graph Data Schema

Expand All @@ -178,12 +187,12 @@ The underlying graph schema for OSGraph is defined as follows:
For details, you can visit the TuGraph console directly: [Link](http://127.0.0.1:7070/#/Workbench/CreateLabel)


## 5. Development Example
## 5. Development Demo

### 5.1 Requirement
Build a "Development Language" graph to describe the programming languages a user prefers when contributing to open source.
Build a "Development Language" graph (`dev-lang`) to describe the programming languages a user prefers when contributing to open source.

### 5.2 Develop DevLangController
### 5.2 Develop `DevLangController`

```python
dev_lang_bp = Blueprint("dev_lang", __name__, url_prefix="/api/graphs")
Expand All @@ -203,7 +212,7 @@ def get_org_repo(platform, remaining_path):
response = controller.get_graph(data)
```

### 5.3 Develop DevLangManager
### 5.3 Develop `DevLangManager`

```Python
class DevLangManager:
Expand Down Expand Up @@ -231,9 +240,9 @@ class DevLangManager:
return graph.to_dict()
```

### 5.4 Develop DevLangService
### 5.4 Develop `DevLangService`

Configure the DevLangService service parameters.
Configure the `DevLangService` service parameters.
```python
class DevLangServiceConfig(ServiceConfig):
def __init__(self):
Expand All @@ -247,7 +256,7 @@ class DevLangServiceConfig(ServiceConfig):
)
```

Implement the DevLangService service logic.
Implement the `DevLangService` service logic.

```python
class DevLangService(BaseService):
Expand Down Expand Up @@ -283,7 +292,7 @@ class DevLangService(BaseService):
return results
```

Register the DevLangService graph service.
Register the `DevLangService` graph service.

```python
SERVICE_CONFIGS = [
Expand All @@ -292,9 +301,9 @@ SERVICE_CONFIGS = [
]
```

### 5.5 Validation
### 5.5 Test

Test the URL:http://127.0.0.1:8000/api/graphs/dev-lang/github/fanzhidongyzby?lang-limit=3
Test URL:`http://127.0.0.1:8000/api/graphs/dev-lang/github/fanzhidongyzby?lang-limit=3`


Response Result:
Expand Down
Binary file added docs/img/arch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/expand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/fanzhidongyzby-part.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/flink-comm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/graphs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/llama3-eco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/osgraph-cn.jpg
Binary file not shown.
Binary file removed docs/img/osgraph-en.jpg
Binary file not shown.
Binary file modified docs/img/sindresorhus-intr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/torvalds-act.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/torvalds-contrib.png
Binary file not shown.
Binary file added docs/img/torvalds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 23 additions & 13 deletions docs/zh-CN/developer-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
## 1. 介绍
**OSGraph (Open Source Graph)** 默认提供了6张开源数据图谱供大家体验,包含项目类图谱3个(贡献、生态、社区)、开发类3个(活动、伙伴、兴趣)。如果这6张图谱不能满足您的需求,您也可以根据此文档,定制属于您自己的图谱。

## 2. 本地启动
请选参考[快速开始](./quick-start.md)文档完成本地OSGraph服务启动测试。
请先参考[快速开始](./quick-start.md)文档完成本地OSGraph服务启动测试。

## 2. 产品设计

通过将GitHub Archive数据写入到[TuGraph](https://github.com/TuGraph-family)数据库,OSGraph构建了开源图谱的查询服务,并使用[AntV](https://github.com/antvis)完成图谱可视化。

![](../img/arch.jpg)

更进一步地,通过连接不同的开源图谱,可以对开源图谱进行无限的探索与扩展。

![](../img/expand.jpg)


## 3. 项目结构

Expand Down Expand Up @@ -133,7 +143,7 @@ class OSInterestManager:

`osgraph-service/app/services/graph_services`目录中创建对应服务。

配置必要的服务参数,inputTypes声明图谱的查询主体类型,filterKeys声明图谱服务的查询参数
配置必要的服务参数,`inputTypes`声明图谱的查询主体类型,`filterKeys`声明图谱服务的查询参数

```Python
class OSInterestServiceConfig(ServiceConfig):
Expand All @@ -158,7 +168,7 @@ SERVICE_CONFIGS = [
]
```

编写execute函数,并调用数据层`GraphClient`,获取所需的底图数据。
编写`execute`函数,并调用数据层`GraphClient`,获取所需的底图数据。

```Python
class OSInterestService(BaseService):
Expand All @@ -181,9 +191,9 @@ OSGraph底层图数据结构定义为:
## 5. 开发示例

### 5.1 需求
构建一个“开发语言”图谱,描述用户开源贡献时偏爱的编程语言。
构建一个“开发语言”图谱`dev-lang`,描述用户开源贡献时偏爱的编程语言。

### 5.2 开发DevLangController
### 5.2 开发`DevLangController`

```python
dev_lang_bp = Blueprint("dev_lang", __name__, url_prefix="/api/graphs")
Expand All @@ -203,7 +213,7 @@ def get_org_repo(platform, remaining_path):
response = controller.get_graph(data)
```

### 5.3 开发DevLangManager
### 5.3 开发`DevLangManager`

```Python
class DevLangManager:
Expand Down Expand Up @@ -231,9 +241,9 @@ class DevLangManager:
return graph.to_dict()
```

### 5.4 开发DevLangService
### 5.4 开发`DevLangService`

配置DevLangService服务参数
配置`DevLangService`服务参数
```python
class DevLangServiceConfig(ServiceConfig):
def __init__(self):
Expand All @@ -248,7 +258,7 @@ class DevLangServiceConfig(ServiceConfig):
```


实现DevLangService服务逻辑
实现`DevLangService`服务逻辑

```python
class DevLangService(BaseService):
Expand Down Expand Up @@ -284,7 +294,7 @@ class DevLangService(BaseService):
return results
```

注册DevLangService图谱服务
注册`DevLangService`图谱服务

```python
SERVICE_CONFIGS = [
Expand All @@ -293,9 +303,9 @@ SERVICE_CONFIGS = [
]
```

### 5.5 验证
### 5.5 测试

访问测试URL:http://127.0.0.1:8000/api/graphs/dev-lang/github/fanzhidongyzby?lang-limit=3
访问测试URL:`http://127.0.0.1:8000/api/graphs/dev-lang/github/fanzhidongyzby?lang-limit=3`

响应结果:
```json
Expand Down

0 comments on commit 19378b0

Please sign in to comment.