What’s your current thinking on how to best identify a bib note?
Through an external API. Either Org-ref or Org-cite or some other way. One should be able to take the string after fetching it from ROAM_REFS
and prove it with the functions provided by the backend that it is indeed what Org-roam calls a ref
. If it’s a ref
, it should be cached in the sqlite database in the respective column. What is an Org-roam ref
should be decided by Org-roam.
It’s then up to ORB to insert a valid string into ROAM_REFS
—when the note is created through ORB—so that it can then be recognized as a ref
by Org-roam and cached into the database. Currently, it inserts an cite:citekey
link. It is trivial to make it insert a [cite:@citekey]
. It is also up to ORB to be able to recognize a valid “bib note” in a ROAM_REFS
string given to it, for orb-note-actions
for example. Currently, ORB checks whether the string matches against org-ref-cite-re
and recognizes it’s a bib note if if does match.
Org-roam actually doesn’t care much about Org-ref. What it calls a ref
is just a valid link
element. So any link in ROAM_REFS
is recognized as a valid ref
. Org-roam uses org-element
to determine what’s in ROAM_REFS
. If it is a link, it additionally checks it with org-ref-cite-types
. If it is a member of that list, it does some processing to possibly split the cite keys and that’s it, nothing special about Org-ref. It does basically the same for other link types, so Org-roam recognizes a link as a valid ref
as long as org-element
(external API) is able to parse the string as an Org link.
To support org-cite
, however, Org-roam should be able to recognize the Org element citation
as a valid ref
— to decide whether this should be cached into the database. It should be fairly easy to do though.
So if I understand right, ROAM_REFS
replaces ROAM_KEY
, and there can be multiple.
Right. Also, by an unspoken convention ORB assumes that there is only one cite:link
there. It doesn’t cover multiple.
What about the value of that for bib notes in v2, and with org-cite?
A valid citation
element that can be parsed by org-element
.
It turns out org-cite won’t (currently at least) allow a citation to be inserted there. Should it?
It cannot be inserted there by the interactive command org-cite-insert
. Nothing prevents it to be inserted there programmatically by other means, nor for the string be read from there. There is one consequence, however. Currently, if one calls org-open-at-point
while on a cite:link
within ROAM_REFS
, one gets the Org-ref hydra with familiar options to open PDF, go to the BibTeX entry, etc. Many users find this useful. With the current implementation of Org-cite in Org-mode, it seems that not only one cannot “officially” insert org-cite
elements into property drawers, but they are also not recognized as such by org-element
. This means that org-cite-activate
or org-cite-follow
processors don’t work there.