Skip to content

diging/crossref-connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Java Crossref Connector

This project provides a simple interface to query Crossref's public API.

Installation

Using Maven, include the following plugin:

<dependency>
    <groupId>edu.asu.diging</groupId>
    <artifactId>crossref-connect</artifactId>
    <version>0.1</version>
</dependency>

Usage

Use the plugin as follows:

CrossrefWorksService service = new CrossrefWorksServiceImpl(CrossrefConfiguration.getDefaultConfig());      
try {
    // search takes: query string, page size, and offset
    List<Item> results = service.search("einstein", 5, 0);
    // do something with the results
    results.forEach(r -> System.out.println(r.getTitle()));
} catch (IOException e) {
    // handle exception
    e.printStackTrace();
} catch (RequestFailedException e) {
    // handle exception
    e.printStackTrace();
}

If for some reason, the default parameter to connect to Crossref need to be changed, customized CrossrefConfiguration can be used by either implementing a new CrossrefConfiguration class or adjusting the values in the DefaultCrossrefConfiguration.