[Tex/LaTex] \nocite{*} for single bibdatasources with biblatex/biber

biberbiblatexciting

Several bibliography resources are used in one single tex-document.
They resources have been added using: \addbibresource{}.
Now I'd like to use the \nocite{*} command to print all references of
one of the bibresources. However \nocite{*} does consider all resources instead
of just a single source (in the case of the example it should be resource2). Is there a way
to specify that with \nocite{*}?

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname-resource1.bib}
@article{A2014,
author={First Author},
journal={Journal A},
title={First Paper},
year={2014}
}
\end{filecontents*}
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname-resource2.bib}
@article{B2014,
author={Another Author},
journal={Journal B},
title={Second Paper},
year={2014}
}
@article{C2014,
author={Next Author},
journal={Journal C},
title={Third Paper},
year={2014}
}
\end{filecontents*}

\documentclass{article}         


%bib
\usepackage[backend=biber,style=authoryear]{biblatex} % load the package
\addbibresource{\jobname-resource1.bib}
\addbibresource{\jobname-resource2.bib}

%%%%%%%%%%%%%%%
\begin{document}

This is a citation \cite{C2014}
\nocite{*}

\printbibliography 

\end{document}

Best Answer

You can do this quite easily using reference sections with bound datasources:

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{resource1.bib}
\begin{document}
\begin{refsection}[resource2.bib]
\nocite{*}
\printbibliography
\end{refsection}
\nocite{*}
\printbibliography
\end{document}

Here, the first \nocite only adds the references from resource2.bib because it's local to the refsection. The second \nocite only picks up things from resource1.bib because both are in refsection "'0". \printbibliography is local to a refsection if it has no section argument.

Here's another way of thinking about this and why it's hard in general. biblatex works semantically with bibliographies and so the way to cite things is by semantic information that applies to bibliographies - citekeys, entry types, reference sections etc. biber knows how to map these to things to a semantically lower level like files, tags in an XML file (the .bcf) and the like. The problem is that what is wanted is a biblatex way of specifying cite keys at a semantic level below that of "bibliography" e.g. "file". biblatex has no concept of such things in its code and it's very hard to implement (and would be very messy). It can pass through such foreign concepts like file names to biber but that's not enough for this case as biblatex internal data structures would need to track citation and sorting lists at the "file" semantic level and that's impossible. Simply put, there would need to be a bibliographic semantic component between "one or more citation keys" and "all citation keys in a refsection" which is all \nocite currently understands. "File" is already ruled out for reasons mentioned above.