Skip to content

Feature: Add class level explorer to avoid unnecessary calls - #25

Merged
syphax-bouazzouni merged 5 commits into
developmentfrom
feature/optmize-link-explorer
Feb 2, 2025
Merged

syphax-bouazzouni merged 5 commits into
developmentfrom
feature/optmize-link-explorer

Conversation

@syphax-bouazzouni

@syphax-bouazzouni syphax-bouazzouni commented Jan 26, 2025

Copy link
Copy Markdown

Context

Currently to get a concept children for example we do like this:

    @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first
    @concept = @ontology.explore.single_class({dispay: 'prefLabel'}, params[:id])
    @concept.children = @concept.explore.children

which is translated to 4 API calls

Getting: https://data.stageportal.lirmm.fr with {} (t: 0.22914239899910172s - cache: miss)
Getting: https://data.stageportal.lirmm.fr/ontologies/AGROVOC with {:include_views=>true} (t: 0.1970192330009013s - cache: miss)
Getting: https://data.stageportal.lirmm.fr/ontologies/AGROVOC/classes/http%3A%2F%2Faims.fao.org%2Faos%2Fagrovoc%2Fc_330834 with {:dispay=>"prefLabel", :include=>"prefLabel,definition,synonym,obsolete,hasChildren,inScheme,memberOf"} (t: 0.3808957980018022s - cache: miss)
Getting: https://data.stageportal.lirmm.fr/ontologies/AGROVOC/classes/http%3A%2F%2Faims.fao.org%2Faos%2Fagrovoc%2Fc_330834/children with {:pagesize=>750, :language=>"EN", :display=>"prefLabel,obsolete,hasChildren", :include=>"prefLabel,definition,synonym,obsolete,hasChildren,inScheme,memberOf"} (t: 2.8401889389988355s - cache: miss)

With the PR you can directly do

    cls = LinkedData::Client::Models::Ontology.explore('FMA')
                                              .classes(id)
                                              .children
                                              .get

which will be translated to the following calls

Getting: https://data.stageportal.lirmm.fr with {} (t: 0.22914239899910172s - cache: miss)
Getting: https://data.stageportal.lirmm.fr/ontologies/AGROVOC/classes/http%3A%2F%2Faims.fao.org%2Faos%2Fagrovoc%2Fc_330834/children with {:pagesize=>750, :language=>"EN", :display=>"prefLabel,obsolete,hasChildren"} (t: 2.3704248760041082s - cache: miss)

@syphax-bouazzouni
syphax-bouazzouni force-pushed the feature/optmize-link-explorer branch from 9041eb6 to a4f2e84 Compare January 26, 2025 07:51
@syphax-bouazzouni
syphax-bouazzouni force-pushed the feature/optmize-link-explorer branch from 9acf676 to e72d187 Compare January 31, 2025 18:53
@syphax-bouazzouni

Copy link
Copy Markdown
Author

Merged as needed in biodivportal, @Bilelkihal you can still review afterward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant