-
Notifications
You must be signed in to change notification settings - Fork 16
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
Can we replace current responseDataType with JSON-LD context? #6
Comments
Thanks, I'm trying to see how this maps to RDF. Is there already a proposed JSON-LD context for the fields above? Am I correct in assuming that |
Using this as an example:
In JSON-LD 1.0, we can add context like this:
Note that "@context" for ensembl needs to be embedded under "ensembl" field, which is not ideal. In the coming JSON-LD 1.1, you can use "scoped context", so that we can put all nested context in one place:
Much cleaner, as all context are now in one place. Note that the JSON-LD 1.1 is not be supported in their JSON-lD play ground yet, but their Ruby client has supported all 1.1 features. |
In my mind, we want to use JSON-LD to label what the fields are (by mapping them to the relevant URIs). That's a simple use case of JSON-LD. JSON-LD itself can be much more powerful in term of representing RDFs, but I don't see how useful it is in our use cases (like the Translator project). |
@micheldumontier regarding value-expansion in JSON-LD v1.1, here is the documentation: https://json-ld.org/spec/latest/json-ld-api/#value-expansion. Basically, it can be done using either This is a closed relevant issue, json-ld/json-ld.org#369, showing an example with scoped |
@newgene when I pass this
through jena rdfcat, I get
is this intentional? I would expect to have an ensembl URI |
I'm not really understanding the motivation here. The main reason to use JSON-LD would be if the goal was to produce linked-data / RDF. If the goal is to produce a simple data dictionary, or tagging of identifier fields, maybe there are other solutions? I think I may be missing something, where is the best place to start with documentation of usage of JSON-LD in Smart-APIs? The website is great for learning how to register an API and edit the API, but I'm less clear on how JSON-LD is intended to fit in |
You can easily do the property expansion with "@id". There's no support for "@type": "@vocab" (a 1.1 feature) yet in json-ld playground, so i can't test a local value expansion. Nevertheless, the bigger problem that I see is that if a web service places totally different identifiers in the value of a property, and doesn't use a prefix for each one, then your expansion will be wrong. That's why we went with the list formulation that started this thread - you can list all the different identifier types that could be in the value field. |
@micheldumontier @cmungall FYI, I put up a test JSON-LD playground with the support of 1.1: http://jsonld.biothings.io/ (json-ld/json-ld.org#504), so that we can test more on the upcoming 1.1 features. |
@micheldumontier, I believe you refer to the case like a field can have multiple id types as the value. For example, a "protein_id" field, which can be either Uniprot id or Ensembl protein id. Personally, I don't think this is a good practice, but I agree it does happen. In this case, this field should not be assigned to uniprot id type or ensembl_protein id type, because another API claims can handle Uniprot id will break when the input is ensembl_protein id. I think this field should be skipped for id type mapping (due to ambiguity) or should be assigned to a "new virtual" type (like "uniprot+ensembl_protein"). The solution for this case, I think either the developer fixes the ambiguity field and split it into two fields, or using the solution like CURIE (prefixed id values). If CURIE is used, I would map this field as the "CURIE" type, instead of the list of all supported ID types. And then other APIs taking CURIE ID as the input can be linked with this API via this field. |
@cmungall Yes, one of the main motivations of JSON-LD is to use it as a serialization format between JSON and RDF. A simpler use-case for me is to use JSON-LD as a mechanism for tagging identifier fields, and also tagging the relationships (e.g. a drug id -->upregulates->uniprot id) and provenance if needed. Are there other established mechanisms/standards out there for this purpose? It's not hard to come up an own solution, but it would be better to use an existing (and well-adopted) standard. Plus that I really like the JSON-LD's nature of decoupling context and actual data, that lowers the barrier for creating a JSON-LD context for the existing API. |
@newgene I tried using the example that i provided earlier in the JSON 1.1 playground, but no change in the RDF that it generates... i don't disagree that the JSON-LD augmentation is valuable, but we still need a mechanism to annotate the identifier types that are consumed or generated from a service which do not conform to JSON-LD expansion. If we commit to the JSON-LD scheme approach that you describe, then we are then saying that only those well formed APIs can be "smartAPIs". also, can you show an example in how a json-ld context would be used in a swagger compliant description? |
@newgene Is this still relevant? |
Close this one as we now use |
Currently, the responseDataType is basically a keypath to ID-type-URI pairs:
The keypath is flatten in order to provide a simple flat list.
Can we allow a JSON-LD context as the content for responseDataType, so that we can we can provide richer semantic context about the response data?
The text was updated successfully, but these errors were encountered: