HumanBrainProject / fairgraph

High-level Python API for the EBRAINS Knowledge Graph
Apache License 2.0
10 stars 6 forks source link

Purpose and severity of `UserWarnings` #58

Closed mih closed 1 year ago

mih commented 1 year ago

Querying dataset versions in the KG, I frequently see UserWarning message of this nature:

UserWarning: 'str' object has no attribute 'get'                                                                                              
  warnings.warn(str(err))
UserWarning: Field 'full_documentation' is required but was not provided.
  warnings.warn(errmsg)
UserWarning: Field 'value' should be of type (<class 'float'>,), not <class 'int'>
  warnings.warn(errmsg)

These seem all the have their origin within fairgraph. I am not sure who is the "user" here. They mostly seem to be about invalid assumption about records in the KG.

Q: Is a client software supposed to silence these warnings? Is it safe to turn of all UserWarnings? There is nothing an actual user seems to be able to do about them.

apdavison commented 1 year ago

In general, these warnings indicate that a field marked as "required" in the openMINDS schemas is missing. These warnings are helpful if the user is adding new metadata to the KG, not so useful where reading existing, incomplete metadata.

It is probably safe to silence them. I'll look into offering a global option to do this, or to silence only on read, not on write.

(The first warning (no attribute 'get') is probably a bug, I'll look into it, and the third one is also a bug/temporary limitation in fairgraph, since openMINDS specifies 'number' - I'll open a ticket)