ontoportal-lirmm / ontologies_api_ruby_client

A Ruby client for accessing NCBO's hypermedia api
Other
0 stars 1 forks source link

Possible optimization in the class find method #8

Open syphax-bouazzouni opened 1 year ago

syphax-bouazzouni commented 1 year ago

Directly related, this PR: https://github.com/ncbo/ontologies_api_ruby_client/pull/15

I think that the current find in the api_client is not really well implemented, In the backend, it would be

LinkedData::Models::Class.find(RDF::URI.new(cls_id)).in(submission).first

But in our client, the .in(submission) (collection system) is not implemented (I think, I hope I'm not mistaken here)

Maybe we need to update the api_client to handle collection, in general, it would be great if we can have something like this

LinkedData::Client::Models::Class.find('http://purl.bioontology.org/ontology/STY/T047').in('https://data.bioontology.org/ontologies/STY') 
# will call https://data.bioontology.org/ontologies/STY/classes/http%3A%2F%2Fpurl.bioontology.org%2Fontology%2FSTY%2FT047

Finally, I think also that the single_class endpoint is not really needed, doesn't follow the REST standard, and was only an ad-hoc solution no more needed when we have this https://github.com/ncbo/ontologies_api_ruby_client/pull/15

syphax-bouazzouni commented 1 year ago

The issue is that currently each time we want to find a class, we need first to get the ontology. (and the same for submissions, properties, .....)

def self.find(id, ontology, params = {})
  ontology = HTTP.get(ontology, params)
  ontology.explore.single_class(id)
end