datatools icon indicating copy to clipboard operation
datatools copied to clipboard

Why marshal the Context in codemeta2cff?

Open broeder-j opened this issue 1 year ago • 1 comments

Hi, overall thanks for your nice work. I tried out the codemeta2cff.

In my codemeta files @context is an array (can be nested in general and not a simple string). which fails, since codemeta.go assumes it to be a string.

I was wondering why you need to parse the @context part at all since it is not represented in the Citation.cff?

broeder-j avatar Oct 14 '22 07:10 broeder-j

Good Morning, thanks for bringing this up. The short answer is datatools has grown largely around Caltech Library's data practices. We've use the "@context" to help identify when the codemeta.json version. Our Go struct is modeled after the JSON generated at https://codemeta.github.io/codemeta-generator/. As a result I was not aware that I should support "@context" as an array until you pointed it out. Thank you.

In reading Codemeta Paper the text defining "context" seems to suggest singular and the example shows an array. The JSON-LD docs I've read appear ambigous too.

If I use the array example form from the codemetar paper in my codemeta.json for datatools and tried to validate it in the validator. It throughs an error,

 @context must be "https://doi.org/10.5063/schema/codemeta-2.0", not ["http://purl.org/codemeta/2.0","http://schema.org"]

I like the idea that is links to a DOI because that is very specific. I am open to supporting more variation but don't have time right now to code the more complex solution. What ever the codemeta tooling produces needs to validate as our patrons and colleagues expect that when they create their own codemeta.json files.

I've flagged this as a bug/help wanted and would am very open to pull requests if you or someone else is inclined.

All the best,

Robert

rsdoiel avatar Oct 14 '22 17:10 rsdoiel