我想检查大型编辑项目中的参考书目。这适用于
biber --validate-datamodel debug-biber-check-datamodel
但是该字段存在问题booktitle
。Bibdesk 添加了booktitle
所有图书项目,我booktitle
也需要添加 crossref。
在下面的文件上运行validate-datamodel,我收到以下警告:
WARN - Datamodel: Entry 'HPSGHandbook' (ref.bib): Invalid field 'booktitle' for entrytype 'book'
WARN - Datamodel: Entry 'HPSGHandbook' (ref.bib): Missing mandatory field 'author'
有没有办法摆脱这些消息?我现在可以将其添加到数据模型,但我不知道该怎么做。
\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}
答案1
根据标准数据模型,这些消息完全合理:@book
s 没有booktitle
但应该有author
。
HPSGHandbook
当你创建时,情况会好得多@collection
。在这种情况下,你不会收到有关缺失 的警告author
(因为@collection
不应该有 ),并且你不需要booktitle
,因为title
将被子级自动继承@incollection
为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}
我真的不明白改变数据模型以允许错误输入通过的意义何在。数据模型验证的整个目的是找出文件中的问题,而这些问题在仅查看输出时可能看不到。
如果您坚持,这里有一个 MWE,它包含一个更改的数据模型,该模型添加了booktitle
已知字段@book
并删除了对 的要求author
。它很长,因为必须重新陈述数据模型约束(没有界面可以删除单个强制字段约束,另请参阅我对如何引用没有/不需要机构的报告类文献?)。
\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}