-
Notifications
You must be signed in to change notification settings - Fork 95
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
Simplify and specify REST API format (JSKOS) #152
Comments
Thanks for your input @nichtich ! I agree with the general principle, but JSKOS didn't exist at the time the API was started and we had to invent our own conventions, balancing between the needs of web developers who are aware of only JSON, and making everything parsable as JSON-LD. What we have done is that each method returns a result that is "as simple as possible" when interpreted as plain JSON, and also contains a JSON-LD context appropriate for that response. We have also tried to verify that when this JSON-LD response is interpreted as RDF triples, the result is a subset of the triples in the original dataset (i.e. round-tripping should work). So we don't have one big JSON-LD context like JSKOS, but separate contexts for each method and these are returned inline, not via a link. Your example seems to be from the What we could perhaps do is to use the JSKOS context for the data method instead and see if it affects the result. I'm just worried about breaking API compatibility - there might be API users out there that rely on the current JSON serialization (e.g. we use expanded term definition to express language tags, instead of language maps as you suggest). So what to do? At some point publish a REST API v2 that uses JSKOS instead of the current (varying) contexts? |
That's exactly why a specified JSON-LD profile is necessary. The current output format is not documented, so nobody can rely on the current JSON serialization. Creating a REST API v2 in parallel to the existing v1 may be easier to implement and better for experimenting - for instance we could pass every request to both API versions, expand both JSON-LD to RDF triples and test that both graphs are identical. As far as I understand, the |
Only for the As mentioned above the I think JSKOS is definitely a good starting point for REST API v2 if we start implementing one. |
thanks, I see. The current JSON format differs from JSKOS at some points (of course) - where is the best place to compare both and to raise questions? For instance I don't understand why |
The API has grown organically over time and the design of many methods have been at least somewhat affected by the requirements of the Skosmos web interface, which makes use of its own API for many AJAX-y things. What each method returns is based on some idea of a use case for it (sometimes the Skosmos UI, sometimes an external API client).
I don't have any suggestions - this issue tracker is probably not the best place though :) Maybe a wiki somewhere? I think it would help if there existed also an API spec with methods/operations that can be performed on a SKOS dataset. So one level up from JSKOS. Any plans for that?
I see two main differences:
Agreed this is not very elegant. This is basically for the Skosmos web UI, which differentiates between concept URIs in the concept scheme's main namespace (for which shorter URLs can be used) and other URIs. In case of a URI that can be shortened, the
Yes, I can see that you're using boolean values for the same properties, e.g. narrower. Seems clever. But doesn't this cause problems for a naïve (non-JSKOS-aware) but JSON-LD aware client that will then generate triples like "x skos:narrower true"? I see the spec says "The following JSON-LD context document can be used to map JSKOS to map JSKOS without closed world statements to RDF triples." but if the JSON-LD context is referenced in a JSON file with closed world statements, how can you forbid using that context? |
Closing and archiving issue due to lack of activity. Please reopen if there are concrete reasons for reconsidering. |
The current REST API data format is JSON-LD without further specification:
The point of JSON-LD, however, is to provide a JSON format that can be used both, as plain JSON and as RDF. To make use of plain JSON, the format has to be specified in more detail, because the same RDF graph can be encoded in JSON-LD in many different ways. I already invested some effort to specify a JSON encoding of SKOS, called JSKOS, see http://gbv.github.io/jskos/jskos.html
To give one example, instead of
Skosmos should better return JSKOS with the approriate JSON-LD context document like this:
Some features, such as concept collections and mappings may need to be discussed. Comments and questions are welcome!
The text was updated successfully, but these errors were encountered: