Skip to content

Commit

Permalink
rm retrieve schema implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssarah committed Oct 2, 2024
1 parent 4322bd2 commit da98e7d
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions kgforge/specializations/stores/bluebrain_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,35 +431,6 @@ async def do_catch(id_, version, session) -> Union[Resource, Action]:
)
return batch_results

def retrieve_schema(self, id_: bool) -> Resource:

url = self.service.add_resource_id_to_endpoint(endpoint=self.service.url_schemas, resource_id=id_)

response_not_source_with_metadata = requests.request(method=hdrs.METH_GET, url=url, headers=self.service.headers)

not_source_with_metadata = response_not_source_with_metadata.json()

catch_http_error_nexus(response_not_source_with_metadata, RetrievalError)

_self = not_source_with_metadata.get("_self", None)

if not _self:
raise RetrievalError("Cannot find metadata in payload")

response_source = requests.request(method=hdrs.METH_GET, url=f"{_self}/source", headers=self.service.headers)

data_source = response_source.json()

catch_http_error_nexus(response_source, RetrievalError)

# turns the retrieved data into a resource
resource = self.service.to_resource(data_source)

# uses the metadata of the first call
self.service.synchronize_resource(resource, not_source_with_metadata, self.retrieve_schema.__name__, True, True)

return resource

def retrieve(
self,
id_: Union[str, List[str]],
Expand Down

0 comments on commit da98e7d

Please sign in to comment.