Skip to content

Commit

Permalink
fix a number of issues (listed below) IQSS#3793 IQSS#2243
Browse files Browse the repository at this point in the history
- only show published versions
- show URL to DOI dynamically (was hard coded)
- show publication date
- show correct publisher
- show correct provider
  • Loading branch information
pdurbin committed Nov 1, 2017
1 parent 5ad88fc commit 2cc958d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/java/edu/harvard/iq/dataverse/dataset/DatasetUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,16 @@ public static List<DatasetField> getDatasetSummaryFields(DatasetVersion datasetV
}
}
*/
// TODO: Make this more performant by writing the output to the database or a file?
public static String getJsonLd(DatasetVersion workingVersion) {
// We show published datasets only for "datePublished" field below.
if (workingVersion.isDraft()) {
return "";
}
JsonObjectBuilder job = Json.createObjectBuilder();
job.add("@context", "http://schema.org");
job.add("@type", "Dataset");
// FIXME
job.add("@id", "https://doi.org/10.7910/dvn/icfngt");
job.add("@id", workingVersion.getDataset().getPersistentURL());
job.add("additionalType", "Dataset");
job.add("name", workingVersion.getTitle());
job.add("@context", "http://schema.org");
Expand All @@ -480,6 +484,7 @@ public static String getJsonLd(DatasetVersion workingVersion) {
String firstName = null;
String lastName = null;
if (parts.length == 1) {
// TODO: consider adding "Thing" for the "@type" explicitly here.
name = personOrOrganization;
} else {
author.add("@type", "Person");
Expand All @@ -493,18 +498,15 @@ public static String getJsonLd(DatasetVersion workingVersion) {
authors.add(author);
}
job.add("author", authors);
// FIXME
job.add("datePublished", "2017");
job.add("datePublished", workingVersion.getProductionDate());
job.add("schemaVersion", "http://datacite.org/schema/kernel-4");
job.add("publisher", Json.createObjectBuilder()
.add("@type", "Organization")
// FIXME
.add("name", "Harvard Dataverse")
.add("name", workingVersion.getRootDataverseNameforCitation())
);
job.add("provider", Json.createObjectBuilder()
.add("@type", "Organization")
// FIXME
.add("name", "DataCite")
.add("name", "Dataverse")
);
return job.build().toString();
}
Expand Down

0 comments on commit 2cc958d

Please sign in to comment.