Skip to content

Commit 26fadaa

Browse files
authored
Merge pull request #11192 from mjlassila/mjlassila/migration-api-doc-improvements
Dataset Migration API documentation improvements
2 parents 8353b85 + bb3a099 commit 26fadaa

3 files changed

Lines changed: 58 additions & 7 deletions

File tree

doc/sphinx-guides/source/_static/api/dataset-migrate.jsonld

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
{
22
"citation:depositor": "Admin, Dataverse",
33
"title": "Test Dataset",
4+
"socialscience:collectionMode": [
5+
"demonstration"
6+
],
47
"subject": "Computer and Information Science",
8+
"geospatial:geographicCoverage": [
9+
{
10+
"geospatial:otherGeographicCoverage": "Cambridge"
11+
},
12+
{
13+
"geospatial:otherGeographicCoverage": "Massachusetts"
14+
}
15+
],
516
"author": {
617
"citation:authorName": "Admin, Dataverse",
718
"citation:authorAffiliation": "GDCC"
819
},
20+
"kindOfData": "demonstration data",
21+
"citation:keyword": [
22+
{
23+
"citation:keywordValue": "first keyword"
24+
},
25+
{
26+
"citation:keywordValue": "second keyword"
27+
}
28+
],
929
"dateOfDeposit": "2020-10-08",
1030
"citation:distributor": {
1131
"citation:distributorName": "Demo Dataverse Repository",
@@ -35,5 +55,9 @@
3555
"title": "http://purl.org/dc/terms/title",
3656
"citation": "https://dataverse.org/schema/citation/",
3757
"dvcore": "https://dataverse.org/schema/core#",
38-
"schema": "http://schema.org/"
39-
}}
58+
"schema": "http://schema.org/",
59+
"geospatial": "dataverse.siteUrl/schema/geospatial#",
60+
"socialscience": "dataverse.siteUrl/schema/socialscience#",
61+
"kindOfData": "http://rdf-vocabulary.ddialliance.org/discovery#kindOfData"
62+
}
63+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare option output:method "json";
2+
3+
let $parameters:={ 'method': 'json' }
4+
for $record in /json
5+
let $metadata:=$record/ore_003adescribes
6+
7+
8+
let $json:=
9+
<json type="object">
10+
{$metadata/*}
11+
{$record/_0040context}
12+
</json>
13+
14+
15+
return if ($metadata) then
16+
file:write("converted.json",$json, $parameters)

doc/sphinx-guides/source/developers/dataset-migration-api.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ The Dataverse software includes several ways to add Datasets originally created
55

66
This experimental migration API offers an additional option with some potential advantages:
77

8-
* metadata can be specified using the json-ld format used in the OAI-ORE metadata export
9-
* existing publication dates and PIDs are maintained (currently limited to the case where the PID can be managed by the Dataverse software, e.g. where the authority and shoulder match those the software is configured for)
10-
* updating the PID at the provider can be done immediately or later (with other existing APIs)
11-
* adding files can be done via the standard APIs, including using direct-upload to S3
8+
* Metadata can be specified using the json-ld format used in the OAI-ORE metadata export. Please note that the json-ld generated by OAI-ORE metadata export is not directly compatible with the Migration API. OAI-ORE export nests resource metadata under :code:`ore:describes` wrapper and Dataset Migration API requires that metadata is on the root level. Please check example file below for reference.
9+
10+
* If you need a tool to convert OAI-ORE exported json-ld into a format compatible with the Dataset Migration API, or if you need to generate compatible json-ld from sources other than an existing Dataverse installation, the `BaseX <http://basex.org>`_ database engine, used together with the XQuery language, provides an efficient solution. Please see example script :download:`transform-oai-ore-jsonld.xq <../_static/api/transform-oai-ore-jsonld.xq>` for a simple conversion from exported OAI-ORE json-ld to a Dataset Migration API -compatible version.
11+
12+
* Existing publication dates and PIDs are maintained (currently limited to the case where the PID can be managed by the Dataverse software, e.g. where the authority and shoulder match those the software is configured for)
13+
14+
* Updating the PID at the provider can be done immediately or later (with other existing APIs).
15+
16+
* Adding files can be done via the standard APIs, including using direct-upload to S3.
1217

1318
This API consists of 2 calls: one to create an initial Dataset version, and one to 'republish' the dataset through Dataverse with a specified publication date.
1419
Both calls require super-admin privileges.
@@ -31,7 +36,13 @@ To import a dataset with an existing persistent identifier (PID), the provided j
3136
3237
curl -H X-Dataverse-key:$API_TOKEN -X POST $SERVER_URL/api/dataverses/$DATAVERSE_ID/datasets/:startmigration --upload-file dataset-migrate.jsonld
3338
34-
An example jsonld file is available at :download:`dataset-migrate.jsonld <../_static/api/dataset-migrate.jsonld>` . Note that you would need to replace the PID in the sample file with one supported in your Dataverse instance.
39+
An example jsonld file is available at :download:`dataset-migrate.jsonld <../_static/api/dataset-migrate.jsonld>` . Note that you would need to replace the PID in the sample file with one supported in your Dataverse instance.
40+
41+
You also need to replace the :code:`dataverse.siteUrl` in the json-ld :code:`@context` with your current Dataverse site URL. This is necessary to define a local URI for metadata terms originating from community metadata blocks (in the case of the example file, from the Social Sciences and Humanities and Geospatial blocks).
42+
43+
Currently, as of Dataverse 6.5 and earlier, community metadata blocks do not assign a default global URI to the terms used in the block in contrast to citation metadata, which has global URI defined.
44+
45+
3546

3647
Publish a Migrated Dataset
3748
--------------------------

0 commit comments

Comments
 (0)