Skip to content

Commit

Permalink
Improve DOI identifier check
Browse files Browse the repository at this point in the history
  • Loading branch information
samleeflang committed Dec 2, 2024
1 parent 7e781fc commit 805378b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<version>3.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>eu.dissco.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ private IdentifierUtils() {

private static Map<List<Pattern>, Triple<DctermsType, String, OdsGupriLevel>> patternMap() {
var linkedMap = new LinkedHashMap<List<Pattern>, Triple<DctermsType, String, OdsGupriLevel>>();
linkedMap.put(List.of(compile("^https?://doi.org")),
linkedMap.put(List.of(compile("^https?://doi.org/10.")),
Triple.of(DOI, "DOI", GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE_FDO_COMPLIANT));
linkedMap.put(List.of(compile("^https?://hdl.handle.net")),
linkedMap.put(List.of(compile("^https?://hdl.handle.net"), compile("^https?://doi.org/")),
Triple.of(HANDLE, "Handle", GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE_FDO_COMPLIANT));
linkedMap.put(List.of(compile("^https?://www.wikidata.org")),
Triple.of(URL, "Wikidata", GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.dissco.core.translator.terms.utils;

import static eu.dissco.core.translator.schema.Identifier.DctermsType.ARK;
import static eu.dissco.core.translator.schema.Identifier.DctermsType.DOI;
import static eu.dissco.core.translator.schema.Identifier.DctermsType.HANDLE;
import static eu.dissco.core.translator.schema.Identifier.DctermsType.LOCALLY_UNIQUE_IDENTIFIER;
import static eu.dissco.core.translator.schema.Identifier.DctermsType.PURL;
Expand Down Expand Up @@ -31,6 +32,12 @@ class IdentifierUtilsTest {

public static Stream<Arguments> identifierProvider() {
return Stream.of(
Arguments.of("https://doi.org/10.3535/M42-Z4P-DRD", null, PREFERRED,
createIdentifier("https://doi.org/10.3535/M42-Z4P-DRD", DOI, "DOI",
GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE_FDO_COMPLIANT, PREFERRED)),
Arguments.of("https://doi.org/21.T11148/894b1e6cad57e921764e", null, PREFERRED,
createIdentifier("https://doi.org/21.T11148/894b1e6cad57e921764e", HANDLE, "Handle",
GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE_FDO_COMPLIANT, PREFERRED)),
Arguments.of("https://www.wikidata.org/wiki/Q66581882", null, null,
createIdentifier("https://www.wikidata.org/wiki/Q66581882", URL, "Wikidata",
GLOBALLY_UNIQUE_STABLE_PERSISTENT_RESOLVABLE, null)),
Expand Down

0 comments on commit 805378b

Please sign in to comment.