formula_aware requirement in notation3 parser too stringent for turtle? · Issue #214 · RDFLib/rdflib (original) (raw)

Good day.

I am trying to get some turtle data into a sparql endpoint, and if I understand well the parser to use for turtle is the notation3 parser. (Using tip of rdflib and rdflib-sparqlstore)

I stumbled on the fact that the sparql endpoint is not formula_aware. I am still trying to understand the exact requirements of formula-awareness of a store, but it makes sense to me that my sparql endpoint could not be formula-aware. (I am also working on sparql endpoints which are not context-aware, which is another headache.) Now, the n3 parser asserts formula-awareness, which makes sense for n3 but not for turtle. (Again, even context-awareness should not be necessary!)

Am I missing something obvious (you should use another parser...) or is this a real issue?
Do you agree that this requirement should be relaxed?

I have a patch ready, which simply disables the assertion at line 2357 and delays the check implicit at line 897 by replacing the newFormula call by a direct Formula constructor; this leaves the newFormula call at 1373 that will check formula_awareness for full n3.

Aside: at line 895, we have a newFormula call with an argument, which should just fail; it is probably never called?

Now, this simple-minded hack is certainly not the best approach; maybe we want a proper turtle parser, and a N3 parser that subclasses it. Maybe we want to build the turtle parser independently (maybe on the ntriples parser?). I am more than willing to do the work, but I'd like some guidance on which approach would be favored by maintainers.

Best,
Marc-Antoine Parent