CONSTRUCT { [ a rdfs:Class; ] . } WHERE {} """) fails with: Exception: these a...">

SPARQL parser not robust to spurious semicolon · Issue #381 · RDFLib/rdflib (original) (raw)

The following code:

import rdflib; res = rdflib.Graph().query(""" PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema# CONSTRUCT { [ a rdfs:Class; ] . } WHERE {} """)

fails with:

Exception: these aint triples

while that SPARQL query is accepted by the validator at http://sparql.org/query-validator.html . If you remove the ";" after rdfs:Class, it works.

Granted, that semicolon is not required, but it should be tolerated (the Turtle parser tolerates it).