Skip to content

Citing substances

A molecule in a standards document is a substance with identity, not glyphs. AsciiChem closes that loop: resolve an identifier, then emit a dataset-type Relaton bibitem for the source you choose to cite.

substance = AsciiChem::Resolver.resolve(value: "50-78-2", convention: "cas")
xml = AsciiChem::Citation.to_xml(substance) # Relaton <bibitem type="dataset">

From the CLI:

Terminal window
asciichem cite --cas 50-78-2

The bibitem carries the publisher, an accessed date from the resolution’s provenance, a source-specific docidentifier (PubChem CID 2244, CAS RN 50-78-2), and every identifier as a keyword — so a citation is machine-checkable against its InChIKey long after the page numbers change.

Attach the citation intent to the molecule itself. The @cite property annotation names the source you want to cite, and the molecule’s other identifiers say who to resolve it as:

Source Rendered
CC(=O)OC1=CC=CC=C1C(=O)O @cas("50-78-2") @cite("pubchem")
C C ( = O ) O C 1 = C C = C C = C 1 C ( = O ) O

Then the bibitem is a function of the parse tree:

molecule = AsciiChem.parse(source).nodes.first
AsciiChem::Citation.for_molecule(molecule)
# => [["pubchem", #<Relaton::Bibitem ...>]]

for_molecule resolves via the strongest identifier available (@cas, @inchikey, @inchi/@smiles, then names) and returns one [source, bibitem] pair per cited source. Annotate once, cite anywhere — the citation follows the molecule through every format.

Two databases agreeing on a substance are still two different documents. Resolution is multi-source; citation is per-source — pick the sources you trust, cite each once.

  • PubChem is the default: keyless, permissive, and the bulk mirror of validated CAS RNs.
  • CAS Common Chemistry is opt-in: its data is CC BY-NC 4.0, so the adapter never registers itself and every result carries the required attribution.
AsciiChem::Resolver.register(:common_chemistry,
AsciiChem::Resolver::CommonChemistry)

Results are cached in your user cache directory (TTL’d, attribution included); --refresh bypasses the cache.

Play