Closed jvendetti closed 1 year ago
Hi, 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)
I don't know what is your plan to fix this, but updating the api_client to handle collection, in general, would be great if you do it. So that 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
Hi Syphax. I hadn't planned on anything other than a simple fix. If you modify the code from what it is currently:
def self.find(id, ontology, params = {})
ontology = HTTP.get(ontology, params)
ontology.explore.class(URI.escape(id, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")))
end
... to this:
def self.find(id, ontology, params = {})
ontology = HTTP.get(ontology, params)
ontology.explore.single_class(id)
end
... the method returns the requested class without errors.
With regard to the single_class endpoint, I'll post comments separately in PR #15.
OK, in parallel I added this issue https://github.com/ontoportal-lirmm/ontologies_api_ruby_client/issues/8 so that we remember of a possible optimization here.
I couldn't find any functionality in the BioPortal RoR application that triggers a call to
find
onLinkedData::Client::Models::Class
, nor do we have any unit tests that exercise that particular method.If you attempt to call the method in a debugging environment, e.g.:
... the library throws an ArgumentError:
The method attempts to explore a non-existent type of hypermedia link on an ontology object (i.e., 'class' instead of 'single_class').