Closed martinmaillard closed 4 years ago
Yes, let's do it more the JS way.
I think it should be possible to create instances to pass the options just once and pass the object around. Maybe we can add a static instance later, but I would like to gain experience first, before we add it as a feature.
Have you thought about adding an API like this?:
const shape = new SHACLShape(shapesDataset)
const report = shape.validate(dataset)
👍
I like your idea! It totally makes sense to prepare a validator based on a set of shapes and to use it to validate multiple datasets.
I would keep the SHACLValidator
name instead of SHACLShape
if you don't mind.
Done
There are still some things in the API that I would like to change, but I would like your opinion before doing it @bergos.
1. The API is very imperative & stateful and I don't see a good reason for it (heritage from Java?)
Currently, the flow looks like:
And the validator also exposes methods like
loadDataGraph
,loadShapesGraph
,showValidationResults
, etc...I would prefer something like:
And to be honest, my favourite version would be:
I don't see a reason why the validator needs to be an object holding state. Reusing the same validator object to validate multiple datasets doesn't seem useful to me. But maybe I'm missing something?
2. Some functions should be properties, mostly on
ValidationReport
.conforms()
->.conforms
.results()
->.results