Query a citation graph with SQL
query_citation_graphRun your own read-only SQLite query on the citation graph Inciteful builds around 1–500 seed papers (depth 2). It queries the Inciteful citation graph API; schema: https://incitefulmed.com/academic/help/power-users#database-schema Rules: a single SELECT statement. Rows returned: the limit argument if given, else the query's trailing LIMIT, else 100; at most 500. OFFSET (and LIMIT a, b) is rejected; page with a narrower WHERE or an ORDER BY instead.
Schema:
papers(paper_id TEXT: OpenAlex ID (W…); doi TEXT without the https://doi.org/ prefix; authors TEXT: JSON array of {author_id, name, sequence, position, institution {id, name, ror}}; num_authors INTEGER; title TEXT; published_year INTEGER; journal TEXT; num_citing INTEGER; num_cited_by INTEGER; distance INTEGER; page_rank REAL; adamic_adar REAL; cocite REAL). num_citing and num_cited_by are in-graph counts (citations between papers in this graph), not global citation counts.
authors(author_id TEXT: OpenAlex author ID without the A prefix; paper_id TEXT; name TEXT; sequence INTEGER, from 0; affiliation TEXT; affiliation_id TEXT: OpenAlex institution ID without the I prefix; ror TEXT: ROR URL; published_year INTEGER; partial_page_rank REAL: the author's share of the paper's page_rank)
metadata(name TEXT, value TEXT): one row each for graph_depth, graph_snapshot, prune_threshold, highly_cited_not_expanded, seeds_not_expanded, paper_count, citation_count. value is TEXT; use CAST(value AS INTEGER) to compare numbers.
title_search(paper_id, search_text): an FTS5 index of the titles with Porter stemming; search_text holds the titles (paper IDs are indexed too). Query it as a table function, starting the match text with the column filter: SELECT paper_id FROM title_search('search_text: vagus AND nerve'). AND, OR, NOT and parentheses work; bm25(title_search) ranks matches, smaller is better.
title_terms(term, doc_count): the stemmed title terms and the number of papers each appears in, leaving out a few common words.
The Research Organization Registry (active organizations), attached as ror; join on authors.ror = ror.organizations.ror_url: organizations(ror_id, ror_url, display_name, status, established, types, country_code, country_name, city, latitude, longitude), names(ror_id, name, name_types, language), external_ids(ror_id, id_type, preferred_id, external_id), relationships(ror_id, related_ror_id, related_name, relationship_type).
What the schema cannot tell you:
There is no edge table, so SQL cannot tell which papers cite which.
Papers with no citation inside the graph have NULL num_citing, num_cited_by, distance, page_rank, adamic_adar and cocite.
With one seed, the seed is at distance 0, its citing and cited papers at 1 and their neighbours at 2, so distance > 0 leaves the seed out. With several seeds a synthetic paper W0 ("Temp Paper", year 1900) cites every seed: W0 is at distance 0, the seeds at 1 and their neighbours at 2, so distance > 1 leaves out W0 and the seeds; otherwise add paper_id <> 'W0'. Then cocite is NULL in every row (nothing cites W0) and adamic_adar is measured against W0.
Examples:
One seed: the highest-PageRank papers since 2020 with "stimulation" in the title: SELECT paper_id, title, published_year, page_rank FROM papers WHERE distance > 0 AND published_year >= 2020 AND paper_id IN (SELECT paper_id FROM title_search('search_text: stimulation')) ORDER BY page_rank DESC LIMIT 20
Authors ranked by their share of PageRank: SELECT author_id, name, COUNT(*) AS papers, SUM(partial_page_rank) AS influence FROM authors GROUP BY author_id, name ORDER BY influence DESC LIMIT 20
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single SQLite SELECT statement. | |
| limit | No | Rows to return, at most 500. Default: the query's trailing LIMIT (capped at 500), else 100. | |
| seeds | Yes | 1–500 seed papers: DOIs, OpenAlex IDs (W…) or PMIDs. Duplicates count once. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| truncated | Yes | ||
| provenance | Yes | ||
| diagnostics | No | ||
| inciteful_url | Yes |