adding custom metadata fields

120 views
Skip to first unread message

Jamie Jamison

unread,
May 10, 2022, 6:15:19 PM5/10/22
to Dataverse Users Community
I'm helping a patron who would like to add around 8-10 extra custom fields to their sub-dataverse.  

I was able to create a tsv file and found the curl command to load it (<https://guides.dataverse.org/en/latest/admin/metadatacustomization.html?highlight=custom%20metadata>).   If I understand the documentation it looks like I also need to make a Resource Bundle.   How does the resource bundle get loaded?  I didn't see an example of that.

Thank you,

Jamie Jamison
UCLA Dataverse

leo...@g.harvard.edu

unread,
May 11, 2022, 8:42:11 PM5/11/22
to Dataverse Users Community
Hi Jamie,

(it appears that yours is an English language-only configuration - so my answer below is based on that assumption; it's somewhat different otherwise)
You can drop the .properties file into the same location where the properties for the default metadata blocks are installed, under the deployed Dataverse application directory, which is something like .../domain1/dataverse-XXX/WEB-INF/classes/propertyFiles
An obvious problem with this solution is that the file will disappear when you deploy the next version of the application, so it will need to be replaced. I'm looking for a better solution for this myself (i.e., we need a way to be able to install these files in a configurable location outside the deployed dir.). I'll keep you posted. 

best,
-L.A. 

Jamie Jamison

unread,
May 11, 2022, 9:14:42 PM5/11/22
to Dataverse Users Community
This is the only patron with custom fields so I'll remember to replace them when we upgrade.  

Thank you,

Jamie

leo...@g.harvard.edu

unread,
May 12, 2022, 1:11:55 PM5/12/22
to Dataverse Users Community
A quick followup:
Strictly speaking, you don't even need that .properties file, if you are running an English-only installation with no additional language customizations. If the .properties file isn't installed, Dataverse will default to the description labels in the .tsv file itself. If you ever need to change these labels - it's your block, you can change the .tsv and reimport it. 
The only problem with this, as currently implemented - you will be seeing a lot of "properties file not found" warning noise in your log files... 
So, you actually have 3 options to choose from: 
1. Install the .properties file in the application dir. (requires a Payara restart, I believe). 
2. Skip the properties file, and simply ignore the noise in your server log.  
3. Skip the properties file and lower the logging level for edu.harvard.iq.dataverse.ControlledVocabularyValue. 

We are planning to clean up/improve this area going forward - by getting rid of the excessive logging in single-language environments; and by documenting the whole thing more clearly. 

-L.A.

leo...@g.harvard.edu

unread,
May 13, 2022, 1:50:16 PM5/13/22
to Dataverse Users Community
(this issue probably didn't warrant three replies... but, just to be OCD, that directory name example in my first message was missing the "applications" part. so a real life path name will be something like /usr/local/payara5/glassfish/domains/domain1/applications/dataverse-5.10.1/WEB-INF/classes/propertyFiles)

Jamie Jamison

unread,
May 13, 2022, 5:43:23 PM5/13/22
to Dataverse Users Community
I found the WEB-INF classes/propertyFile with no trouble, was assuming the "applications" part.   But I still can't get the custom fields to show up in the GUI.

I'm using (from documentation) to load the tsv file:   curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file myCustomFields.tsv

Nothing appears in the GUI.

Try enabling:   curl -H "X-Dataverse-key:$API_TOKEN" -X POST -H "Content-type:application/json" -d "[\"myCustomFields\"]" http://localhost:8080/api/dataverses/:root/metadatablocks

And get this error:   {"status":"ERROR","message":"Can't find metadata block '\"vsim\"'"}

This is the first time I've tried to do this so I may be missing something obvious.

Jamie Jamison
UCLA Dataverse

leo...@g.harvard.edu

unread,
May 14, 2022, 10:59:43 AM5/14/22
to Dataverse Users Community
Hmm, this just looks like the new block is not in the system somehow (i.e., nothing to do with the .properties file).
Did the /api/admin/datasetfield/load API call actually work? Could you please run it again and post the output it generates? 

Jamie Jamison

unread,
May 16, 2022, 5:45:49 PM5/16/22
to Dataverse Users Community
Tried it again and this time generated an error:
 curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file vsim.tsv
{"status":"ERROR","message":"Error parsing metadata block in DATASETFIELD part, line #4: missing 'watermark' column (#5)"

I'm going to google that error and see what I need to fix.

Sherry Lake

unread,
May 16, 2022, 9:13:35 PM5/16/22
to dataverse...@googlegroups.com
Jamie,

Seems your tsv file is missing fields, columns. 

Send me a copy of your tsv file and I’ll take a look to see how to fixit. 

Sherry Lake

--
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/f23a2515-0536-4cdc-841d-7efc045bc95an%40googlegroups.com.

Jamie Jamison

unread,
May 16, 2022, 10:34:23 PM5/16/22
to Dataverse Users Community
Sherry,

I've been trying to fix the columns for 2 of the custom metadata fields.  I wanted to get 2 working on the test system before doing all 10. I'm attaching my 2 tries below.

Vsim2.tsv is a bit closer but error ""Error parsing metadata block in DATASETFIELD part, line #4: missing 'fieldType' column (#6)  Looks like I'm now missing a column.

Thank you for taking a look,

jamie
vsim.tsv
vsim2.tsv

Sherry Lake

unread,
May 17, 2022, 9:00:05 AM5/17/22
to dataverse...@googlegroups.com
Hi Jamie,

Your tsv file doesn't have all the required columns needed to define a metadata block. 

I have attached an example from the journal metadata block included with Dataverse software.

Each of the columns has info that tells the Dataverse GUI how to display the metadata fields.

So your error message "{"status":"ERROR","message":"Error parsing metadata block in DATASETFIELD part, line #4: missing 'watermark' column (#5)""

was about not having the "watermark" field in your tsv file. 


journals.tsv

leo...@g.harvard.edu

unread,
May 17, 2022, 10:01:48 AM5/17/22
to Dataverse Users Community
Sherry, thanks for stepping in to help with this!
-L.A. 

Jamie Jamison

unread,
May 17, 2022, 8:12:47 PM5/17/22
to Dataverse Users Community
Agreed.  Thank you Sherry.  Took me long enough but I was finally able to correctly setup a tsv file for some test fields.

Jamie

Reply all
Reply to author
Forward
0 new messages