Closed vemonet closed 4 years ago
Autocomplete through the nanopub grlc API is already possible, if you use "http://purl.org/nanopub/api/find_signed_things?". See here: https://github.com/peta-pico/nanobench/blob/master/src/main/java/org/petapico/nanobench/Template.java#L282
It only works with "find_signed_things", which is still an experimental feature which is not yet available on all the nodes. But nanobench can recognize this URL prefix ("http://purl.org/nanopub/api/...") and make the call to any node in the network, not necessarily only the one this URL redirects to, in the same way it does it for other things.
Could we do what you are doing here also through such a URL and through the getPossibleValuesFromNanopubApi method (instead getPossibleValuesFromApi)?
In particular matching URLs to "http://grlc.nanopubs." is not very nice, as not all URLs of the services follow that pattern (and some use https...).
Thanks @tkuhn that sounds like a much better option to me. I wanted to use find_signed_things
originally, but I am having issues getting the answers with the grlc API, I will try this option
Another issue was that getPossibleValuesFromApi could only return URI In my case the API is returning CURIE (e.g. DRUGBANK:DB00001)
Would it make sense if getPossibleValuesFromApi could return literals and URIs? (it could still treat a URI as URI if detected) Or maybe another function getPossibleLiteralsFromApi
Why would you want to get literals back? To autocomplete literal values?
You can get the literals for the URIs you got back with getLabel, it that's what you are asking: https://github.com/peta-pico/nanobench/blob/master/src/main/java/org/petapico/nanobench/Template.java#L176
Hi @tkuhn , I would like to be able to retrieve Literals using getPossibleValuesFromApi()
Because in some cases when I perform the query on a search API I get a CURIE (e.g. DRUGBANK:DB00000
) and the function only accepts valid IRI
In the end I found a more user-friendly way to add an evidence to a Nanopublication, but it involves adding a "add evidence" link next to the nanopub URI in the NanopublicationItem in the Nanobench source code, the same as the "comment" link:
The changes are quite small, but it's maybe a bit specific for the main Nanobench See the changes in https://github.com/vemonet/nanobench/commit/1adcbb374fc5c59df46f92c9f620cd8611ef9f06
And some screenshots + how to test it here: https://github.com/vemonet/nanobench/wiki/Add-an-evidence-to-an-association
Nice! It looks quite general too. But I am wondering: what is the relation between evidence and provenance? Could your kind of evidence also be published as provenance in the nanopublication from the start?
Did you see, btw, that provenance and pubinfo templates are now supported? I can show you how to use them (or you might be able to figure it out yourself; it's quite straightforward).
wrt the non-IRI values: what change in the code would be required? I see that the output of the method you point to above already is a list of strings (not IRIs), so that part might already be compatible with your requirements.
http://grlc.nanopubs.
then we add ACCEPT header (the call return 500 error otherwise) and we parse the .results.bindings[] JSON object returned using the newly createdparseNanopubGrlcApi()
functionThe mechanism to detect which kind of Object the queried API returns, and how to retrieve the results depending on its structure could be improved if we want to extend the number of supported API
https://identifiers.org/
this could be improved too