DerwenAI / kglab

Graph Data Science: an abstraction layer in Python for building knowledge graphs, integrated with popular graph libraries – atop Pandas, NetworkX, RAPIDS, RDFlib, pySHACL, PyVis, morph-kgc, pslpython, pyarrow, etc.
https://derwen.ai/docs/kgl/
MIT License
574 stars 65 forks source link

abort_on_error is now abort_on_first in pyshacl #211

Closed fils closed 2 years ago

fils commented 2 years ago

I'm submitting a

Current Behaviour:

Running pyshacl return a warning

_Usage of abort_on_error is deprecated. Use abort_onfirst instead.

Which is annoying when processing 1K files via dask :)

Expected Behaviour:

no such warning

Steps to reproduce:

Validate with pyshacl.. You can see this error in pages like https://derwen.ai/docs/kgl/ex5_0/ too.

Environment:

I have my environment file at https://github.com/gleanerio/notebooks/blob/master/environment.yml but it's not really needed with this.

Ref https://github.com/RDFLib/pySHACL to see

from pyshacl import validate
r = validate(data_graph,
      shacl_graph=sg,
      ont_graph=og,
      inference='rdfs',
      abort_on_first=False,
      allow_warnings=False,
      meta_shacl=False,
      advanced=False,
      js=False,
      debug=False)
conforms, results_graph, results_text = r

The fix is simple (I hope). Just edit the file https://github.com/DerwenAI/kglab/blob/b93dbd31446392cbe5f274c4dd113af06befea00/kglab/kglab.py

Replace abort_on_error with abort_on_first

I think that is all that is needed.

fils commented 2 years ago

made a pull request for this.. it was so simple even I could do it.. ;)

ceteri commented 2 years ago

Many thanks @fils , does this update now work better?

We bumped the pySHACL version as well, and have added you into the committers list!

ceteri commented 2 years ago

https://pypi.org/project/kglab now @ 0.4.2

fils commented 2 years ago

@ceteri everything is working great.. no more message and everything runs for me..

ceteri commented 2 years ago

Awesome, thank you @fils
I'll try to troubleshoot on the other issue – the library adjusted some settings to align with RDFlib v6