1

I have created a few aliases of bibliography types, e.g. standard is a report or software is online. Now, when using such types in my bib file and enabled --validate-datamodel, I get warnings like:

Datamodel: Entry 'Spread' (thesis.bib): Invalid field 'url' for entrytype 'software'

How can I make biber happy about this again? Any way to enhance the data model for the aliases?

MWE

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{test.bib}
@standard{RFC4627,
 date = {2006},
 editor = {IETF},
 number = {4627},
 title = {The application/json Media Type for {JavaScript} Object Notation ({JSON})},
 type = {RFC},
 url = {http://www.ietf.org/rfc/rfc4627.txt},
 urldate = {2016-09-08}
}

@software{Spread,
 label = {Spread},
 title = {The Spread Toolkit},
 url = {http://www.spread.org/},
 urldate = {2016-09-08}
}
\end{filecontents}

\usepackage[backend=biber,style=alphabetic]{biblatex}

\DeclareBibliographyAlias{software}{online}
\DeclareBibliographyAlias{standard}{report}
\bibliography{test}

\begin{document}
    \nocite{*}
    \printbibliography{}
    % should still work
    \printbibliography[heading=bibintoc,type=software,title={Lis‌​t of Software Packages}]{}
\end{document}

Compiled using latexmk with the following latexmkrc:

$pdf_mode = 1;
$pdflatex = 'pdflatex -shell-escape -interaction=nonstopmode';

$biber = 'biber --validate-datamodel %O %S';
  • 1
    As explained in What exactly is the relationship Biblatex refers to as an alias of an entry type? And how should the formatting of aliased entry types be configured? the relation defined by \DeclareBibliographyAlias is in a way on the fly for biblatex. Biber does not know about it, in particular Biber's data model has no way of knowing about it and so it doesn't validate. You can use sourcemapping as described in the end of my answer for a 'Biber-proof' aliasing. – moewe Mar 20 '17 at 17:16
  • @moewe, Thanks, this silences the warnings. However, now I cannot address entries of the mapped types anymore, e.g. for selective bibliographies like \printbibliography[heading=bibintoc,type=software,title={List of Software Packages}]{}. This list is empty now and instead software ends up in the normal bibliography, which I filter as \printbibliography[heading=bibintoc,nottype=software]{}. Any way to make this work again? – languitar Mar 21 '17 at 9:42
2

As explained in What exactly is the relationship BibLaTeX refers to as an alias of an entry type? And how should the formatting of aliased entry types be configured? the alias defined by \DeclareBibliographyAlias is only for bibliography driver purposes. The alias is only accessible for biblatex. In particular Biber does not know about it.

You could do

\DeclareDriverSourcemap[datatype=bibtex]{
  \map{
    \pertype{software}
    \step[typesource=software, typetarget=online, final]
    \step[fieldset=keywords, fieldvalue={,type:software}, append]
  }
  \map{
    \pertype{standard}
    \step[typesource=standard, typetarget=report, final]
    \step[fieldset=keywords, fieldvalue={,type:standard}, append]
  }
}

This will remap @software to @online and @standard to @report for all intents and purposes (so you can't select by type any more). To remedy this, we add keywords that give the former type with the keyword type:<type>.

Now your filtering is not type=<type>, but keyword = {type:<type>}, i.e.

\printbibliography[heading=bibintoc, keyword=type:software],

instead of \printbibliography[heading=bibintoc, type=software].

  • Do I need to change anything to the filtered printbibliography calls after adding the keywords? Right now this still doesn't work. – languitar Mar 21 '17 at 11:40
  • @languitar Why yes of course. Now you don't do type=standard, but you do keyword=type:standard (the rest analogue). – moewe Mar 21 '17 at 11:41
  • Ok, getting closer, However, some publications of my original document (and I really can't find a pattern) now end up in the software list instead of the normal bibliography. Even with completely different entry types and there are no keywords defined on them. – languitar Mar 21 '17 at 11:46
  • @languitar Sorry, I will need an example for that. – moewe Mar 21 '17 at 11:48
  • Some examples: gist.github.com/languitar/274a9fb522255cd293a8fbeaeec048fa. Could it be that adding the keywords needs to be restricted with pertype? – languitar Mar 21 '17 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.