plk / biber

Backend processor for BibLaTeX
Artistic License 2.0
336 stars 37 forks source link

validate-datamodel somehow does not inherit the year from proceedings to inproceedings #337

Closed stefan11 closed 2 years ago

stefan11 commented 4 years ago

Working on the following entries, I get a warning that the year is not specified:

biber --validate-datamodel debug-biber-check-data-model-solution
INFO - This is Biber 2.15 (beta)
INFO - Logfile is 'debug-biber-check-data-model-solution.blg'
INFO - Reading 'debug-biber-check-data-model-solution.bcf'
INFO - Found 2 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'debug-biber-check-data-model-solution.bib' for section 0
INFO - LaTeX decoding ...
INFO - Found BibTeX data source 'debug-biber-check-data-model-solution.bib'
INFO - Datamodel validation starting
WARN - Datamodel: Entry 'CP85a-u' (debug-biber-check-data-model-solution.bib): Missing mandatory field - one of 'date, year' must be defined

I think this is due to the specification of month information.

\documentclass{article}

\begin{filecontents}{\jobname.bib}

@inproceedings{CP85a-u,
    Author = {Lewis G. Creary and Carl J. Pollard},
    Crossref = {acl85},
    Month = Jul,
    Pages = {172--179},
    Title = {A Computational Semantics for Natural Language}}

@proceedings{acl85,
    Address = {Chicago, IL},
    Editor = {Mann, William C.},
    Publisher = {acl},
    Title = {Proceedings of the {Twenty-Third Annual Meeting of the Association for Computational Linguistics}},
    Year = {1985}}

\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{acl85,CP85a-u}

\printbibliography
\end{document}
moewew commented 4 years ago

The custom data model does not appear to be relevant to the question, so here is a shortened MWE that compares an entry with month and one without month side by side.

\documentclass{article}

\begin{filecontents}{\jobname.bib}
@inproceedings{CP85a-month,
  author   = {Lewis G. Creary and Carl J. Pollard},
  title    = {A Computational Semantics for Natural Language},
  crossref = {acl85},
  month    = jul,
  pages    = {172--179},
}
@inproceedings{CP85a-nomonth,
  author   = {Lewis G. Breary and Carl J. Pollard},
  title    = {A Computational Semantics for Natural Language},
  crossref = {acl85},
  pages    = {172--179},
}
@proceedings{acl85,
  title     = {Proceedings of the Twenty-Third Annual Meeting of the Association for Computational Linguistics},
  editor    = {Mann, William C.},
  year      = {1985},
  address   = {Chicago, IL},
  publisher = {acl},
}
\end{filecontents}

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

\begin{document}
\autocite{acl85,CP85a-month,CP85a-nomonth}

\printbibliography
\end{document}

Biber 2.16 (dev) for Win 64 bit says

[0] Config.pm:312> INFO - This is Biber 2.16 (beta)
[0] Config.pm:315> INFO - Logfile is 'themesons.blg'
[101] biber-MSWIN64:330> INFO - === 
[135] Biber.pm:415> INFO - Reading 'themesons.bcf'
[242] Biber.pm:952> INFO - Found 3 citekeys in bib section 0
[257] Biber.pm:4340> INFO - Processing section 0
[270] Biber.pm:4529> INFO - Looking for bibtex format file 'themesons.bib' for section 0
[312] bibtex.pm:1682> INFO - LaTeX decoding ...
[319] bibtex.pm:1494> INFO - Found BibTeX data source 'themesons.bib'
[346] Biber.pm:1641> INFO - Datamodel validation starting
[347] Utils.pm:395> WARN - Datamodel: Entry 'CP85a-month' (themesons.bib): Missing mandatory field - one of 'date, year' must be defined
[348] Biber.pm:1690> INFO - Datamodel validation complete
[356] UCollate.pm:68> INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
[357] UCollate.pm:68> INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
[357] Biber.pm:4168> INFO - Sorting list 'nty/global//global/global' of type 'entry' with template 'nty' and locale 'en-US'
[360] Biber.pm:4174> INFO - No sort tailoring available for locale 'en-US'
[364] bbl.pm:651> INFO - Writing 'themesons.bbl' with encoding 'UTF-8'
[366] bbl.pm:754> INFO - Output to themesons.bbl
[370] Biber.pm:128> INFO - WARNINGS: 1

and indeed the .bbl entry for CP85a-month has no year

% $ biblatex auxiliary file $
% $ biblatex bbl format version 3.1 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup

\refsection{0}
  \datalist[entry]{nty/global//global/global}
    \entry{CP85a-nomonth}{inproceedings}{}
      \name{author}{2}{}{%
        {{hash=d8c483296dfcf138f168665a5adccfb4}{%
           family={Breary},
           familyi={B\bibinitperiod},
           given={Lewis\bibnamedelima G.},
           giveni={L\bibinitperiod\bibinitdelim G\bibinitperiod}}}%
        {{hash=fa9853e1691fdd880720d658b26c51c7}{%
           family={Pollard},
           familyi={P\bibinitperiod},
           given={Carl\bibnamedelima J.},
           giveni={C\bibinitperiod\bibinitdelim J\bibinitperiod}}}%
      }
      \name{editor}{1}{}{%
        {{hash=563f8403b123f318931470603517361a}{%
           family={Mann},
           familyi={M\bibinitperiod},
           given={William\bibnamedelima C.},
           giveni={W\bibinitperiod\bibinitdelim C\bibinitperiod}}}%
      }
      \list{location}{1}{%
        {Chicago, IL}%
      }
      \list{publisher}{1}{%
        {acl}%
      }
      \strng{namehash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{fullhash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{bibnamehash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{authorbibnamehash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{authornamehash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{authorfullhash}{19e9bbbcb22ce1344de2a9ea78b533ea}
      \strng{editorbibnamehash}{563f8403b123f318931470603517361a}
      \strng{editornamehash}{563f8403b123f318931470603517361a}
      \strng{editorfullhash}{563f8403b123f318931470603517361a}
      \field{sortinit}{B}
      \field{sortinithash}{8de16967003c7207dae369d874f1456e}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{booktitle}{Proceedings of the {Twenty-Third Annual Meeting of the Association for Computational Linguistics}}
      \strng{crossref}{acl85}
      \field{title}{A Computational Semantics for Natural Language}
      \field{year}{1985}
      \field{pages}{172\bibrangedash 179}
      \range{pages}{8}
    \endentry
    \entry{CP85a-month}{inproceedings}{}
      \name{author}{2}{}{%
        {{hash=e96fd41edd389c6732786c8f4e7682a1}{%
           family={Creary},
           familyi={C\bibinitperiod},
           given={Lewis\bibnamedelima G.},
           giveni={L\bibinitperiod\bibinitdelim G\bibinitperiod}}}%
        {{hash=fa9853e1691fdd880720d658b26c51c7}{%
           family={Pollard},
           familyi={P\bibinitperiod},
           given={Carl\bibnamedelima J.},
           giveni={C\bibinitperiod\bibinitdelim J\bibinitperiod}}}%
      }
      \name{editor}{1}{}{%
        {{hash=563f8403b123f318931470603517361a}{%
           family={Mann},
           familyi={M\bibinitperiod},
           given={William\bibnamedelima C.},
           giveni={W\bibinitperiod\bibinitdelim C\bibinitperiod}}}%
      }
      \list{location}{1}{%
        {Chicago, IL}%
      }
      \list{publisher}{1}{%
        {acl}%
      }
      \strng{namehash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{fullhash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{bibnamehash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{authorbibnamehash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{authornamehash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{authorfullhash}{21be075dbc0d72d1584938866c8d6ff5}
      \strng{editorbibnamehash}{563f8403b123f318931470603517361a}
      \strng{editornamehash}{563f8403b123f318931470603517361a}
      \strng{editorfullhash}{563f8403b123f318931470603517361a}
      \field{sortinit}{C}
      \field{sortinithash}{4c244ceae61406cdc0cc2ce1cb1ff703}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{booktitle}{Proceedings of the {Twenty-Third Annual Meeting of the Association for Computational Linguistics}}
      \strng{crossref}{acl85}
      \field{month}{7}
      \field{title}{A Computational Semantics for Natural Language}
      \field{pages}{172\bibrangedash 179}
      \range{pages}{8}
      \warn{\item Datamodel: Entry 'CP85a-month' (themesons.bib): Missing mandatory field - one of 'date, year' must be defined}
    \endentry
    \entry{acl85}{proceedings}{}
      \name{editor}{1}{}{%
        {{hash=563f8403b123f318931470603517361a}{%
           family={Mann},
           familyi={M\bibinitperiod},
           given={William\bibnamedelima C.},
           giveni={W\bibinitperiod\bibinitdelim C\bibinitperiod}}}%
      }
      \list{location}{1}{%
        {Chicago, IL}%
      }
      \list{publisher}{1}{%
        {acl}%
      }
      \strng{namehash}{563f8403b123f318931470603517361a}
      \strng{fullhash}{563f8403b123f318931470603517361a}
      \strng{bibnamehash}{563f8403b123f318931470603517361a}
      \strng{editorbibnamehash}{563f8403b123f318931470603517361a}
      \strng{editornamehash}{563f8403b123f318931470603517361a}
      \strng{editorfullhash}{563f8403b123f318931470603517361a}
      \field{sortinit}{M}
      \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
      \field{labelnamesource}{editor}
      \field{labeltitlesource}{title}
      \field{title}{Proceedings of the {Twenty-Third Annual Meeting of the Association for Computational Linguistics}}
      \field{year}{1985}
    \endentry
  \enddatalist
\endrefsection
\endinput
plk commented 4 years ago

This was a bug caused by having to handle legacy YEAR/MONTH fields in addition to the better xDATE fields. Should be fixed in 2.16 DEV.