-
Notifications
You must be signed in to change notification settings - Fork 546
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? #1492
Comments
Hi @gtfierro sorry I haven't replied to this earlier: I've been dealing with a large volume of PRs. If this is an RDFlib thing and fixing it there will solve it in pySHACL too, please do submit an RDFlib PR! |
Hi @nicholascar |
@nicholascar no worries! In the current design, I can see a couple possible fixes:
Let me know your thoughts on the above when you have time! I think this is a pretty niche issue and it is solved for my immediate use case in pySHACL so I'm not blocked on it. |
@gtfierro I don't actually know when I think the right thing is to do your second suggestion: alter |
From what I can tell, pySHACL uses I'll file a PR with the warning fix soon! |
I'm running into an issue with a complex ontology project where a Javascript-based SPARQL function is being "unregistered" twice and causing the following stack trace when I run my unit tests:
I believe what is happening is the
dash
graph is getting loaded multiple times because of redundant imports. This loads thedash:toString
function multiple times, which is (correctly) idempotent. However, during cleanup (I am using pySHACL's implementation of SHACL-AF), pySHACL attempts to unregister thedash:toString
function multiple times. After a function is unregistered the first time, theValueError
in https://github.com/RDFLib/rdflib/blob/master/rdflib/plugins/sparql/operators.py#L614-L617 gets thrown. I believe this should be idempotent as well --- if the function does not exist in the function lookup table, then a warning should be thrown rather than an exception. I could also see pySHACL catching the exception to avoid halting the cleanup.I am happy to introduce a change PR --- either to RDFlib or pySHACL --- to address this, but I wanted to ask if my intended fix is appropriate. I'll see what I can do about creating a minimal reproducible example
The text was updated successfully, but these errors were encountered: