forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
234 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Initial Support for Dataset Types (Dataset, Software, Workflow) | ||
|
||
Datasets now have types. By default the dataset type will be "dataset" but if you turn on support for additional types, datasets can have a type of "software" or "workflow" as well. For more details see doc/sphinx-guides/source/user/dataset-types.rst and #10517. Please note that this feature is highly experimental. |
82 changes: 82 additions & 0 deletions
82
doc/sphinx-guides/source/_static/api/dataset-create-software.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"datasetType": "software", | ||
"datasetVersion": { | ||
"license": { | ||
"name": "CC0 1.0", | ||
"uri": "http://creativecommons.org/publicdomain/zero/1.0" | ||
}, | ||
"metadataBlocks": { | ||
"citation": { | ||
"fields": [ | ||
{ | ||
"value": "Darwin's Finches", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "title" | ||
}, | ||
{ | ||
"value": [ | ||
{ | ||
"authorName": { | ||
"value": "Finch, Fiona", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "authorName" | ||
}, | ||
"authorAffiliation": { | ||
"value": "Birds Inc.", | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "authorAffiliation" | ||
} | ||
} | ||
], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "author" | ||
}, | ||
{ | ||
"value": [ | ||
{ "datasetContactEmail" : { | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "datasetContactEmail", | ||
"value" : "finch@mailinator.com" | ||
}, | ||
"datasetContactName" : { | ||
"typeClass": "primitive", | ||
"multiple": false, | ||
"typeName": "datasetContactName", | ||
"value": "Finch, Fiona" | ||
} | ||
}], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "datasetContact" | ||
}, | ||
{ | ||
"value": [ { | ||
"dsDescriptionValue":{ | ||
"value": "Darwin's finches (also known as the Galápagos finches) are a group of about fifteen species of passerine birds.", | ||
"multiple":false, | ||
"typeClass": "primitive", | ||
"typeName": "dsDescriptionValue" | ||
}}], | ||
"typeClass": "compound", | ||
"multiple": true, | ||
"typeName": "dsDescription" | ||
}, | ||
{ | ||
"value": [ | ||
"Medicine, Health and Life Sciences" | ||
], | ||
"typeClass": "controlledVocabulary", | ||
"multiple": true, | ||
"typeName": "subject" | ||
} | ||
], | ||
"displayName": "Citation Metadata" | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
doc/sphinx-guides/source/_static/api/dataset-create-software.jsonld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"http://purl.org/dc/terms/title": "Darwin's Finches", | ||
"http://purl.org/dc/terms/subject": "Medicine, Health and Life Sciences", | ||
"http://purl.org/dc/terms/creator": { | ||
"https://dataverse.org/schema/citation/authorName": "Finch, Fiona", | ||
"https://dataverse.org/schema/citation/authorAffiliation": "Birds Inc." | ||
}, | ||
"https://dataverse.org/schema/citation/datasetContact": { | ||
"https://dataverse.org/schema/citation/datasetContactEmail": "finch@mailinator.com", | ||
"https://dataverse.org/schema/citation/datasetContactName": "Finch, Fiona" | ||
}, | ||
"https://dataverse.org/schema/citation/dsDescription": { | ||
"https://dataverse.org/schema/citation/dsDescriptionValue": "Darwin's finches (also known as the Galápagos finches) are a group of about fifteen species of passerine birds." | ||
}, | ||
"datasetType": "software" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Dataset Types | ||
+++++++++++++ | ||
|
||
NOTE: This separate page will be folded into individual pages and removed as the pull request is finalized | ||
|
||
.. contents:: |toctitle| | ||
:local: | ||
|
||
Intro | ||
===== | ||
|
||
Datasets can have a dataset type such as "dataset", "software", or "workflow". | ||
|
||
Enabling Dataset Types | ||
====================== | ||
|
||
Turn on ``dataverse.feature.dataset-types``. See also :ref:`feature-flags`. | ||
|
||
Specifying a Dataset Type When Creating a Dataset | ||
================================================= | ||
|
||
Native API | ||
---------- | ||
|
||
An example JSON file is available at :download:`dataset-create-software.json <../_static/api/dataset-create-software.json>` | ||
|
||
Semantic API | ||
--------------------------------- | ||
|
||
An example JSON-LD file is available at :download:`dataset-create-software.jsonld <../_static/api/dataset-create-software.jsonld>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ User Guide | |
dataset-management | ||
tabulardataingest/index | ||
appendix | ||
dataset-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package edu.harvard.iq.dataverse.api; | ||
|
||
import io.restassured.RestAssured; | ||
import io.restassured.path.json.JsonPath; | ||
import io.restassured.response.Response; | ||
import static jakarta.ws.rs.core.Response.Status.CREATED; | ||
import static jakarta.ws.rs.core.Response.Status.OK; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class DatasetTypesIT { | ||
|
||
@BeforeAll | ||
public static void setUpClass() { | ||
RestAssured.baseURI = UtilIT.getRestAssuredBaseUri(); | ||
} | ||
|
||
@Test | ||
public void testCreateSoftwareDatasetNative() { | ||
Response createUser = UtilIT.createRandomUser(); | ||
createUser.then().assertThat().statusCode(OK.getStatusCode()); | ||
String username = UtilIT.getUsernameFromResponse(createUser); | ||
String apiToken = UtilIT.getApiTokenFromResponse(createUser); | ||
|
||
Response createDataverse = UtilIT.createRandomDataverse(apiToken); | ||
createDataverse.then().assertThat().statusCode(CREATED.getStatusCode()); | ||
String dataverseAlias = UtilIT.getAliasFromResponse(createDataverse); | ||
Integer dataverseId = UtilIT.getDataverseIdFromResponse(createDataverse); | ||
|
||
// String datasetJsonPath = "doc/sphinx-guides/source/_static/api/dataset-create-software.json"; | ||
String jsonIn = UtilIT.getDatasetJson("doc/sphinx-guides/source/_static/api/dataset-create-software.json"); | ||
// System.out.println("native: " + datasetJsonPath); | ||
|
||
Response createSoftware = UtilIT.createDataset(dataverseAlias, jsonIn, apiToken); | ||
createSoftware.prettyPrint(); | ||
createSoftware.then().assertThat() | ||
.statusCode(CREATED.getStatusCode()); | ||
|
||
//TODO: try sending "junk" instead of "software". | ||
|
||
Integer datasetId = UtilIT.getDatasetIdFromResponse(createSoftware); | ||
String datasetPid = JsonPath.from(createSoftware.getBody().asString()).getString("data.persistentId"); | ||
|
||
} | ||
|
||
@Disabled | ||
@Test | ||
public void testCreateSoftwareDatasetSemantic() { | ||
String jsonIn = "doc/sphinx-guides/source/_static/api/dataset-create-software.jsonld"; | ||
System.out.println("semantic: " + jsonIn); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
DataversesIT,DatasetsIT,SwordIT,AdminIT,BuiltinUsersIT,UsersIT,UtilIT,ConfirmEmailIT,FileMetadataIT,FilesIT,SearchIT,InReviewWorkflowIT,HarvestingServerIT,HarvestingClientsIT,MoveIT,MakeDataCountApiIT,FileTypeDetectionIT,EditDDIIT,ExternalToolsIT,AccessIT,DuplicateFilesIT,DownloadFilesIT,LinkIT,DeleteUsersIT,DeactivateUsersIT,AuxiliaryFilesIT,InvalidCharactersIT,LicensesIT,NotificationsIT,BagIT,MetadataBlocksIT,NetcdfIT,SignpostingIT,FitsIT,LogoutIT,DataRetrieverApiIT,ProvIT,S3AccessIT,OpenApiIT,InfoIT | ||
DataversesIT,DatasetsIT,SwordIT,AdminIT,BuiltinUsersIT,UsersIT,UtilIT,ConfirmEmailIT,FileMetadataIT,FilesIT,SearchIT,InReviewWorkflowIT,HarvestingServerIT,HarvestingClientsIT,MoveIT,MakeDataCountApiIT,FileTypeDetectionIT,EditDDIIT,ExternalToolsIT,AccessIT,DuplicateFilesIT,DownloadFilesIT,LinkIT,DeleteUsersIT,DeactivateUsersIT,AuxiliaryFilesIT,InvalidCharactersIT,LicensesIT,NotificationsIT,BagIT,MetadataBlocksIT,NetcdfIT,SignpostingIT,FitsIT,LogoutIT,DataRetrieverApiIT,ProvIT,S3AccessIT,OpenApiIT,InfoIT,DatasetTypesIT |