INCATools / INCATools/ontology-access-kit
Ubergraph descendants() treats bare string CURIE input as characters
Nobody has claimed this yet.
- 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.
UbergraphImplementation.descendants() appears to advertise support for Union[str, List[str]] input, but a bare string CURIE is treated as an iterable of characters. Passing the same CURIE inside a list works.
Reproducer
from oaklib import get_adapter
import importlib.metadata as md
print(md.version("oaklib")) # 0.7.0rc7
adapter = get_adapter("ubergraph:")
print(list(adapter.descendants(
"GO:0008150",
predicates=["rdfs:subClassOf"],
reflexive=False,
))[:5])
# []
# plus warnings such as:
# WARNING:root:Not a curie: G
# WARNING:root:Not a curie: O
# WARNING:root:Not a curie: 0
print(list(adapter.descendants(
["GO:0008150"],
predicates=["rdfs:subClassOf"],
reflexive=False,
))[:5])
# ['GO:0007269', 'GO:0007283', 'GO:0007286', 'GO:0007288', 'GO:0007289']
Expected behavior
Either:
- bare string CURIE input should behave the same as a one-element list, matching the apparent
Union[str, List[str]]contract, or - the method signature/docs should require a list and reject a bare string clearly.
Current downstream workaround
In linkml-term-validator, I had to wrap all graph traversal start CURIEs in a list before calling ancestors() or descendants() so Ubergraph does not iterate over the characters in a CURIE string.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at UbergraphImplementation.descendants() and compare its behavior for a bare CURIE string with a one-element list; also check the related ancestors() entry point. Re-run the Python reproducer against the Ubergraph adapter and confirm that string input no longer produces character-by-character CURIE warnings and matches list input.
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
- Clearly specified
- Newbie friendliness
- 72/100