Skip to content

A java library to parse and present Digital Object Identifiers (DOIs)

License

Notifications You must be signed in to change notification settings

globalbioticinteractions/doi4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doi4j

Build Status standard-readme compliant Maven Central DOI

Java library for parsing and printing Digital Object Identifiers (DOIs).

According doi.org, the [...] DOI system provides a technical and social infrastructure for the registration and use of persistent interoperable identifiers, called DOIs, for use on digital networks.[...].

At first glance, the DOI syntax is pretty simple (e.g., 10.[registrant code]/[suffix], or 10.123/456), but tricky encoding issues can arise when expressing them as URIs. Because these encodings might not be easy to handle (e.g., a well-formed URI presentation of doi 10.1000/456#789 is https://doi.org/10.1000/456%23789 and not https://doi.org/10.1000/456#789), this library was created.

Please see section "2.5.2.3 Encoding Issues" of the the DOI handbook (also see https://www.doi.org/doi_handbook/2_Numbering.html#2.5.2.3) for more information.

Table of Contents

Install

Maven, Gradle, SBT

doi4j is made available through a maven repository.

To include doi4j in your project, add the following sections to your pom.xml (or equivalent for sbt, gradle etc):

  <dependencies>
    <dependency>
      <groupId>org.globalbioticinteractions</groupId>
      <artifactId>doi4j</artifactId>
      <version>0.1.0</version>
    </dependency>
  </dependencies>

Examples

Please see examples below or the unit tests for examples usage.

import org.globalbioticinteraction.doi.DOI;

// create a doi using registrant and suffix
DOI doi = new DOI("123", "456");

// or use commonly used string presentations
doi = DOI.create("https://doi.org/10.123/456");
doi = DOI.create("doi:10.123/456");
doi = DOI.create("10.123/456");

// or use a (properly encoded) URI
doi = DOI.create(URI.create("https://doi.org/10.123/456"));

// get "pure" doi
doi.toString();
// "10.123/456"

// show "printable" doi
doi.toPrintable();
// "doi:10.123/456"

// get DOI uri
doi.toURI().toString()
// "https://doi.org/10.123/456"

Building

Please use maven version 3.3+ , otherwise you might find issues like this one.

  • Clone this repository
  • Run tests using mvn test (optional).
  • Run mvn package to build (standalone) jar

Contribute

Feel free to join in. All welcome. Open an issue!

License

MIT

About

A java library to parse and present Digital Object Identifiers (DOIs)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages