Semantic Scholar (S2) Adapter
Implements ScholarlyDataSource
against the Semantic Scholar Graph API with offset pagination and high-throughput batch endpoints.
Highlights
- Endpoints:
/paper/search
,/paper/{id}
,/author/search
,/paper/{id}/citations
,/paper/{id}/references
,/paper/batch
,/author/batch
- Auth:
x-api-key
header (optional but recommended) - Pagination: numeric
offset
withnext
token; adapter supports bothoffset
andcursor
- Batching: up to 500 IDs per call, chunked transparently
Search works/authors
$works = $s2->searchWorks(Query::from(['q' => 'transformers', 'limit' => 100]));
$authors = $s2->searchAuthors(Query::from(['q' => 'goodfellow']));
Lookup & lists
$s2->getWorkById('s2:123');
$s2->listReferences('s2:123', Query::from(['limit' => 200]));
Batch
foreach ($s2->batchWorksByIds(['s2:1','s2:2','s2:3'], Query::from(['fields' => ['id','title']])) as $work) {}
Configuration
- Set
S2_API_KEY
(Laravel) or pass['s2' => ['api_key' => '...']]
toAdapterFactory::make()
.
Notes
- External IDs (DOI/arXiv/PMID) are mapped under
external_ids
. - Open access metadata (
is_oa
,oa_url
) is normalized when available.