ts4nfdi / terminology-service-suite

The SemLookP Widgets project is a collection of interactive widgets designed to ease the integration of terminology service functions into third-party applications.
https://ts4nfdi.github.io/terminology-service-suite/comp/latest/
MIT License
15 stars 2 forks source link

New widget: EntityOntoListWidget #122

Open jusa3 opened 1 month ago

jusa3 commented 1 month ago

Lists ontologies the entity also appears in.

image

See https://www.ebi.ac.uk/ols4/ontologies/hp/classes/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FHP_0000819

VincentKneip commented 1 week ago

The ontologies an entity appears in can be extracted from the OLS api as follows:

VincentKneip commented 1 week ago

Added a first version of the widget in the linked development branch. Looks like this: grafik grafik

Feel free to review the source code and behavior of the widget!

jusa3 commented 5 days ago

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

VincentKneip commented 5 days ago

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
VincentKneip commented 5 days ago

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):

grafik

jusa3 commented 4 days ago

Could you write a story for this?

The onNavigateToOntology function must be available in the MetadataWidget, right?

VincentKneip commented 4 days ago

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.

jusa3 commented 4 days ago

Yes would be nice feature: https://github.com/ts4nfdi/terminology-service-suite/issues/131