Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant deregistering of custom functions? #108

Closed
gtfierro opened this issue Dec 7, 2021 · 1 comment
Closed

Redundant deregistering of custom functions? #108

gtfierro opened this issue Dec 7, 2021 · 1 comment

Comments

@gtfierro
Copy link
Contributor

gtfierro commented Dec 7, 2021

I recently filed an issue on RDFlib (RDFLib/rdflib#1492) documenting an exception I'm seeing when running SHACL validation with advanced and JS features turned on. I've spent some more time looking at the issue and I believe that --- while the idempotency of deregistering functions should probably be addressed --- there is a related issue in pySHACL.

When functions are being registered here, if a function is identified as more than one type (in my case, the dash:toString function is both a SPARQLFunction and a JSFunction), then it is added to the internal list of functions more than once, which leads pySHACL to attempt to remove it twice. However, the internal function lookup table is a dictionary so only one reference to the function can exist --- thus, removing it twice results in the exception I am seeing in the RDFlib issue.

My proposal is to change all_fns to a set rather than a list. How do you feel about that change? This should make sure that adding functions is idempotent and avoid the issue in RDFlib. I can submit a PR for that soon

gtfierro added a commit to gtfierro/pySHACL that referenced this issue Dec 7, 2021
@ashleysommer
Copy link
Collaborator

This was fixed in both PySHACL (#109) and in RDFLib (I think). So this issue can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants