ols4 icon indicating copy to clipboard operation
ols4 copied to clipboard

Return annotations in search endpoint via `fieldList`

Open marius-mather opened this issue 1 year ago • 3 comments

In the OLS3 search API it was possible to request individual annotation fields be included in the results via fieldList. You could either include annotations_trimmed, or specify an annotation by including <field_name>_annotation in fieldList.

Example OLS3 request:

https://www.ebi.ac.uk/ols/api/search?q=holstein&ontology=vbo&queryFields=label,synonym&fieldList=iri,label,synonym,subset,exists_in_country_annotation,annotations_trimmed

This would return result items like:

 {
    "iri": "http://purl.obolibrary.org/obo/VBO_0003160",
    "label": "Holstein, Ecuador (Cattle)",
    "synonym": [
	    "Holstein"
    ],
    "annotations_trimmed": [
	    "https://orcid.org/0000-0002-4142-7153",
	    "https://orcid.org/0000-0002-5520-6597",
	    "https://orcid.org/0000-0002-9178-3965",
	    "http://www.wikidata.org/entity/Q736",
	    "https://www.fao.org/dad-is",
	    "ECU"
    ],
    "exists_in_country_annotation": [
	    "http://www.wikidata.org/entity/Q736"
    ]
}

Currently, neither form of the annotation seems to be supported in OLS4.

Including these annotations in search results is very useful for my use case because it means I can search for multiple results, without having to do individual requests on each term when I need to filter on one of these annotation properties.

marius-mather avatar Nov 01 '23 03:11 marius-mather