linkml / linkml-validator

[retired]
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Add a prefix validator plugin #20

Open kevinschaper opened 1 year ago

kevinschaper commented 1 year ago

Almost as a finer grain extension of the benefits of the range plugin, it would be great to have a prefix checking plugin.

I can take a shot at implementing it, the one question I had @deepakunni3 is whether there's a way to control the strictness of a plugin? I think officially in linkml prefixes are only advisory and invalid prefixes should only be warnings, but there are situations (like, when kgx output is first generated as part of an ingest) where I might want to fail on a prefix error.

One approach I could see taking is to make the plugin available as two different modules, prefix_validation and prefix_validation_strict and just share the code between them.

deepakunni3 commented 1 year ago

Hi @kevinschaper ! That is fantastic. Performing prefix checks is an excellent use case as a plugin.

I would say go ahead with the implementation :) Feel free to ping if you have any questions.

Regarding strictness: I would suggest having the plugin accept strictness at runtime. That way, the strictness flag can be used to either report an error or just warn. Of course, the validator wouldn't terminate right away. But you would get valid: false for the object in your Validation Report. You can handle the report on the KGX side by raising a validation error.