Skip to content

Commit

Permalink
use Zenodo supported [isDerivedFrom] instead of [wasDerivedFrom] and …
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorrit Poelen committed Jul 30, 2024
1 parent ef787c6 commit 5c52912
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ public boolean handle(IRI version, InputStream is) throws ContentStreamException
ZenodoMetaUtil.appendIdentifier(linkRecords, ZenodoMetaUtil.IS_ALTERNATE_IDENTIFIER, imageContentId);
ArrayNode arrayNode = new ObjectMapper().createArrayNode();
entry.getValue().forEach(arrayNode::add);
linkRecords.set(ZenodoMetaUtil.WAS_DERIVED_FROM, arrayNode);
linkRecords.set(ZenodoMetaUtil.IS_DERIVED_FROM, arrayNode);

List<String> rawImages = entry.getValue();
for (String rawImage : rawImages) {
ZenodoMetaUtil.appendIdentifier(linkRecords, ZenodoMetaUtil.WAS_DERIVED_FROM, rawImage);
ZenodoMetaUtil.appendIdentifier(linkRecords, ZenodoMetaUtil.IS_DERIVED_FROM, rawImage);
}
setDescription(linkRecords);
writeZenodoMetadata(foundAtLeastOne, linkRecords);
Expand Down Expand Up @@ -196,8 +196,8 @@ private void setOriginReference(String iriString, int lineStart, int lineFinish,
? "-" + "L" + lineFinish
: "";
String value = (StringUtils.isBlank(suffix) && lineStart == -1) ? iriString : ("line:" + iriString + "!/L" + lineStart + suffix);
ZenodoMetaUtil.setValue(objectNode, ZenodoMetaUtil.WAS_INFORMED_BY, value);
ZenodoMetaUtil.appendIdentifier(objectNode, ZenodoMetaUtil.WAS_INFORMED_BY, "https://linker.bio/" + value);
ZenodoMetaUtil.setValue(objectNode, ZenodoMetaUtil.IS_DERIVED_FROM, value);
ZenodoMetaUtil.appendIdentifier(objectNode, ZenodoMetaUtil.IS_DERIVED_FROM, "https://linker.bio/" + value);
ZenodoMetaUtil.append(objectNode, ZenodoMetaUtil.REFERENCES, "Hartop E, Srivathsan A, Ronquist F, Meier R (2022) Towards Large-Scale Integrative Taxonomy (LIT): resolving the data conundrum for dark taxa. Syst Biol 71:1404–1422. https://doi.org/10.1093/sysbio/syac033 " +
"Srivathsan, A., Meier, R. (2024). Scalable, Cost-Effective, and Decentralized DNA Barcoding with Oxford Nanopore Sequencing. In: DeSalle, R. (eds) DNA Barcoding. Methods in Molecular Biology, vol 2744. Humana, New York, NY. https://doi.org/10.1007/978-1-0716-3581-0_14");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public InputStream get(IRI key) {

assertDescription(taxonNode);

assertThat(taxonNode.get("http://www.w3.org/ns/prov#wasInformedBy").asText(), is("line:hash://sha256/856ecd48436bb220a80f0a746f94abd7c4ea47cb61d946286f7e25cf0ec69dc1!/L9"));
assertThat(taxonNode.get("isDerivedFrom").asText(), is("line:hash://sha256/856ecd48436bb220a80f0a746f94abd7c4ea47cb61d946286f7e25cf0ec69dc1!/L9"));
assertThat(taxonNode.get("darktaxon:plateId").asText(), is("BMT121"));
assertThat(taxonNode.get("darktaxon:specimenId").asText(), is("BMT0009397"));
assertThat(taxonNode.get("darktaxon:imageFilepath").asText(), is("BMT121/BMT0009397/BMT121_BMT0009397_RAW_Data_01/BMT121_BMT0009397_RAW_01_01.tiff"));
Expand All @@ -102,7 +102,7 @@ public InputStream get(IRI key) {

assertDescription(taxonNode);

assertThat(taxonNode.get("http://www.w3.org/ns/prov#wasInformedBy").asText(), is("line:hash://sha256/856ecd48436bb220a80f0a746f94abd7c4ea47cb61d946286f7e25cf0ec69dc1!/L78"));
assertThat(taxonNode.get("isDerivedFrom").asText(), is("line:hash://sha256/856ecd48436bb220a80f0a746f94abd7c4ea47cb61d946286f7e25cf0ec69dc1!/L78"));
assertThat(taxonNode.get("title").asText(), is("Photo of Specimen BMT0009392"));
assertThat(taxonNode.get("darktaxon:plateId").asText(), is("BMT121"));
assertThat(taxonNode.get("darktaxon:specimenId").asText(), is("BMT0009392"));
Expand All @@ -119,9 +119,7 @@ public InputStream get(IRI key) {

assertDescription(taxonNode);

assertThat(taxonNode.get("http://www.w3.org/ns/prov#wasInformedBy").asText(), is("hash://sha256/856ecd48436bb220a80f0a746f94abd7c4ea47cb61d946286f7e25cf0ec69dc1"));

JsonNode jsonNode = taxonNode.get("http://www.w3.org/ns/prov#wasDerivedFrom");
JsonNode jsonNode = taxonNode.get("isDerivedFrom");
assertThat(jsonNode.isArray(), is(true));

ArrayNode arrayNode = (ArrayNode) jsonNode;
Expand Down

0 comments on commit 5c52912

Please sign in to comment.