Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

šŸ¦€ Rust crate

crates.io docs.rs Size Downloads Dependency Status

The ACORN CLI application is built on top of the acorn-lib Rust crate. The acorn-lib library provides core functionalities for working with ACORN schemas, processing persistent identifiers through their lifecycle, and generating artifacts.

AI And Agent APIs

The library also provides building blocks for optional AI-enabled applications:

  • acorn::schema::agent models language models, providers, benchmark harnesses, prompt files, and agent-oriented OpenCode configuration.
  • Embedded prompt templates support summarization, translation, teaching, claim extraction, and gap finding.
  • acorn::io::api::openai provides a client for completions, chat completions, responses, embeddings, model discovery, and related operations using supported OpenAI-style HTTP endpoints and JSON formats. It can call OpenAI’s service or another compatible server, including a local one such as llama-swap; ā€œOpenAI-compatibleā€ describes the connection format, not the model provider.

These APIs complement ACORN’s deterministic schema and artifact workflows; applications decide when and how a model is invoked.

Important

When ACORN validates a PID, it does not rely only on recognition patterns. It also validates parsed structure and, for ISBNs1, ISNIs2, ORCIDs3, and RORs4, the check digits implemented for that identifier. Validation is local and does not confirm registration with an external authority.

The PID regression tests maintain shared test-vector parity with Metadata Tools for arXiv, DOI, ISBN, ISNI, ORCID, RAiD, and ROR, and with idutils for ARK, arXiv, DOI, Handle, ISBN, ISNI, ORCID, RAiD, ROR, and SWHID. This parity applies to the listed overlapping cases, not every behavior or identifier family supported by those projects.

Installation

  • Add acorn-lib as a dependency5

    cargo add acorn-lib
    
  • Use acorn-lib functions in your Rust code

    #![allow(unused)]
    fn main() {
    use acorn::schema::validate::{is_ark, is_arxiv, is_doi, is_isni, is_orcid, is_ror};
    
    assert!(is_ark("ark:/1234/w5678").is_ok());
    assert!(is_arxiv("arXiv:2106.09685").is_ok());
    assert!(is_doi("10.11578/dc.20250604.1").is_ok());
    assert!(is_isni("https://isni.org/isni/0000000492299539").is_ok());
    assert!(is_orcid("https://orcid.org/0000-0002-2057-9115").is_ok());
    assert!(is_ror("01qz5mb56").is_ok());
    }
  • If you want to use the full capability of acorn-lib to build your own CLI app, be sure to enable the doctor and powerpoint features6

    cargo add acorn-lib --features doctor,powerpoint
    

  1. ISBN ↩

  2. ISNI ↩

  3. ORCID ↩

  4. ROR ↩

  5. Check crates.io for the latest version ↩

  6. See the Cargo.toml for more details. ↩