Also, there is one reference that needs an update, FEP-1570: The FEP Ontology Process. The correct name of this proposal is FEP-2e40: The FEP Vocabulary Extension Process, and I recently updated the title of SocialHub discussion topic to reflect that.
These two PRs were merged, but in testing the live deployed w3id prefix, i found that i had copy-pasted the wrong htaccess from an outdated copy. hence, the following two PRs:
If we are going to switch to sequential FEP IDs as discussed in the following issue, I think it would be desirable to complete the transition before stabilizing any IRIs under the new namespace.
That’s fair, but really that’s a separate and larger concern.
In other news: the W3ID prefix is live already, and seems to work for all the test cases I can throw at it. If anyone can come up with test cases which fail, I’ll try to fix the mapping to handle those cases. Similarly, if anyone has any redirects that they would like to see handled but aren’t currently handled, let me know and I’ll try to accommodate those as well.
$ curl https://w3id.org/fep/888d -H 'Accept: application/ld+json'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://codeberg.org/fediverse/fep/raw/branch/main/fep/888d/context.jsonld">here</a>.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at w3id.org Port 443</address>
</body></html>
$ curl https://w3id.org/fep/888d/SomeType -H 'Accept: application/ld+json'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://codeberg.org/fediverse/fep/raw/branch/main/fep/888d/context.jsonld">here</a>.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at w3id.org Port 443</address>
</body></html>
Following that redirect is going to retrieve a Markdown file rather than a JSON-LD context. My browser is reporting:
jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.
Could the cause be “a non-JSON response” rather than CORS (given there does seem to be a CORS header in the response)?
This appears to be a Codeberg issue… The response from raw.codeberg.org is giving Content-Type: text/plain; charset=utf8 instead of the correct application/ld+json. Examining a context document hosted on GitHub seems to work, though:
Note that GitHub returned a content-type: application/ld+json header, as well as an access-control-allow-origin: * header.
Unfortunately, I’m not sure what the appropriate resolution here might be. The most straightforward thing to do is to have Codeberg add a MIME type for .jsonld to be mapped to application/ld+json at their server level. It appears they can set a mapping in their Gitea app.ini config file by using [repository.mimetype_mapping]:
No guarantees yet, but it seems that I will probably have to change to https://raw.codeberg.page/fediverse/fep/fep/$1/context.jsonld to solve at least the CORS issue.
The Codeberg Pages issue seems to still be unresolved.
I am in the meantime thinking about supporting content negotiation with the .htaccess redirect rules. FEP-0391 has definitions and RDF schema for two properties (inReplyToProof and contextProof) which are available in Turtle, RDF/XML, and JSON-LD. I think it should be possible to update the mapping to support such a use case, with mild-to-moderate effort.
Two PRs implementing support for proper term definitions as JSON-LD, RDF/XML, and/or Turtle ontologies/schemas. This should be the last thing before the FEP can hopefully be pushed to FINAL status.
A folder within the FEP’s directory should be used to provide additional documentation for the term, such as ontology or schema definitions via JSON-LD, RDF/XML, and/or Turtle.
Is this sub-folder REQUIRED when using paths?
I added context.jsonld document to FEP-ef61 folder, but it doesn’t seem to work in JSON-LD playground. The gateways property in actor example is parsed as a blank node.
Oh interesting, FEP-c390 example is working now. FEP-c390 doesn’t have a sub-folder, but it has a file with the same name as the defined term, placed alongside context.jsonld document.
no, it’s just a recommended best practice (“should”). i don’t think that property names are required to resolve, but if they do, the .htaccess file supports mapping terms to RDF serializations based on content negotiation.
i’m not sure why or when json-ld playground examples work, but that would be a separate concern.
The problem was caused by an error in context.jsonld. I fixed it and now JSON-LD playground parses documents correctly. Also, https://w3id.org/fep/ef61/gateways resolves to the text file, as expected.
More or less! The last remaining concern I have is that ontology definition is still a little awkward because you don’t have a standardized way/option to package the ontology in a single file (i.e. using #property instead of /property) – the RDF-supporting .htaccess rules currently only work on a per-property basis.
The blockers to doing that:
We need a standardized name/path to recommend FEP authors use. Something like ontology.owl or ontology.jsonld or so on. BUT…
There isn’t a good way to do content negotiation for ontology files. Well, sure, in theory you could say that Accept: text/turtle on https://w3id.org/fep/xxxx should return the ontology. That much is straightforward. The showstopping problem is that we already use application/ld+json to point to the context file and not the ontology document. I’m not aware of how this is generally handled or resolved, what the best practices might be. Off the top of my head, this seems to be what application/ld+json; profile="http://www.w3.org/ns/json-ld#context" is intended to solve… but I am unsure of how the wider JSON-LD ecosystem handles or fails to handle that profile parameter. It feels like potentially fragile behavior to say that the requester must specifically request the context profile and not just jsonld. But I could be wrong, this might actually be the correct intended solution.