Skip to content

Commit

Permalink
delete cruft (unused method) IQSS#2243
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Nov 3, 2017
1 parent 6c5f044 commit 8f3083c
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions src/main/java/edu/harvard/iq/dataverse/dataset/DatasetUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,79 +420,4 @@ public static List<DatasetField> getDatasetSummaryFields(DatasetVersion datasetV
return datasetFields;
}

/*
{
"@context": "http://schema.org",
"@type": "Dataset",
"@id": "https://doi.org/10.7910/dvn/icfngt",
"additionalType": "Dataset",
"name": "Replication Data for: Parties, Legislators, and the Origins of Proportional Representation",
"author": [
{
"@type": "Person",
"name": "Gary W. Cox",
"givenName": "Gary W.",
"familyName": "Cox"
},
{
"@type": "Person",
"name": "Jon H. Fiva",
"givenName": "Jon H.",
"familyName": "Fiva"
},
{
"@type": "Person",
"name": "Daniel M. Smith",
"givenName": "Daniel M.",
"familyName": "Smith"
}
],
"datePublished": "2017",
"schemaVersion": "http://datacite.org/schema/kernel-4",
"publisher": {
"@type": "Organization",
"name": "Harvard Dataverse"
},
"provider": {
"@type": "Organization",
"name": "DataCite"
}
}
*/
// 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.isPublished()) {
return "";
}
JsonObjectBuilder job = Json.createObjectBuilder();
job.add("@context", "http://schema.org");
job.add("@type", "Dataset");
job.add("@id", workingVersion.getDataset().getPersistentURL());
job.add("additionalType", "Dataset");
job.add("name", workingVersion.getTitle());
job.add("@context", "http://schema.org");
JsonArrayBuilder authors = Json.createArrayBuilder();
for (DatasetAuthor datasetAuthor : workingVersion.getDatasetAuthors()) {
JsonObjectBuilder author = Json.createObjectBuilder();
String personOrOrganization = datasetAuthor.getName().getValue();
String name = personOrOrganization;
// We are aware of "givenName" and "familyName" but instead of a person it might be an organization such as "Gallup Organization".
author.add("name", name);
authors.add(author);
}
job.add("author", authors);
job.add("datePublished", workingVersion.getPublicationDate());
job.add("schemaVersion", "http://datacite.org/schema/kernel-4");
job.add("publisher", Json.createObjectBuilder()
.add("@type", "Organization")
.add("name", workingVersion.getRootDataverseNameforCitation())
);
job.add("provider", Json.createObjectBuilder()
.add("@type", "Organization")
.add("name", "Dataverse")
);
return job.build().toString();
}

}

0 comments on commit 8f3083c

Please sign in to comment.