内容
OpenAlex 本地版 (<code>openalex-local</code>)
<p align="center">
<a href="https://scitex.ai">
<img src="docs/scitex-logo-blue-cropped.png" alt="SciTeX" width="400">
</a>
</p>
<p align="center"><b>本地 OpenAlex 数据库,包含 2.84 亿+ 学术作品、摘要和语义搜索</b></p>
<p align="center">
<img src="docs/scitex_if_validation.png" alt="SciTeX IF vs JCR 验证" width="600"/>
<br>
<em>SciTeX 影响因子(OpenAlex)验证对比 JCR 2024(r = 0.96,17,042 种期刊)</em>
</p>
[
[](https://openalex-local.readthedocs.io/en/latest/)
[](https://github.com/ywatanabe1989/openalex-local/actions/workflows/test.yml)
[](https://codecov.io/gh/ywatanabe1989/openalex-local)
[](https://www.python.org/downloads/)
[](LICENSE)
## 演示
<p align="center">
<img src="docs/scitex_if_validation.png" alt="OpenAlex 本地影响因子验证" width="600"/>
</p>
```bash
# 在本地搜索 2.84 亿篇论文 — 摘要 + 语义索引
openalex-local search "图神经网络用于蛋白质折叠"
# 通过 DOI 解析为完整记录(标题、摘要、引用、影响因子)
openalex-local search-by-doi 10.1038/s41586-021--2
# 从 MCP / Claude 代码驱动alex-local mcp serve上图是基于 的影响因子与 2024 验证 = 0.n = 17,042 种期刊)。
##
```
┌──────────────────────────┐
│ OpenAlex 公共数据转 │
│ (~300 GB 压缩) │
──────┬───────────┘
│ 快照导入
▼
┌─────────────────────┐
│ openalex.db │ (SQLiteTS5) │
│ + 语义嵌入 │
└────────────┘
│
▼
┌────────────────────────────────────── │ openalex Python / CLI / MCP │
│ 搜索 · 按 DOI 搜索 · 缓存 │
│ 影响因子验证 · 统计 · 中继 │
└──────────────────────────────────────┘
```
数据库完全存储在磁盘上;openalex-local 是 SQLite + FTS5 +索引的薄封装。在查询过程中无网络调用。
<details>
<summary><strong>为什么选择 OpenAlex 本地版?</strong></summary>
** 时代而构建** - 面向 AI 研究:
| 功能 | |
|---------|---------|
| **2.84 亿作品** | 比 CrossRef范围更广 |
| **摘要** | 语义搜索可用性为 45-60% |
| **概念和主题** | 内置分类 |
| **作者消歧** | 链接到机构 |
| **开放访问信息** | OA 状态和 URL |
适用于:RAG 系统、研究助手、文献综述自动化。
</details>
<details>
<summary><strong>安装</strong></summary>
```bash
pip install openalex-local
```
从源码:
```bash
git clone https://github.com/ywatanabe1989/openalex-local
cd openalex-local && make install
```
数据库设置(~300 GB,构建需要 ~1-2 天):
```bash
# 检查系统状态
make status
# 1. 下载 OpenAlex 作品快照(~300GB)
make download-screen # 在后台运行
# 2. 构建 SQLite 数据库
make build-db
# 3. 构建 FTS5 索引
make build-fts
```
</details>
<details>
<summary><strong>Python API</strong></summary>
```python
from openalex_local import search, get, count
# 全文搜索(标题 + 摘要)
results = search("机器学习 神经网络")
for work in results:
print(f"{work.title} ({work.year})")
print(f" 摘要:{work.abstract[:200]}...")
print(f" 概念:{[c['name'] for c in work.concepts]}")
# 通过 OpenAlex ID 或 DOI 获取
work = get("W2741809807")
work = get("10.1038/nature12373")
# 计数匹配
n = count("CRISPR")
```
</details>
<details>
<summary><strong>CLI</strong></summary>
```bash
openalex-local search "CRISPR 基因编辑" -n 5
openalex-local search-by-doi W2741809807
openalex-local search-by-doi 10.1038/nature12373
openalex-local status # 配置和数据库状态
```
带摘要(`-a` 标志):
```
$ openalex-local search "神经网络" -n 1 -a
找到 1,523,847 个匹配项,耗时 45.2ms
1. 神经网络的深度学习(2015)
OpenAlex ID:W2741809807
摘要:本文对深度学习技术进行了全面概述,用于神经网络架构...
```
</details>
<details>
<summary><strong>HTTP API</strong></summary>
启动 FastAPI 服务器:
```bash
openalex-local relay --host 0.0.0.0 --port 31292
```
端点:
```bash
# 搜索作品(FTS5)
curl "http://localhost:31292/works?q=CRISPR&limit=10"
# 通过 ID 或 DOI 获取
curl "http://localhost:31292/works/W2741809807"
curl "http://localhost:31292/works/10.1038/nature12373"
# 批量查找
curl -X POST "http://localhost:31292/works/batch" \
-H "Content-Type: application/json" \
-d '{"ids": ["W2741809807", "10.1038/nature12373"]}'
# 数据库信息
curl "http://localhost:31292/info"
```
HTTP 模式(连接到运行中的服务器):
```bash
# 在本地机器上(如果服务器是远程的)
ssh -L 31292:127.0.0.1:31292 your-server
# Python 客户端
from openalex_local import configure_http
configure_http("http://localhost:31292")
# 或通过 CLI
openalex-local --http search "CRISPR"
```
</details>
<details>
<summary><strong>MCP 服务器</strong></summary>
作为 MCP(模型上下文协议)服务器运行:
```bash
openalex-local mcp start
```
本地 MCP 客户端配置:
```json
{
"mcpServers": {
"openalex-local": {
"command": "openalex-local",
"args": ["mcp", "start"],
"env": {
"OPENALEX_LOCAL_DB": "/path/to/openalex.db"
}
}
}
}
```
通过 HTTP 进行远程 MCP:
```bash
# 在服务器上:启动持久的 MCP 服务器
openalex-local mcp start -t http --host 0.0.0.0 --port 8083
```
```json
{
"mcpServers": {
"openalex- {
"url": "http://your-server:/mcp"
}
}
```
诊断设置:
```bash
openalex-local mcp doctor # 检查依赖项和数据库
openalex-local mcp list-tools # 显示可用的 MCP 工具
openalex-local m # 显示示例
```
可用工具:
- `search` - 对 2.84 亿+ 篇论文进行全文搜索
- `search_by_id 通过 OpenAlex ID 或 DOI 获取论文
-_ids` - 批量查找元数据
- `status` - 数据库统计信息
</details>
<details>
<summary><strong>SciTeX 影响因子(OpenAlex)</strong></summary>
我们提供根据 OpenAlex 引用数据计算的**SciTeX 影响因子**。
**对比 JCR 2024 验证**(17,042 种匹配期刊):
| 指标 | 值 |
|--------|-------|
| Pearson r | 0.96 |
| Spearman ρ | 0.93 |
| p 值 | < 1e-100 |
**导出 SciTeX IF:**
```bash
# 导出所有 SciTeX IF 值
openalex-local export-if -o scitex_if.csv
openalex-local export-if -o scitex_if.json
# 前 1000 名
openalex-local export-if -o top1000.csv --limit 1000
```
**在搜索结果中使用:**
```bash
openalex-local search "机器学习" --with-if
```
**公式:**
```
SciTeX IF(年) = 当年引用前两年文章的次数
─────────────────────────────────────────────────────
前两年发表的可引文章数量
```
注意:“SciTeX IF”是我们使用 OpenAlex 数据计算的。
它不是 Clarivate/JCR 的商标“期刊影响因子”。
</details>
<details>
<summary><strong>相关项目</strong></[crossref-local](https://github.com/1989/crossref-local)** - 具有 Crossref 数据的姊:
| 功能 | crossref-local | openalex-local |
|---------|----------------|----------------|
| 作品 | 1.67 亿 | 2.84 亿 |
| 摘要 | ~21% | ~45-60% |
| 更新频率 | 实时 | 每月 |
| DOI 权限 | 是(源) | 使用 Crossref |
| 引用 | 原始引用 | 链接作品 |
| 概念/主题 | 否 | 是 |
| 作者 ID | 否 | 是 |
| 最适合 | DOI 查找、原始引用解析 | 语义搜索 |
**何时使用 CrossRef**:实时 DOI 更新、原始引用解析、权威元数据。
**何时使用 OpenAlex**:语义搜索、引用分析、主题发现。
</details>
<details>
<summary><strong>文档</strong></summary>
完整文档请访问 [openalex-local.readthedocs.io](https://openalex-local.readthedocs.io/en/latest/)
- [安装指南](https://openalex-local.readthedocs.io/en/latest/installation.html)
- [快速入门](https://openalex-local.readthedocs.io/en/latest/quickstart.html)
- [CLI 参考](https://openalex-local.readthedocs.io/en/latest/cli_reference.html)
- [HTTP API 参考](https://openalex-local.readthedocs.io/en/latest/http_api.html)
- [Python API](https://openalex-local.readthedocs.io/en/latest/api/openalex_local.html)
</details>
<details>
<summary><strong>数据源</strong></summary>
来自 [OpenAlex](https://openalex.org/) 的数据,一个开放的学术作品目录。
每月从他们的 [快照](https://docs.openalex.org/download-all-data/openalex-snapshot) 更新。
</details>
## 安装
> **推荐**:`uv pip install openalex-local[all]` —
> uv 的 Rust 解析器在 1-3内处理 SciTeX 依赖项集,而 pip 的串行回溯器可能需要 分钟。
> 普通 `pip install` 仍然有效;下面的安装块显示了两者。
```bash install openalex-local # 核心
pipalex-local[mcp] # + MCP 服务器
```
## 4 个接口
<details open>
<summary><strong>Python API</strong></summary>
<br>
```python
from openalex_local import search, get, enrich_ids
results = search("神经振荡", limit=10)
work = get("W2741809807")
enriched = enrich_ids(["W2741809807", "W3000000000"])
```
</details>
<details>
<summary><CLI</strong></summary>
<br>
```bash
openalex-local search "查询"
openalex-local search-by-doi 10.1038/nature12373
```
</details>
<details>
<summary><strong>MCP 服务器</strong></summary>
<br>
```openalex-local mcp start
```
</details>
<details>
<summary><技能</strong></summary>
<br>
代理技能页面src/openalex_local/_skills/openalex-local/` 下。
</details>
## 问题与解决方案
| # | 问题 | 解决方案 |
|---|---------|----------|
| 1 | **OpenAlex API 是最大的开放书目数据库,但大规模使用需要缓存** — 每秒数百次请求的速率限制会触发 | **本地 SQLite + FTS5(2.84 亿作品)** — 包括摘要、作者隶属关系、引用计数的离线查询 |
## SciTeX 组成部分
`openalex-local` 是 [**SciTeX**](https://scitex.ai) 的一部分。可以通过 `pip install scitex[scholar]` 安装,使用时为 `scitex.scholar`(Python)或 `scitex scholar ...`(CLI)— `openalex-local` 为 `scholar` 的元数据丰富提供了本地 OpenAlex 支持。
```python
import scitex
results = scitex.scholar.search("神经振荡 gamma 波段")
scitex.scholar.enrich_bibtex("references.bib")
```
SciTeX 系统遵循以下四项研究自由,灵感来自 [自由软件定义](https://www.gnu.org/philosophy/free-sw.en.html):
> 四项研究自由
>
> 0. 在任何地方**运行**您的研究 — 您的机器,您的条款。
> 1. **研究** 每一步的工作原理 — 从原始数据到最终手稿。
> 2. **重新分发** 您的工作流,而不仅仅是您的论文。
> 3. **修改** 任何模块并与社区分享改进。
>
> AGPL-3.0 — 因为我们相信研究基础设施应该拥有与软件相同的自由。
---
<p align="center">
<a href="https://scitex.ai" target="_blank"><img src="docs/scitex-icon-navy-inverted.png" alt="SciTeX" width="40"/></a>
</p>
<!-- EOF -->