I added a small block of code to resolve the EBI Ontology Lookup Service API in Template.java
It uses a if statement to check for OLS API URL, and grab the response to populate the select. So we can easily refactor this code as we wish later, maybe a small list of hadoc functions to resolve different types of APIs):
} else if (apiString.startsWith("https://www.ebi.ac.uk/ols/api/select")) {
// Resolve EBI Ontology Lookup Service
// e.g. https://www.ebi.ac.uk/ols/api/select?q=interacts%20with
// response.docs.[].iri/label
JSONArray responseArray = json.getJSONObject("response").getJSONArray("docs");
for (int i = 0; i < responseArray.length(); i++) {
String uri = responseArray.getJSONObject(i).getString("iri");
String label = responseArray.getJSONObject(i).getString("label");
if (!values.contains(uri)) {
values.add(uri);
labelMap.put(uri, label);
}
}
}
It can be implemented this way in a template:
:uri a nt:GuidedChoicePlaceholder ;
nt:possibleValuesFromApi "https://www.ebi.ac.uk/ols/api/select?q=" .
Or only search in a specific ontology (e.g. the Relation Ontology ro):
:uri a nt:GuidedChoicePlaceholder ;
nt:possibleValuesFromApi "https://www.ebi.ac.uk/ols/api/select?ontology=ro&q=" .
I added a small block of code to resolve the EBI Ontology Lookup Service API in
Template.java
It uses a
if
statement to check for OLS API URL, and grab the response to populate the select. So we can easily refactor this code as we wish later, maybe a small list of hadoc functions to resolve different types of APIs):It can be implemented this way in a template:
Or only search in a specific ontology (e.g. the Relation Ontology
ro
):See this template as example: http://localhost:37373/publish?1&template=http://purl.org/np/RA8AXz5jnk5caKG-RnOT39_RD_WmPG4chQc2cBoiIzQ_U
The response time of the API is quite good!