TransWikia.com

validating datamodel with biber complains about items used with crossref mechanism

TeX - LaTeX Asked on July 21, 2021

I want to check the bibliography in a big editorial project. This works quite well with

biber --validate-datamodel debug-biber-check-datamodel

But there is a problem with the field booktitle. Bibdesk adds booktitle to all book items and I need booktitle for crossref as well.

Running validate-datamodel on the file below, I get the following warnings:

WARN - Datamodel: Entry 'HPSGHandbook' (ref.bib): Invalid field 'booktitle' for entrytype 'book'
WARN - Datamodel: Entry 'HPSGHandbook' (ref.bib): Missing mandatory field 'author'

Is there a way to get rid of these messages? I now it is possible to add to a datamodel but I could not figure out how.

documentclass{scrbook}

begin{filecontents}{ref.bib}

@incollection{AC2020a,
Author = {Anne Abeillé and Rui P. Chaves},
Crossref = {HPSGHandbook},
Title = {Coordination}}


@book{HPSGHandbook,
Address = {Berlin},
Booktitle = {{Head-Driven Phrase Structure Grammar: The} Handbook},
Editor = {Stefan Müller and Anne Abeillé and Borsley, Robert D. and Jean-Pierre Koenig},
Publisher = {Language Sciene Press},
Title = {{Head-Driven Phrase Structure Grammar: The} Handbook},
Year = {2020}}

end{filecontents}

usepackage[
        backend=biber,
]{biblatex}
addbibresource{ref.bib}

begin{document}

cite{AC2020a,HPSGHandbook}

printbibliography
end{document}

One Answer

These messages are perfectly sensible according to the standard data model: @books don't have a booktitle but should have an author.

Things get much, much better when you make HPSGHandbook an @collection. In that case you won't get a warning about a missing author (because @collection is not supposed to have one) and you won't need the booktitle, because the title will be automatically inherited by a child @incollection as booktitle.

documentclass{article}

begin{filecontents}{jobname.bib}
@incollection{AC2020a,
  author   = {Anne Abeillé and Rui P. Chaves},
  title    = {Coordination},
  crossref = {HPSGHandbook},
}
@collection{HPSGHandbook,
  editor    = {Stefan Müller and Anne Abeillé and Borsley, Robert D. and Jean-Pierre Koenig},
  title     = {Head-Driven Phrase Structure Grammar: The Handbook},
  year      = {2020},
  address   = {Berlin},
  publisher = {Language Science Press},
}
end{filecontents}

usepackage[
  backend=biber,
]{biblatex}
addbibresource{jobname.bib}

begin{document}
autocite{AC2020a,HPSGHandbook}

printbibliography
end{document}

[1] Anne Abeillé and Rui P. Chaves. “Coordination”. In: Head-Driven Phrase Structure Grammar: The Handbook. Ed. by Stefan Müller et al. Berlin: Language Sciene Press, 2020.//[2] Stefan Müller et al., eds. Head-Driven Phrase Structure Grammar: The Handbook. Berlin: Language Sciene Press, 2020.


I really don't see the point in changing the data model in a way to allow the bad input to pass. The whole point of data model validation is to pick up issues in your file that you might not see when you just look at the output.

If you insist, here is an MWE that includes a changed data model that adds booktitle to the known fields for @book and drops the requirement to have an author. It's quite long, because the data model constraints have to be restated (there is no interface to remove a single mandatory-field constraint, see also the comments below my answer to How to cite report-like documents that do not have/need an institution?).

documentclass{article}

begin{filecontents}{jobname.bib}
@incollection{AC2020a,
  author   = {Anne Abeillé and Rui P. Chaves},
  title    = {Coordination},
  crossref = {HPSGHandbook},
}
@book{HPSGHandbook,
  editor    = {Stefan Müller and Anne Abeillé and Borsley, Robert D. and Jean-Pierre Koenig},
 title      = {Head-Driven Phrase Structure Grammar: The Handbook},
  booktitle = {Head-Driven Phrase Structure Grammar: The Handbook},
  year      = {2020},
  address   = {Berlin},
  publisher = {Language Sciene Press},
}
end{filecontents}
begin{filecontents}{bookparent.dbx}
DeclareDatamodelEntryfields[book]{
  booktitle}
  
ResetDatamodelConstraints

DeclareDatamodelConstraints[
  article,
  book,
  inbook,
  bookinbook,
  suppbook,
  booklet,
  collection,
  incollection,
  suppcollection,
  manual,
  misc,
  mvbook,
  mvcollection,
  online,
  patent,
  periodical,
  suppperiodical,
  proceedings,
  inproceedings,
  reference,
  inreference,
  report,
  set,
  thesis,
  unpublished]{
    constraint[type=mandatory]{
      constraintfieldsxor{
        constraintfield{date}
        constraintfield{year}
      }
    }
  }

DeclareDatamodelConstraints[set]{
  constraint[type=mandatory]{
    constraintfield{entryset}
  }
}

DeclareDatamodelConstraints[article]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{journaltitle}
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[book,mvbook,mvcollection,mvreference]{
  constraint[type=mandatory]{
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[inbook,bookinbook,suppbook]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
    constraintfield{booktitle}
  }
}

DeclareDatamodelConstraints[booklet]{
  constraint[type=mandatory]{
    constraintfieldsor{
      constraintfield{author}
      constraintfield{editor}
    }
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[collection,reference]{
  constraint[type=mandatory]{
    constraintfield{editor}
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[incollection,suppcollection,inreference]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{editor}
    constraintfield{title}
    constraintfield{booktitle}
  }
}

DeclareDatamodelConstraints[dataset]{
  constraint[type=mandatory]{
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[manual]{
  constraint[type=mandatory]{
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[misc,software]{
  constraint[type=mandatory]{
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[online]{
  constraint[type=mandatory]{
    constraintfield{title}
    constraintfieldsor{
      constraintfield{url}
      constraintfield{doi}
      constraintfield{eprint}
    }
  }
}

DeclareDatamodelConstraints[patent]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
    constraintfield{number}
  }
}

DeclareDatamodelConstraints[periodical]{
  constraint[type=mandatory]{
    constraintfield{editor}
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[proceedings,mvproceedings]{
  constraint[type=mandatory]{
    constraintfield{title}
  }
}

DeclareDatamodelConstraints[inproceedings]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
    constraintfield{booktitle}
  }
}

DeclareDatamodelConstraints[report]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
    constraintfield{type}
    constraintfield{institution}
  }
}

DeclareDatamodelConstraints[thesis]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
    constraintfield{type}
    constraintfield{institution}
  }
}

DeclareDatamodelConstraints[unpublished]{
  constraint[type=mandatory]{
    constraintfield{author}
    constraintfield{title}
  }
}

DeclareDatamodelConstraints{
  constraint[type=data, datatype=isbn]{
    constraintfield{isbn}
  }
  constraint[type=data, datatype=issn]{
    constraintfield{issn}
  }
  constraint[type=data, datatype=ismn]{
    constraintfield{ismn}
  }
  constraint[type=data, datatype=pattern, pattern=regexp{(?:sf|sm|sn|pf|pm|pn|pp)}]{
    constraintfield{gender}
  }
}
end{filecontents}

usepackage[
  backend=biber,
  datamodel=bookparent,
]{biblatex}
addbibresource{jobname.bib}

begin{document}
autocite{AC2020a,HPSGHandbook}

printbibliography
end{document}

Answered by moewe on July 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP