GNU TeXmacsUser manualReferenceAboutEnglish
Version management

Sometimes, a new or better version for a database entry becomes available. This happens for instance, when the value of some field needs to be corrected, or when a paper in a bibliographic database gets published. In

database/db-version.scm

, we introduce a few additional attributes and routines for version management of database entries.

This is particularly important when entries are attached to files and automatically imported into the databases of other users. In this case, one must be careful to determine the most recent version (or versions) and only update entries when we are sure that the new version is better. In order to achieve this, we use the following principle: each entry comes with a main contributor and for each contributor, we only allow one most recent version. In addition, the current version of a first contributor may be declared to be “newer” than the current version of a second contributor.

Special attributes
contributor

Specifies the user who originally contributed the entry.

modus

Specifies the way the entry was contributed (manual or imported).

origin

A source file in the case when the entry was imported.

newer

Specifies a list of identifiers of older versions of a given entry (i.e. the entry is newer than these versions).

date

The creation date of the entry (see with-time-stamp).

Useful routines
(db-update-entry id l [new-id])
(update an entry)

Create a new version of the entry with identifier id (the new version having fields l) and return the identifier of the new entry. The identifier id is added to the newer field of the new version and the old entry is removed. If the optional argument new-id is given and no entry with this identifier exists yet, then it is used as the identifier of the new version; otherwise a new identifier is created. If l coincides with the current fields of id (up to the meta attributes, listed by (db-meta-attributes) in

database/db-format.scm

: date, contributor, modus, origin, newer, and the attributes zotero-item, zotero-library, zotero-version, zotero-key, zotero-synced and zotero-deleted of the entries which come from Zotero), then nothing is done and id is returned.

(db-import-entry id l)
(import an entry)

Given an entry id with fields l, typically from another database, import the entry into our current database. Do the necessary whenever newer versions of this entry already exist in the database (in which case the import is cancelled), or whenever the entry supersedes existing entries. When two versions by the same contributor compete, manually entered versions take precedence over imported ones, and otherwise the most recent date wins. Warnings about ignored entries are emitted through the database-warning debug channel when the variable db-duplicate-warning? (defined in

database/db-convert.scm

, #t by default) is set.

(db-same-entries? l1 l2)
(compare two entries)

Check whether the lists of fields l1 and l2 coincide up to the order of the fields and up to the meta attributes (db-meta-attributes).

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".