diff --git a/src/js/models/metadata/eml211/EML211.js b/src/js/models/metadata/eml211/EML211.js
index 65c2a69ff..5cebdb0aa 100644
--- a/src/js/models/metadata/eml211/EML211.js
+++ b/src/js/models/metadata/eml211/EML211.js
@@ -86,6 +86,7 @@ define([
methods: new EMLMethods(), // An EMLMethods objects
project: null, // An EMLProject object,
annotations: null, // Dataset-level annotations
+ canonicalDataset: null,
dataSensitivityPropertyURI:
"http://purl.dataone.org/odo/SENSO_00000005",
nodeOrder: [
@@ -143,6 +144,13 @@ define([
this.set("synced", true);
});
+ this.stopListening(this, "change:canonicalDataset");
+ this.listenTo(
+ this,
+ "change:canonicalDataset",
+ this.updateCanonicalDataset,
+ );
+
//Create a Unit collection
if (!this.units.length) this.createUnits();
},
@@ -160,6 +168,17 @@ define([
);
},
+ updateCanonicalDataset() {
+ let uri = this.get("canonicalDataset");
+ uri = uri?.length ? uri[0] : null;
+ let annotations = this.get("annotations");
+ if (!annotations) {
+ annotations = new EMLAnnotations();
+ this.set("annotations", annotations);
+ }
+ annotations.updateCanonicalDataset(uri);
+ },
+
/*
* Maps the lower-case EML node names (valid in HTML DOM) to the camel-cased EML node names (valid in EML).
* Used during parse() and serialize()
@@ -734,6 +753,16 @@ define([
}
}
+ // Once all the nodes have been parsed, check if any of the annotations
+ // make up a canonical dataset reference
+ const annotations = modelJSON["annotations"];
+ if (annotations) {
+ const canonicalDataset = annotations.getCanonicalURI();
+ if (canonicalDataset) {
+ modelJSON["canonicalDataset"] = canonicalDataset;
+ }
+ }
+
return modelJSON;
},
diff --git a/src/js/templates/metadata/metadataOverview.html b/src/js/templates/metadata/metadataOverview.html
index a8f117c8b..9a8c46ace 100644
--- a/src/js/templates/metadata/metadataOverview.html
+++ b/src/js/templates/metadata/metadataOverview.html
@@ -94,3 +94,11 @@
Alternate Identifiers
+
+
+
Canonical Dataset
+
If this dataset is essentially a duplicate of a version
+ stored elsewhere, provide the ID of the original dataset here. This must be a
+ DOI or URL
+
+
diff --git a/src/js/views/metadata/EML211View.js b/src/js/views/metadata/EML211View.js
index 05eba027a..0a08961ac 100644
--- a/src/js/views/metadata/EML211View.js
+++ b/src/js/views/metadata/EML211View.js
@@ -302,6 +302,13 @@ define([
);
$(overviewEl).find(".altids").append(altIdsEls);
+ // Canonical Identifier
+ const canonicalIdEl = this.createBasicTextFields(
+ "canonicalDataset",
+ "Add a new canonical identifier",
+ );
+ $(overviewEl).find(".canonical-id").append(canonicalIdEl);
+
//Usage
//Find the model value that matches a radio button and check it
// Note the replace() call removing newlines and replacing them with a single space
@@ -1909,7 +1916,7 @@ define([
.addClass("basic-text");
textRow.append(input.clone().val(value));
- if (category != "title")
+ if (category !== "title" && category !== "canonicalDataset")
textRow.append(
this.createRemoveButton(
null,
@@ -1922,7 +1929,11 @@ define([
textContainer.append(textRow);
//At the end, append an empty input for the user to add a new one
- if (i + 1 == allModelValues.length && category != "title") {
+ if (
+ i + 1 == allModelValues.length &&
+ category !== "title" &&
+ category !== "canonicalDataset"
+ ) {
var newRow = $(
$(document.createElement("div")).addClass("basic-text-row"),
);
@@ -2006,7 +2017,12 @@ define([
}
//Add another blank text input
- if ($(e.target).is(".new") && value != "" && category != "title") {
+ if (
+ $(e.target).is(".new") &&
+ value != "" &&
+ category != "title" &&
+ category !== "canonicalDataset"
+ ) {
$(e.target).removeClass("new");
this.addBasicText(e);
}
@@ -2036,12 +2052,12 @@ define([
allBasicTexts = $(
".basic-text.new[data-category='" + category + "']",
);
-
//Only show one new row at a time
if (allBasicTexts.length == 1 && !allBasicTexts.val()) return;
else if (allBasicTexts.length > 1) return;
//We are only supporting one title right now
- else if (category == "title") return;
+ else if (category === "title" || category === "canonicalDataset")
+ return;
//Add another blank text input
var newRow = $(document.createElement("div")).addClass(