json metadata generation

60 views
Skip to first unread message

Danny

unread,
Mar 9, 2021, 6:04:28 AM3/9/21
to Dataverse Users Community

Dear community,

I’ve been trying to get a bit familiar with the R dataverse package and their use of the native api. Within this package they have a function create_dataset() that uses the native api. The intent of the function is to create a dataset in an existing dataverse much like specified at the native api website of dataverse https://guides.dataverse.org/en/latest/api/native-api.html at ‘create a Dataset in a Dataverse’. Both the website and the R dataverse package state that one needs to have metadata supplied in a JSON file format (or at least use the JSON lay-out). The dataverse native api website shows an example of what all current metadata looks like in a JSON format https://guides.dataverse.org/en/latest/_downloads/dataset-create-new-all-default-fields.json. I was wondering if there is anyway one produces such file using a call to a script of some sort. I would imagine it a tiny bit tedious to create such a JSON file from scratch every time one wants to upload a dataset using a script (whether it is curl, R dataverse package, or python pydataverse). This issue is also filed in https://github.com/IQSS/dataverse-client-r/issues/82 , but currently has no resolution. Wondering if other came across this issue and whether people know of a solution.

Stefan Kasberger

unread,
Mar 9, 2021, 11:18:33 AM3/9/21
to Dataverse Users Community
To work with Dataverse metadata (all types - Dataverses, Datasets and Datafiles), I can recommend using pyDataverse.

Hint: maybe using the CSV templates are helpful to get the data into pyDataverse.

Danny

unread,
Mar 11, 2021, 9:24:02 AM3/11/21
to Dataverse Users Community
Thanks. I do know of the pydataverse package, but as an R user I want to be able to use dataverse through R. I can get it working with some fields (author, description, title) to create a metadata scheme and adjust those field at will through my script https://github.com/IQSS/dataverse-client-r/issues/82#issuecomment-795260194. I'd hoped there would be a helper function to create an entire json file from within a script (without the need for an external template) like the case for initiate_sword_dataset.

Philip Durbin

unread,
Mar 11, 2021, 10:55:49 AM3/11/21
to dataverse...@googlegroups.com
I'm not sure how much this helps since it's Java instead of R but there's a DatasetBuilder class in dataverse-client-java that lets you construct the necessary JSON to create a dataset comfortably from Java:


--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/4992fea5-c62e-4144-a902-ea3df906891an%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages