# Resolve Identifiers

## Basic Usage

Resolve any identifier (DOI, arXiv, HAL, DBLP, OpenReview) to BibTeX:

```bash
axm-bib resolve "10.1145/363235.363259"
```

Output:

```bibtex
@article{Hoare_1969,
  title   = {An axiomatic basis for computer programming},
  author  = {Hoare, C. A. R.},
  journal = {Communications of the ACM},
  year    = {1969},
  doi     = {10.1145/363235.363259},
}
```

## Supported Identifiers

| Type | Example |
|---|---|
| DOI | `10.1145/363235.363259` |
| arXiv | `arXiv:1706.03762` |
| HAL | `hal-01234567` |
| DBLP | `conf/nips/VaswaniSPUJGKP17` |
| OpenReview | `https://openreview.net/forum?id=...` or `openreview:ID` |

!!! warning "Titles are rejected"
    `axm-bib resolve` only accepts identifiers. If you pass a title,
    you'll get an error with a hint to use `axm-bib search` instead.

## arXiv Venue Enrichment

When resolving an arXiv identifier, `axm-bib` automatically queries Semantic Scholar and DBLP for publication venue metadata. If a venue is found (e.g. NeurIPS, ICLR), the BibTeX entry is enriched:

- Entry type is promoted: `@misc` → `@inproceedings` (or `@article` for journals)
- A `booktitle` field is injected with the venue name

Venue lookup uses S2's **direct paper lookup** endpoint (`/paper/ARXIV:{id}`) rather than the search API, avoiding rate-limit issues. If S2 fails, DBLP is queried as a fallback — preprint-only entries (`CoRR`) are filtered out to find the actual conference venue. When the arXiv-ID DBLP search returns only CoRR entries, a **title-based DBLP search** is attempted as a final fallback to find the conference venue.

```bash
axm-bib resolve "arXiv:2210.02406"
```

```bibtex
@inproceedings{khot2022decomposed,
  title     = {Decomposed Prompting: A Modular Approach for Solving Complex Tasks},
  author    = {Khot, Tushar and ...},
  year      = {2022},
  booktitle = {ICLR},
}
```

!!! tip "Graceful fallback"
    If neither Semantic Scholar nor DBLP has venue metadata (or only CoRR
    entries exist), the original `@misc` arXiv entry is returned unchanged.
    Network errors are handled silently — enrichment never prevents resolution.

## Multi-Ref Merge

When you have multiple identifiers for the same paper (e.g. a DOI and an arXiv ID), pass them all and they'll be merged into a **single BibTeX entry**:

```bash
axm-bib resolve "10.1234/test" "arXiv:2503.18813"
```

Before merging, a **coherence check** verifies that the entries refer to the same paper (by comparing titles and authors). If they don't match, you'll get an error.

### How Merge Works

The merged entry combines fields from all sources into one `@type{key, ...}` block:

- **Fields**: the first entry provides the base structure; unique fields from other entries (e.g. `eprint` from arXiv, `doi` from CrossRef, `booktitle` from DBLP) are injected
- **Type promotion**: the entry type is promoted to the most specific: `article` > `inproceedings` > `incollection` > `techreport` > `misc`
- **Metadata**: DOI, title, authors, and year are resolved using a priority-based strategy (DOI ← CrossRef, eprint ← arXiv, venue ← DBLP)

!!! example
    Merging an arXiv `@misc` with a CrossRef `@article` and a DBLP `@inproceedings` produces a single `@article{...}` entry containing `eprint`, `doi`, and `booktitle` fields.

## Python API

```python
from axm_bib.pipeline import BibPipeline

pipeline = BibPipeline()
entry = pipeline.resolve("10.1145/363235.363259")

print(entry.key)     # "Hoare_1969"
print(entry.raw)     # Full BibTeX string
```

!!! note "MCP agent usage"
    AI agents use `bib_resolve` (single or multi-ref) and `bib_resolve_batch`
    (N papers × M identifiers each) via MCP. See [MCP Integration](mcp.md).
