Skip to content
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

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

FlorianRhiem
Copy link
Contributor

I have recreated the SampleDB example with the current release. The example now contains the flexible object metadata as variableMeasured entries.

Copy link
Contributor

@NicolasCARPi NicolasCARPi left a 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.

"@id": "./users/2"
},
"author": [
Copy link
Contributor

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

@FlorianRhiem FlorianRhiem marked this pull request as draft August 22, 2024 10:27
@FlorianRhiem FlorianRhiem marked this pull request as ready for review August 22, 2024 13:16
Copy link
Contributor

@NicolasCARPi NicolasCARPi left a 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.... :/

@FlorianRhiem
Copy link
Contributor Author

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 variableMeasured or author.

@NicolasCARPi
Copy link
Contributor

Interestingly there is this in the RO Crate spec:

To simplify processing and avoid confusion with string values, the RO-Crate JSON-LD Context requires URIs and entity references to be given in the form "author": {"@id": "http://example.com/alice"}, even where Schema.org for some properties otherwise permit shorter forms like "author": "http://example.com/alice".

(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.

After reading the part of the spec about ro-crate-metadata.json being in compressed form with single-item arrays being being unpacked

Talking about this part? (source)

Multiple values and references can be represented using JSON arrays, as exemplified in hasPart above; however as the RO-Crate JSON-LD is in compacted form, any single-element arrays like "author": [{"@id": "#alice"}] SHOULD be unpacked to a single value like "author": {"@id": "#alice"}.

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 @id in there.

@NicolasCARPi NicolasCARPi merged commit 89b2a92 into TheELNConsortium:master Aug 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants