Skip to content

Commit

Permalink
Update labeling for CPFs
Browse files Browse the repository at this point in the history
- Rename Constellation to CPFs
- Add labeling and tooltip
  • Loading branch information
glassjoseph committed May 2, 2022
1 parent 9ca1db4 commit 83e0adb
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 36 deletions.
30 changes: 15 additions & 15 deletions src/org/snaccooperative/exporters/SNACConstellationItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ public SNACConstellationItem(
}

switch (snacField) {
case "id":
case "snac cpf id":
try {
int id = Integer.parseInt(cellValue);
con.setID(id);
} catch (NumberFormatException e) {
}
continue;

case "entity type":
case "cpf type":
Term entityTypeTerm = createEntityTypeTerm(cellValue);

if (entityTypeTerm == null) {
Expand All @@ -104,9 +104,9 @@ public SNACConstellationItem(

continue;

case "date":
// find and add required associated date type in this row
String dateTypeColumn = schema.getReverseColumnMappings().get("date type");
case "exist date":
// find and add required associated exist date type in this row
String dateTypeColumn = schema.getReverseColumnMappings().get("exist date type");

if (dateTypeColumn == null) {
logger.error("no date type column found");
Expand Down Expand Up @@ -135,7 +135,7 @@ public SNACConstellationItem(

continue;

case "date type": // queried alongside "date"
case "exist date type": // queried alongside "exist date"
continue;

case "subject":
Expand Down Expand Up @@ -250,7 +250,7 @@ public SNACConstellationItem(

continue;

case "external related cpf":
case "external related cpf url":
SameAs sameAs = new SameAs();
sameAs.setURI(cellValue);
sameAs.setOperation("insert");
Expand Down Expand Up @@ -292,13 +292,13 @@ public SNACConstellationItem(
case "resource role": // queried alongside "resource id"
continue;

case "related cpf id":
case "related cpf snac id":
ConstellationRelation cpfRelation = new ConstellationRelation();
cpfRelation.setSourceConstellation(con.getID());
cpfRelation.setTargetConstellation(Integer.parseInt(cellValue));

// Get Relation Type.
String cpfRelationTypeColumn = schema.getReverseColumnMappings().get("related cpf relation type");
String cpfRelationTypeColumn = schema.getReverseColumnMappings().get("cpf to cpf relation type");

if (cpfRelationTypeColumn != null) {
String cpfRelationType = getCellValueForRowByColumnName(project, row, cpfRelationTypeColumn);
Expand All @@ -309,7 +309,7 @@ public SNACConstellationItem(
cpfRelations.add(cpfRelation);
continue;

case "related cpf relation type": // Queried alongside related cpf id
case "cpf to cpf relation type": // Queried alongside related cpf snac id
break;

default:
Expand Down Expand Up @@ -367,11 +367,11 @@ public String getPreviewText() {
String snacField = snacText.toLowerCase();

switch (snacField) {
case "id":
case "snac cpf id":
preview += snacText + ": " + _constellation.getID() + "\n";
break;

case "entity type":
case "cpf type":
Term previewTerm = _constellation.getEntityType();
if (previewTerm != null) {
preview += snacText + ": " + previewTerm.getTerm() + " (" + previewTerm.getID() + ")\n";
Expand All @@ -382,7 +382,7 @@ public String getPreviewText() {
preview += snacText + ": " + _constellation.getNameEntries() + "\n";
break;

case "date":
case "exist date":
preview += snacText + ": " + _constellation.getDateList() + "\n";
break;

Expand Down Expand Up @@ -411,11 +411,11 @@ public String getPreviewText() {
preview += snacText + ": " + _constellation.getSources() + "\n";
break;

case "external related cpf":
case "external related cpf url":
preview += snacText + ": " + _constellation.getSameAsRelations() + "\n";
break;

case "related cpf id":
case "related cpf snac id":
preview += snacText + ": " + _constellation.getRelations() + "\n";
break;

Expand Down
1 change: 1 addition & 0 deletions src/resources/module/langs/translation-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"snac-extension/upload-to-snac": "Upload to SNAC",
"snac-schema/copy-reference": "copy",
"snac-schema/dialog-explanation": "The SNAC schema below specifies how your tabular data will be transformed into SNAC Resources or CPFs. You can drag and drop the column names below in most input boxes: for each row, entries will be created or updated with the values in these columns. Unmapped fields will be ignored.",
"snac-schema/dialog-explanation2": "<p>Note: External Related CPF URLs are limited to those found in <a href=\"https://tinyurl.com/2s3wjftd \" target=\"_blank\">this list</a> The URL should be based on the Formatter template in the linked document.</p>",
"snac-schema/discard-button": "Discard changes",
"snac-schema/discard-schema-changes-alt": "Discard the changes made to the schema.",
"snac-schema/items-preview-tab-header": "Preview",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div id="schema-alignment-tabs-schema">
<div bind="schemaHeader">
<p class="body-text" bind="dialogExplanation"></p>
<p class="body-text" bind="dialogExplanation2"></p>
<div class="schema-alignment-dialog-columns-area" bind="columnsArea">
</div>
</div>
Expand Down
39 changes: 20 additions & 19 deletions src/resources/module/scripts/dialogs/schema-alignment-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,25 @@ SNACSchemaAlignmentDialog.getSNACModel = function() {
];

this.SNACConstellationModel = [
{ name: "Entity Type", required: true, tooltip: "The entity type (person, corporateBody, family)" },
{ name: "ID", required: false, tooltip: "SNAC ID" },
{ name: "Name Entry", required: false, tooltip: "Name Entry" },
{ name: "Date", required: false, tooltip: "Date" },
{ name: "Date Type", required: false, tooltip: "Date Type (Birth, Death)" },
{ name: "Subject", required: false, tooltip: "Subject" },
{ name: "Place", required: false, tooltip: "Place" },
{ name: "Place Role", required: false, tooltip: "Place Role (Birth, Death, Residence, Citizenship)" },
{ name: "Occupation", required: false, tooltip: "Occupation" },
{ name: "Activity", required: false, tooltip: "Activity" },
{ name: "BiogHist", required: false, tooltip: "BiogHist" },
{ name: "External Related CPF", required: false, tooltip: "The URL to this entity in another identity authority such as wikiData or VIAF, aka 'SameAs Relation'" },
{ name: "Resource ID", required: false, tooltip: "The SNAC Resource ID for the connected resource" },
{ name: "Resource Role", required: false, tooltip: "The role of this Constellation with the Resource (creatorOf, referencedIn, editorOf, contributorOf)" },
{ name: "Source Citation", required: false, tooltip: "Source citation" },
{ name: "Source Citation URL", required: false, tooltip: "The URL for this citation" },
{ name: "Source Citation Found Data", required: false, tooltip: "Data as found to be cited" },
{ name: "Related CPF ID", required: false, tooltip: "SNAC ID of related CPF entity" },
{ name: "Related CPF relation type", required: false, tooltip: "Type of CPF relation (associatedWith, correspondedWith, etc)" }
{ name: "CPF Type", required: true, tooltip: "Type of CPF entity. Possible values are: corporateBody, person, family" },
{ name: "SNAC CPF ID", required: false, tooltip: "SNAC identifier for the CPF entity. Leave blank if the CPF is NOT in SNAC." },
{ name: "Name Entry", required: false, tooltip: "Preferred Name Entry of the CPF entity." },
{ name: "Date", required: false, tooltip: "Exist Date or Dates of the CPF entity." },
{ name: "Date Type", required: false, tooltip: "Type of Exist Date. The following values may be used: Active, Birth, Death, Establishment, Disestablishment" },
{ name: "Subject", required: false, tooltip: "Subject term associated with the CPF entity. Repeatable in relation to entity. " },
{ name: "Place", required: false, tooltip: "Place name associated with the CPF entity. Repeatable in relation to entity." },
{ name: "Place Role", required: false, tooltip: "Role of the place in relation to the CPF entity. The following values may be used: Birth, Death, Residence" },
{ name: "Occupation", required: false, tooltip: "Occupation term associated with the CPF entity. Repeatable in relation to entity." },
{ name: "Activity", required: false, tooltip: "Activity term associated with the CPF entity. Repeatable in relation to entity." },
{ name: "BiogHist", required: false, tooltip: "Biography or History note associated with the CPF entity. By exception, the note is encoded in XML based on a simplified version of the <biogHist> element in EAC-CPF. Biography or History note associated with the CPF entity. By exception, the note is encoded in XML based on a simplified version of the <biogHist> element in EAC-CPF." },
{ name: "External Related CPF URL", required: false, tooltip: "URL to a description of the CPF entity in an external authority. Such links are limited to those found in https://docs.google.com/spreadsheets/d/1R2kX5yyKd_jsOGRifgNd18xDRNi0AiY193NO6msv7t8/edit#gid=0 The URL should be based on the Formatter template in the linked document. Repeatable in relation to entity" },
{ name: "Resource ID", required: false, tooltip: "SNAC ID for a related Resource in SNAC." },
{ name: "Resource Role", required: false, tooltip: "Role of the CPF entity in relation to the Resource. The following values may be used: contributorOf, creatorOf, editorOf, referencedIn"},
{ name: "Source Citation", required: false, tooltip: "Text citation for a source used in describing the CPF entity." },
{ name: "Source Citation URL", required: false, tooltip: "URL, if available, for the Source Citation." },
{ name: "Source Citation Found Data", required: false, tooltip: "Information found in the Source that is evidence used in the description of the CPF entity." },
{ name: "Related CPF SNAC ID", required: false, tooltip: "SNAC ID of a CPF entity in SNAC related to the CPF entity. Repeatable in relation to entity." },
{ name: "CPF to CPF Relation Type", required: false, tooltip: "Nature of the relation of the CPF entity with the related CPF entity. The following values may be used: associatedWith, correspondedWith" }
];

this.SNACResourceNames = this.SNACResourceModel.map(x => x.name);
Expand Down Expand Up @@ -215,6 +215,7 @@ SNACSchemaAlignmentDialog.setUpTabs = function() {
var schemaTab = $(DOM.loadHTML("snac", "scripts/schema-alignment-tab.html")).appendTo(this._schemaPanel);
var schemaElmts = this._schemaElmts = DOM.bind(schemaTab);
schemaElmts.dialogExplanation.text($.i18n('snac-schema/dialog-explanation'));
schemaElmts.dialogExplanation2.html($.i18n('snac-schema/dialog-explanation2'));
schemaElmts.saveButton
.text($.i18n('snac-schema/save-button'))
.attr('title', $.i18n('snac-schema/save-schema-alt'))
Expand Down
5 changes: 3 additions & 2 deletions src/resources/module/scripts/schema-alignment-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
<button class="button button-primary" bind="discardButton"></button>
</div>
<p class="panel-explanation" bind="dialogExplanation"></p>
<p class="panel-explanation" bind="dialogExplanation2"></p>
<div style="clear: right"></div>

<div id="snac-radio-buttons-container" style = "display: flex;">
<!-- Adding radio buttons to switch back and forth between resource and constellation -->
<div id="uploadingRadio" style="padding-left: 20px;">
<p>Uploading: </p>
<input type="radio" name="uploadingGroup" value="resource" id="uploadingResourceButton" checked="checked"> Resource<br>
<input type="radio" name="uploadingGroup" value="constellation" id="uploadingConstellationButton"> Constellation<br>
<input type="radio" name="uploadingGroup" value="resource" id="uploadingResourceButton" checked="checked"> Resources<br>
<input type="radio" name="uploadingGroup" value="constellation" id="uploadingConstellationButton"> CPFs<br>
</div>
</div>

Expand Down

0 comments on commit 83e0adb

Please sign in to comment.