Open joni-herttuainen opened 1 year ago
@crisely09 I am not sure to understand the "debug" parameter and the "catch_exception" parameter mentioned in the above MR. I would expect a validation exception to be raised by default with the error message in the exception detailing the nature of the exception.
@jdcourcol the catch_exception
makes the action (register/update/deprecate) to stop when there is an error, usually all errors are caught and things continue running. This is only if you want to have some other way to catch errors externally.
Hi, I was playing with the KnowledgeGraphForge.validate. There's a few issues.
Can't pre-validate if there are files
If I call validate on a resource that has files to it, to check if it's valid before registering it, I get:
if I do:
and the validation fails, and if I do not register the resource due to it failing, I have now effectively uploaded a file that will never be used by anything in Nexus.
Error message is unclear
If I validate a registered resource, in this case
DetailedCircuit
, the output is:I investigated this further, and went all the way to
kgforge/specializations/models/rdf/store_service.py:StoreService._validate
to realize that the error message comes as such from the
pyshacl.Validator
and is of typerdflib.term.Literal
which is basically a string.I don't know if you can do a more customized validator with pyshacl that would give more meaningful error messages. Like by inheriting the validator and creating a custom
create_validation_report
(https://github.com/RDFLib/pySHACL/blob/master/pyshacl/validate.py#L125) but I feel the current error message is not clear enough.Like I know that the current message means it's missing properties but it is not clear from that message. It would be nice if instead of all that it'd output something like:
or, even with less output if possible, like: