Skip to content

Commit

Permalink
add @id and url as persistent URL #4371
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Oct 11, 2018
1 parent 101bd81 commit 4ca8f38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,9 @@ public String getJsonLd() {
JsonObjectBuilder job = Json.createObjectBuilder();
job.add("@context", "http://schema.org");
job.add("@type", "Dataset");
job.add("@id", this.getDataset().getPersistentURL());
job.add("identifier", this.getDataset().getPersistentURL());
job.add("url", this.getDataset().getPersistentURL());
job.add("name", this.getTitle());
JsonArrayBuilder authors = Json.createArrayBuilder();
for (DatasetAuthor datasetAuthor : this.getDatasetAuthors()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public void testGetJsonLd() throws ParseException {
JsonObject obj = jsonReader.readObject();
assertEquals("http://schema.org", obj.getString("@context"));
assertEquals("Dataset", obj.getString("@type"));
assertEquals("https://doi.org/10.5072/FK2/LK0D1H", obj.getString("@id"));
assertEquals("https://doi.org/10.5072/FK2/LK0D1H", obj.getString("identifier"));
assertEquals("https://doi.org/10.5072/FK2/LK0D1H", obj.getString("url"));
assertEquals("https://schema.org/version/3.3", obj.getString("schemaVersion"));
assertEquals("1955-11-05", obj.getString("dateModified"));
assertEquals("1955-11-05", obj.getString("datePublished"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ public void testExportDataset() throws Exception {
JsonObject json2 = jsonReader2.readObject();
assertEquals("http://schema.org", json2.getString("@context"));
assertEquals("Dataset", json2.getString("@type"));
assertEquals("https://doi.org/myAuthority/myIdentifier", json2.getString("@id"));
assertEquals("https://doi.org/myAuthority/myIdentifier", json2.getString("identifier"));
assertEquals("https://doi.org/myAuthority/myIdentifier", json2.getString("url"));
assertEquals("Darwin's Finches", json2.getString("name"));
assertEquals("Finch, Fiona", json2.getJsonArray("creator").getJsonObject(0).getString("name"));
assertEquals("Birds Inc.", json2.getJsonArray("creator").getJsonObject(0).getString("affiliation"));
Expand Down

0 comments on commit 4ca8f38

Please sign in to comment.