-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update SampleDB example for SampleDB 0.29.1 #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Florian,
The Author property must not be an array. See example: https://www.researchobject.org/ro-crate/specification/1.1/appendix/jsonld.
examples/SampleDB/README.md
Outdated
"@id": "./users/2" | ||
}, | ||
"author": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
author must not be an array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you have multiple values in "mentions"? Does it become an array? I've come to realize that a value in JSON-LD can very well be a string, an object, or an array of string, or an array of object, which to be honest is really painful to deal with properly in the code because it means you always have to check what kind of data you have...
So here I was expecting mentions to be an array, but if you only have one, it's valid to simply have the object with the @id
there directly. My previous comment about the author was also the same, if you have multiple authors, it can become an array.
I guess I'll have to change a bunch of code to accomodate for all these cases.... :/
Yes, it's not the most convenient part of the format for sure, when it comes to parsing. After reading the part of the spec about ro-crate-metadata.json being in compressed form with single-item arrays being being unpacked, I had to do the same. Both implemented a function for doing the unpacking, because I build stuff like mentions and tags as arrays internally when exporting, and added some checks to the import part of SampleDB to handle those unpacked arrays. I hadn't known that before and simply used arrays for all things with (possibly) multiple values, such as |
Interestingly there is this in the RO Crate spec:
(source) So I guess for all attributes where the value is not "text" but an object with properties, we can expect an object OR an array of objects.
Talking about this part? (source)
It's important to see that it is a SHOULD. Therefore, I think it's perfectly fine to always use an array, even if there is only one Author for instance, in order to make our code leaner. But we should support reading the array and not array form. But we don't need to support the string form, as we can always expect to find at least an object with an |
I have recreated the SampleDB example with the current release. The example now contains the flexible object metadata as
variableMeasured
entries.