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

Cryptic KeyError: LUUU when adding an invalid triple into a graph #85

Closed
anatoly-scherbakov opened this issue Nov 13, 2021 · 1 comment

Comments

@anatoly-scherbakov
Copy link
Contributor

Context. An attempt to run https://github.com/RDFLib/OWL-RL on a graph backed by rdflib-sqlalchemy with SQLite failed with an error which I could reproduce in a minimal self-contained example. Full code and output are provided in this gist: https://gist.github.com/anatoly-scherbakov/ee60c200986e664bd944ed3712569591

The essence of the error is this: if, when adding a triple to the graph, it appears that Subject of the triple is a Literal (which is forbidden by RDF standard) — RDFLib permits this but RDFLib-SQLAlchemy throws a very cryptic

KeyError: 'LUUU'

which is hard to understand without digging into the code.

Suggestion. Format the error message in a more user friendly way.

anatoly-scherbakov added a commit to octadocs/rdflib-sqlalchemy that referenced this issue Nov 13, 2021
@anatoly-scherbakov
Copy link
Contributor Author

In the attached PR, I am adding a little edge case check in case of a raised KeyError. I am not entirely sure this is optimal approach because this might be much to ad-hoc. Looking forward for feedback!

Here is how the error message looks now in my project:

ValueError: A Literal cannot be a subject of a triple.

Triple causing error:
  http://www.w3.org/TR/2013/NOTE-prov-dictionary-20130430/#dictionary-conceptual-definition rdf:type 
http://www.w3.org/2001/XMLSchema#anyURI
Context: <local:_inference> a rdfg:Graph;rdflib:storage [a rdflib:Store;rdfs:label 'SQLAlchemy'].

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