0

EDITED to make the question more clear

I have the same desire, as the original poster of this this question.

I was also able, to add my desired fields to bibers data modell and voila: running biber --tool does not yield a warning on my additional fields any more. So far so good.

As described in that self answering question, I copied the data model file from biber (i.e. biber --tool-config) and added my fields.

<config>
<!-- skipped 383 lines -->
  <datamodel>
    <!-- skipped "constants" and "entrytypes" --> 
    <fields>
      <!-- skipped all predefined fields --> 
      <field fieldtype="field" datatype="literal">source</field>
      <field fieldtype="field" datatype="literal">copyright</field>
    </fields>
    <entryfields>
      <field>source</field>
      <field>copyright</field>
    <!-- skipped remainder of file -->
    </entryfields>
  </datamodel>
</config>

Now my question: is there any chance, to write my custom fields to an additional date model config file, so that it enhances whatever data model will be used by future versions of biber?

Chapter 3.1.2 describes, that biber uses "user-level maps", which could be declared by a LaTeX command or in a config file. The manual states, that the sourcemap option could be used, to "Add new fields to an entry", which is exactly my desire.

This would be the best solution. It would ensure, that the default data model in its latest revision, will always be loaded as default model and by additionally loading my fields via a second, additional config file, all fields are available. I don't have to check regularly, if the biber team updated the data model and thus have to insert also the recent changes into my enhanced and file.

What content must be defined in a file to be loaded with the --sourcemap=<extension-config> to extend the default data map with my custom fields?

Jan
  • 5,293
  • 1
    This answer is probably what you want: https://tex.stackexchange.com/a/415630/105447 – gusbrs Dec 26 '23 at 15:25
  • @gusbrs This is the same solution, I was able to realize: copy the complete data model, insert the missing fields, run the biber --tool with the manipulated data model. BUT: when the biber authors change the biber data model, I have to update my enhanced file. What I want: define only the additional fields in an config file. When biber is run in tool mode, it will read its default data model and than will add my extra definitions to it. Therefore, I always use the most recent version of the data model and requested config file adds only those fields, which are missing. – Jan Dec 26 '23 at 17:19
  • Mhm, I might be wrong but, as far as I recall, that's something which is not possible at the biber config file level, which is probably the only viable method for biber --tool. – gusbrs Dec 26 '23 at 17:54
  • @gusbrs That would be no so nice. – Jan Dec 26 '23 at 17:59
  • @gusbrs if that is the case, I should create a script, which regularly diffs the actual data set config file with the one, I was using today. If there is a diff, it should at least send some kind of warning and the differences it found. – Jan Dec 26 '23 at 18:13
  • Jan, I'm really not sure, let's see if someone more knowledgeable drops by. But I said so, because at the time I answered that one, I did some research, and I wouldn't go with "copying the whole thing then modifying" if there were an alternative. I agree with you it is not ideal to have to do so. On the other hand, the data model should be pretty stable, and you can always get your diff directly from the repo: https://github.com/plk/biber/commits/dev/data/biber-tool.conf. – gusbrs Dec 26 '23 at 18:19

1 Answers1

2

You don't need to put the entire data model in the config file, only additions or changes. See the chapter "The Data Model" in the biber documentation: https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/documentation/biber.pdf/download

For example, from 3.13 in the above document, to add a director field to video entrytypes, put just the following in the biber config file:

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <datamodel>
    <fields>
      <field fieldtype="list" datatype="name">director</field>
    </fields>
    <entryfields>
      <entrytype>video</entrytype>
      <field>director</field>
    </entryfields>
  </datamodel>
</config>
PLK
  • 22,776