Open jusa3 opened 1 month ago
The ontologies an entity appears in can be extracted from the OLS api as follows:
.../ontologies/{ontologyId}/{entityType}/{entityIri}
contains a key appearsIn
listing all ontologies the entity appears inappearsIn
does not exist within the response of the query .../ontologies/{ontologyId}/{entityType}/{entityIri}
. The query .../{entityType}/{entityIri}
(without /ontologies/{ontologyId}
) provides all occurrences of the entity in the array at the key embedded/terms
, from which the ontologies can be extracted.Added a first version of the widget in the linked development branch. Looks like this:
Feel free to review the source code and behavior of the widget!
Looks good. Great to see you making the "also in" information accessible from the legacy API!
Implementing this feature in the MetadataWidget would be nice. How would you adapt the MetadataWidget to prevent two requests? @VincentKneip
Currently MetadataWidget uses the query function OlsApi::getEntityObject()
, directly obtaining a Thing object and omitting the rest of the JSON response.
For the legacy api, the information for the ontology list is obtained via querying the api route /{entityType}/{doubleEncodedIri}?{params}
(without /ontologies/{ontologyId}
) which returns the entity in every ontology it appears in.
The idea would therefore be to query this response, obtain the ontology list in an object (e.g. ontolist : string[]
) and transform the part of the response originally used in a Thing object to be used like before for the rest of information. The datatype of data
returned by useQuery
in MetadataWidget therefore would have to be changed from Thing | undefined
to
{
entity: Thing,
ontolist: string[]
} | undefined
Implemented the adjustment on the feature branch. Looks like this now (the lists won't appear if there are no entries, and no badge is included in the list for the ontology currently in):
Could you write a story for this?
The onNavigateToOntology function must be available in the MetadataWidget, right?
Yes, sure!
And yes, you're right, onNavigateToOntology
is needed for the subwidgets.
Do you think the BreadcrumbWidget's badges should also be made clickable? They are so on EBI-OLS, and the first navigates to the ontology's main page.
Yes would be nice feature: https://github.com/ts4nfdi/terminology-service-suite/issues/131
Lists ontologies the entity also appears in.
See https://www.ebi.ac.uk/ols4/ontologies/hp/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FHP_0000819