# 常见 OpenAlex 查询示例
本文档提供了使用 OpenAlex 进行常见研究查询的实用示例。
## 按作者查找论文
**用户查询**: "查找阿尔伯特·爱因斯坦的论文"
**方法**: 两步模式
1. 搜索作者以获取 ID
2. 按作者 ID 过滤作品
**Python 示例**:
python
from scripts.openalex_client import OpenAlexClient
from scripts.query_helpers import find_author_works
client = OpenAlexClient(email="
[email protected]")
works = find_author_works("Albert Einstein", client, limit=100)
for work in works:
print(f"{work['title']} ({work['publication_year']})")
## 查找来自某机构的论文
**用户查询**: "麻省理工学院 (MIT) 去年发表了哪些论文?"
**方法**: 带日期过滤的两步模式
1. 搜索机构以获取 ID
2. 按机构 ID 和年份过滤作品
**Python 示例**:
python
from scripts.query_helpers import find_institution_works
works = find_institution_works("MIT", client, limit=200)
# 过滤近期论文
import datetime
current_year = datetime.datetime.now().year
recent_works = [w for w in works if w['publication_year'] == current_year]
## 查找某主题的高被引论文
**用户查询**: "查找过去 5 年关于 CRISPR 的最高被引论文"
**方法**: 搜索 + 过滤 + 排序
**Python 示例**:
python
works = client.search_works(
search="CRISPR",
filter_params={
"publication_year": ">2019"
},
sort="cited_by_count:desc",
per_page=100
)
for work in works['results']:
title = work['title']
citations = work['cited_by_count']
year = work['publication_year']
print(f"{title} ({year}): {citations} 次引用")
## 查找某主题的开放获取论文
**用户查询**: "查找关于气候变化的开放获取论文"
**方法**: 搜索 + OA 过滤
**Python 示例**:
python
from scripts.query_helpers import get_open_access_papers
papers = get_open_access_papers(
search_term="climate change",
client=client,
oa_status="any", # 或 "gold", "green", "hybrid", "bronze"
limit=200
)
for paper in papers:
print(f"{paper['title']}")
print(f" OA 状态: {paper['open_access']['oa_status']}")
print(f" URL: {paper['open_access']['oa_url']}")
## 出版趋势分析
**用户查询**: "向我展示机器学习历年的出版趋势"
**方法**: 使用 group_by 按年份聚合
**Python 示例**:
python
from scripts.query_helpers import