KGObject.by_name() raises TypeError rather than returning None when called without a client and no instance matches:
>>> from fairgraph.openminds.v4.controlled_terms import Species
>>> Species.by_name("definitely not a species")
TypeError: object of type 'NoneType' has no len()
The instance-library branch assigns the miss as None (fairgraph/kgobject.py:946):
if match == "equals":
objects = cls._instance_lookup.get(name, None)
and line 954 then calls len(objects).
The equivalent openMINDS method returns None for the same input, so this is a regression introduced by fairgraph's override, and it affects only the no-client path.
It arises more often than "no such term" suggests, because the instance-library lookup is exact and case-sensitive: any difference in case is a miss, so Species.by_name("mus musculus") raises while Species.by_name("Mus musculus") returns the term.
Same shape as #115 — a None sentinel used without a guard. The fix is to treat a miss as an empty result; a regression test needs no KG connection.
KGObject.by_name()raisesTypeErrorrather than returningNonewhen called without a client and no instance matches:The instance-library branch assigns the miss as
None(fairgraph/kgobject.py:946):and line 954 then calls
len(objects).The equivalent openMINDS method returns
Nonefor the same input, so this is a regression introduced by fairgraph's override, and it affects only the no-client path.It arises more often than "no such term" suggests, because the instance-library lookup is exact and case-sensitive: any difference in case is a miss, so
Species.by_name("mus musculus")raises whileSpecies.by_name("Mus musculus")returns the term.Same shape as #115 — a
Nonesentinel used without a guard. The fix is to treat a miss as an empty result; a regression test needs no KG connection.