WITH RECURSIVE prelim1_objs(s) AS (VALUES (355)
SELECT q.s FROM objs q, prelim1_objs rec WHERE q.p=9 AND q.o=rec.s)
SELECT q1.s, q2.o FROM objs q1 LEFT JOIN objs q2 ON (q2.s=q1.s AND q2.p=6) WHERE q1.p=6 AND q1.o IN (SELECT s FROM prelim1_objs)
When I run this query, I get a
rdflib.query.ResultException: Unknown result type: WITH
Is there anything I can do about it?
Could it be related to an relatively old version of SQLite, which e.g. does not support "IIF"?
I'm very surprised by the error message you get (rdflib.query.ResultException: Unknown result type: WITH) because the new SPARQL engine does not use rdflib at all and thus should not produce rdflib error... Are you sure of this error message ?
I tried your query on a basic dataset, and it worked as expected.
I think you can remove the OPTIONAL keyword, as the first part already ensure that there is a "type" relation -- thus the OPTIONAL actually occurs always.