INCATools / INCATools/ontology-access-kit

OLS adapter label() returns None for OLS4 term payloads

Open Beginner friendly
#885 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
198
Forks
35
Avg merge
3d 4h
Merged PRs (30d)
1

Description

Tested with `oaklib==0.7.0rc7` and Python 3.12.

`OlsImplementation.label()` returns `None` for GO terms even though the OLS4 response includes a label in the embedded term payload.

## Reproducer

```python
from oaklib import get_adapter
import importlib.metadata as md

print(md.version("oaklib")) # 0.7.0rc7
adapter = get_adapter("ols:go")

print(adapter.focus_ontology) # go
print(adapter.label("GO:0008150")) # None

iri = adapter.curie_to_uri("GO:0008150")
term = adapter.client.get_term(ontology="go", iri=iri)
print(term["_embedded"]["terms"][0]["label"])
# biological_process
```

## Expected behavior

`adapter.label("GO:0008150")` should return the label from the OLS4 term payload, e.g. `biological_process` for GO:0008150.

## Current downstream workaround

In `linkml-term-validator`, I had to wrap label access so that if `adapter.label(curie)` returns `None`, the code checks for an OLS4 response shaped like:

```python
term["_embedded"]["terms"][0]["label"]
```

It seems better for this compatibility with current OLS4 responses to live inside the OAK OLS adapter.

Contributor guide

Open the contributing guide

Research direction

Start with OlsImplementation.label() and reproduce the GO:0008150 case using the issue's Python snippet. Compare its result with client.get_term() and the OLS4 _embedded terms payload; done means adapter.label("GO:0008150") returns biological_process rather than None.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.