You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seems like pretty_print expects a that all superclasses of a class belong to a loaded name space. If for example we load the FOAF namespace and ontology, which uses internally geo, geo is not loaded as a name space, the superclass of a Person is a geo:SpatialThing. Using pretty_print on a Person instance fails:
a_person=foaf.Person()
pretty_print(a_person)
fails with AttributeError: 'NoneType' object has no attribute 'name' at end of a longish message.
The text was updated successfully, but these errors were encountered:
enhance the generator in _pp_list_of_labels_or_uids to take into account non name spaced entities. Currently this is checked for the root entity assuming all other superclasses belong to the name space.
--> We can add an if else inside the generator like so:
labels = ( f"{entity.label} ({entity.namespace.name} )" if entity.namespace else f"{entity.label}" for entity in entities )
and essentially reduce the lines needed, and get the proper result:
seems like pretty_print expects a that all superclasses of a class belong to a loaded name space. If for example we load the FOAF namespace and ontology, which uses internally geo, geo is not loaded as a name space, the superclass of a
Person
is ageo:SpatialThing
. Usingpretty_print
on aPerson
instance fails:fails with
AttributeError: 'NoneType' object has no attribute 'name'
at end of a longish message.The text was updated successfully, but these errors were encountered: