Closed anatoly-scherbakov closed 2 years ago
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'].
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/ee60c200986e664bd944ed3712569591The 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
which is hard to understand without digging into the code.
Suggestion. Format the error message in a more user friendly way.