use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method findCitationForDOIStrangeCharacters.
@Test
public void findCitationForDOIStrangeCharacters() throws IOException {
String citation = new DOIResolverImpl().findCitationForDOI(new DOI("1007", "s00300-004-0645-x"));
assertThat(citation, is("La Mesa M, Dalú M, Vacchi M. Trophic ecology of the emerald notothen Trematomus bernacchii (Pisces, Nototheniidae) from Terra Nova Bay, Ross Sea, Antarctica. Polar Biology [Internet]. 2004 July 27;27(11):721–728. Available from: http://dx.doi.org/10.1007/s00300-004-0645-x"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method findCitationForDOI2.
@Test
public void findCitationForDOI2() throws IOException {
String citationForDOI = new DOIResolverImpl().findCitationForDOI(new DOI("1371", "journal.pone.0052967"));
assertThat(citationForDOI, is("García-Robledo C, Erickson DL, Staines CL, Erwin TL, Kress WJ. Tropical Plant–Herbivore Networks: Reconstructing Species Interactions Using DNA Barcodes Heil M, editor. PLoS ONE [Internet]. 2013 January 8;8(1):e52967. Available from: http://dx.doi.org/10.1371/journal.pone.0052967"));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class DOIResolverImplIT method resolveDOIByNonExistentCitation2.
@Test
public void resolveDOIByNonExistentCitation2() throws IOException {
DOI doi = new DOIResolverImpl().resolveDoiFor("donald duck and mickey mouse run around");
assertThat(doi, is(nullValue()));
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class ExternalIdUtil method urlForExternalId.
public static String urlForExternalId(String externalId) {
URI uri = null;
String url = null;
if (externalId != null) {
for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) {
String idPrefix = idPrefixToUrlPrefix.getKey();
if (StringUtils.startsWith(externalId, idPrefix)) {
if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) {
try {
DOI doi = DOI.create(externalId);
url = doi.toURI().toString();
} catch (MalformedDOIException e) {
LOG.warn("found malformed doi [" + externalId + "]", e);
}
} else {
url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, "");
}
String suffix = getURLSuffixMap().get(idPrefix);
if (StringUtils.isNotBlank(suffix)) {
url = url + suffix;
}
}
if (url != null) {
try {
URIBuilder uriBuilder = new URIBuilder(url);
uri = uriBuilder.build();
// URL ur= new URL(url);
// uri = new URI(ur.getProtocol(), ur.getUserInfo(), ur.getHost(), ur.getPort(), ur.getPath(), ur.getQuery(), ur.getRef());
} catch (URISyntaxException e) {
//
}
break;
}
}
}
return uri == null ? null : uri.toString();
}
use of org.globalbioticinteractions.doi.DOI in project eol-globi-data by jhpoelen.
the class CypherQueryBuilder method extractDOIs.
private static List<DOI> extractDOIs(List<String> accordingToParams) {
List<DOI> dois = new ArrayList<>();
for (String accordingToParam : accordingToParams) {
try {
DOI doi = DOI.create(accordingToParam);
dois.add(doi);
} catch (MalformedDOIException e) {
//
}
}
return dois;
}
Aggregations