ro-crate icon indicating copy to clipboard operation
ro-crate copied to clipboard

Content negotiation for RO-Crate identifier

Open dgarijo opened this issue 1 year ago • 3 comments

Describe the bug Doing:

curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.1 

Returns HTML instead of the contents of https://www.researchobject.org/ro-crate/1.1/ro-crate-metadata.json , which should be the right response in this case.

Also, I think that

curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate 

Should resolve to the latest official version of the RO-Crate spec

Suggested fix Fix the content negotiation in w3id.org.

dgarijo avatar May 09 '24 08:05 dgarijo

Maybe related to #228

dgarijo avatar May 09 '24 08:05 dgarijo

@stain says that https://github.com/perma-id/w3id.org/blob/master/ro/crate/.htaccess does not have content negotiation enabled

dgarijo avatar May 09 '24 08:05 dgarijo

Now that we have Profile Crates in 1.2-DRAFT and also a historical 1.1 RO-Crate we should add this to the w3id so we comply with our own #296 on retrieval!

Note that 1.0 does not have an RO-Crate representation of itself and neither do we have a https://www.researchobject.org/ro-crate/ro-crate-metadata.json so this would for now only be on the versioned URIs. Not sure how to do the latest one for https://w3id.org/ro/crate -- by symlink perhaps? For 1.2-DRAFT (1.2 when released) it's a Detached Crate so it does not matter where it's served from.

stain avatar May 23 '24 21:05 stain

@dgarijo Would you be able to add this content negotiation to w3id?

stain avatar Sep 09 '24 13:09 stain

@stain I have noticed that the jsonld files are inconsistent:

  • Version 1.0 has a file https://www.researchobject.org/ro-crate/1.0/ro-crate-metadata.jsonld
  • Version 1.1 and onward have https://www.researchobject.org/ro-crate/1.1/ro-crate-metadata.json (the ld version gives an error, it's an empty file, maybe some sort of symlink, but does not work for content negotiation).

Can this be made consistent? I will point for now to the json representation. But I believe it should probably be jsonld

dgarijo avatar Sep 10 '24 10:09 dgarijo

Also, version 0.2 and 0.1.0 (why is it not 0.1?) do not have a jsonld file.

dgarijo avatar Sep 10 '24 10:09 dgarijo

Now curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.1 works as intended. With the caveats stated above (it does not work for 1.0 and before)

dgarijo avatar Sep 10 '24 10:09 dgarijo

the jsonld files are inconsistent

This is because the spec changed between 1.0 and 1.1 about the naming of the metadata file. 1.0 requires ro-crate-metadata.jsonld, 1.1+ requires ro-crate-metadata.json - so I think choosing json will be more forward-compatible.

Is it possible to add a special line directing requests for 1.0 to the jsonld instead?

elichad avatar Sep 10 '24 10:09 elichad

it is possible, but maybe to make it cleaner we can just add a json file in the 1.0 spec mirroring the jsonld file. That makes maintenance easier in my opinion.

dgarijo avatar Sep 10 '24 10:09 dgarijo

I think the redirect should go to the jsonld file so it has the correct content-type: application/ld+json from Github pages - there should be symlinks for 1.1 and 1.2, but the reverse symlink is not needed for 1.0, as it does not have the ro-crate-metadata.json specified.

stain avatar Sep 11 '24 23:09 stain

Also, version 0.2 and 0.1.0 (why is it not 0.1?) do not have a jsonld file.

These are 0.x so can remain broken in that respect :) It was not 0.1 as we used semantic versioning on the first one, but then realised we don't want to update permalinks for every typo or small JSON-LD bug.

stain avatar Sep 11 '24 23:09 stain

Ok, I will wait until @elichad makes the JSON-LD available in 1.1+ (https://www.researchobject.org/ro-crate/1.1/ro-crate-metadata.jsonld does not return the right json-ld file). Please ping me and I will do the change

dgarijo avatar Sep 12 '24 08:09 dgarijo

@dgarijo would adding Options +FollowSymLinks to the .htaccess resolve the problem? Like in https://github.com/perma-id/w3id.org/blob/master/.htaccess

elichad avatar Sep 17 '24 16:09 elichad

Actually, I think this is a problem with the ro-crate-metadata.json symlink in 1.1 - neither GitHub nor my file system recognises it as a symlink. The one in 1.2-DRAFT seems to work:

$ curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.1/crate
ro-crate-metadata.json

$ curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.2-DRAFT/crate
{
  "@context": "https://w3id.org/ro/crate/1.2-DRAFT/context",
  "@graph": [...

(tested with /crate as this works with the -DRAFT suffix on the version)

I will fix this symlink and see if that resolves the issue

elichad avatar Sep 17 '24 17:09 elichad

All right, I will wait then

El mar., 17 sept. 2024 7:09 p. m., Eli Chadwick @.***> escribió:

Actually, I think this is a problem with the ro-crate-metadata.json symlink in 1.1 - neither GitHub nor my file system recognises it as a symlink. The one in 1.2-DRAFT seems to work:

$ curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.1/crate ro-crate-metadata.json https://w3id.org/ro/crate/1.1/cratero-crate-metadata.json

$ curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.2-DRAFT/crate { @.": "https://w3id.org/ro/crate/1.2-DRAFT/context", @.": [...

(tested with /crate as this works with the -DRAFT suffix on the version)

I will fix this symlink and see if that resolves the issue

— Reply to this email directly, view it on GitHub https://github.com/ResearchObject/ro-crate/issues/297#issuecomment-2356469638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTIGSLB2YQ2XPI3PNZKZTZXBO3RAVCNFSM6AAAAABHONRND6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJWGQ3DSNRTHA . You are receiving this because you were mentioned.Message ID: @.***>

dgarijo avatar Sep 18 '24 06:09 dgarijo

#361 should fix it on the website side.

@dgarijo when you update the .htaccess can you ensure it goes to

https://www.researchobject.org/ro-crate/specification/$1/ro-crate-metadata.jsonld

not

https://www.researchobject.org/ro-crate/$1/ro-crate-metadata.jsonld

for forward compatibility

elichad avatar Sep 18 '24 13:09 elichad

@stain @elichad: I have done this change: https://github.com/perma-id/w3id.org/pull/4434/files per your request.

dgarijo avatar Sep 26 '24 08:09 dgarijo

I checked and curl -sH "Accept:application/ld+json" -L https://w3id.org/ro/crate/1.1 provides the right serialization

dgarijo avatar Sep 26 '24 08:09 dgarijo