Druskat, Stephan
2018-02-12
<p><em><strong>cff-reader-java</strong></em></p>
<p>A Java API for reading software citation metadata files in the <a href="https://citation-file-format.github.io/">Citation File Format</a> The API provides POJO models for software citation metadata for inspection and re-use.</p>
<p><strong>Entry point</strong></p>
<p>The main entry point to the API is via the <code>SoftwareCitationMetadataReader</code> interface. For example:</p>
<pre><code class="language-java">SoftwareCitationMetadataReader reader = new SoftwareCitationMetadataPojoReader();
File cffFile = new File(...);
SoftwareCitationMetadata citationMetadata = reader.readFromFile(cffFile);
/*
* Alternatively, e.g., for reading files from the
* class loader via
* `this.getClass().getResourceAsStream("/CITATION.cff")`
*/
InputStream cffInputStream = ...;
citationMetadata = reader.readFromStream(cffInputStream);
// Inspect/re-use
citationMetadata.getTitle();
citationMetadata.getVersion();
...
for (author : citationMetadata.getPersonAuthors()) {
author.getFamilyNames();
author.getGivenNames();
...
}
for (author : citationMetadata.getEntityAuthors()) {
author.getName();
...
}
for (reference : citationMetadata.getReferences()) {
reference.getType();
reference.getTitle();
...
for (author : reference.getPersonAuthors()) {
author.getFamilyNames();
author.getGivenNames();
...
}
for (author : reference.getEntityAuthors()) {
author.getName();
...
}
}</code></pre>
<p><strong>Exceptions</strong></p>
<p>Upon errors, the API will throw exceptions:</p>
<ul>
<li><code>InvalidCFFFileNameException</code> – thrown on attempted reads of files with an invalid name (CFF file must be named <code>CITATION.cff</code>)</li>
<li><code>InvalidDataException</code> – thrown on encountering invalid data in the CFF file, as specified in the <a href="https://citation-file-format.github.io/">Citation File Format specifications</a></li>
<li><code>ReadException</code> – thrown on encountering errors or exceptions during the read process</li>
</ul>
<p><code>InvalidDataException</code> and <code>ReadException</code> may wrap cause exceptions.</p>
<p><strong>Installation</strong></p>
<p><em>Maven</em></p>
<p>The API is provided via the usual Sonatype Snapshot Repository (OSSRH) and Maven Central.</p>
<pre><code class="language-xml"><dependencies>
<dependency>
<groupId>org.research-software.citation</groupId>
<artifactId>cff-reader-java</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies></code></pre>
<p><strong>Documentation</strong></p>
<p>General documentation is maintained at <a href="https://citation-file-format.github.io/cff-reader-java">https://citation-file-format.github.io/cff-reader-java</a>, including <a href="https://citation-file-format.github.io/cff-reader-java/apidocs/index.html">API JavaDocs</a>.</p>
<p><strong>Source code and contribution</strong></p>
<p>The source code for this project is maintained at <a href="https://github.com/citation-file-format/cff-reader-java">https://github.com/citation-file-format/cff-reader-java</a>, where you can also find guideliens on contributing.</p>
<p><strong>Build</strong></p>
<p>Build the project locally with <code>mvn {clean} install</code>.</p>
<p><strong>License</strong></p>
<blockquote>
<p>Copyright (c) 2018ff. Stephan Druskat</p>
<p>Licensed under the Apache License, Version 2.0 (the "License");<br>
you may not use this file except in compliance with the License.<br>
You may obtain a copy of the License at<br>
http://www.apache.org/licenses/LICENSE-2.0<br>
Unless required by applicable law or agreed to in writing, software<br>
distributed under the License is distributed on an "AS IS" BASIS,<br>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br>
See the License for the specific language governing permissions and<br>
limitations under the License.</p>
</blockquote>
https://doi.org/10.5281/zenodo.1171250
oai:zenodo.org:1171250
Zenodo
https://github.com/citation-file-format/cff-reader-java
https://doi.org/10.5281/zenodo.1171249
info:eu-repo/semantics/openAccess
Apache License 2.0
http://www.apache.org/licenses/LICENSE-2.0
citation-files, credit, attribution, research-software-engineering, sustainability, format, standard, yaml, wsssspe, citation-metadata, software citation
cff-reader-java
info:eu-repo/semantics/other