Minimal query:
SELECT * { BIND(EXISTS { ?a p:1/p:2 ?b. } AS ?t) }
Caused by: java.lang.UnsupportedOperationException: child:
PropertyPathNode(VarNode(a), com.bigdata.rdf.sparql.ast.PathNode(PathAlternative), VarNode(c)) [scope=DEFAULT_CONTEXTS]
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroup(AST2BOpUtility.java:3383)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroupOrUnion(AST2BOpUtility.java:2586)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.addSubgroup(AST2BOpUtility.java:4352)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroup(AST2BOpUtility.java:3342)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroupOrUnion(AST2BOpUtility.java:2586)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.addExistsSubqueryFast(AST2BOpUtility.java:2426)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.addExistsSubquery(AST2BOpUtility.java:2253)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroup(AST2BOpUtility.java:3296)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertJoinGroupOrUnion(AST2BOpUtility.java:2586)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convertQueryBaseWithScopedVars(AST2BOpUtility.java:474)
at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convert(AST2BOpUtility.java:287)
at com.bigdata.rdf.sparql.ast.eval.ASTEvalHelper.optimizeQuery(ASTEvalHelper.java:426)
at com.bigdata.rdf.sparql.ast.eval.ASTEvalHelper.evaluateTupleQuery(ASTEvalHelper.java:212)
…
Looks like a bug to me (almost certainly upstream).
Here’s the unreduced query:
# % of unsourced religion statements by religion SELECT ?religion ?religionLabel ?count ?anyReferencedCount ?realReferencedCount (100*?anyReferencedCount/?count AS ?anyPercent) (100*?realReferencedCount/?count AS ?realPercent) WITH { SELECT ?religion (COUNT(?statement) AS ?count) (SUM(?anyeferences) AS ?anyReferencedCount) (SUM(?realReferences) AS ?realReferencedCount) WHERE { ?item p:P140 ?statement. ?statement ps:P140 ?religion. BIND(IF(EXISTS { ?statement prov:wasDerivedFrom ?reference. }, 1, 0) AS ?anyReferences) BIND(IF(EXISTS { ?statement prov:wasDerivedFrom ?reference. MINUS { ?reference pr:P143/wdt:P31 wd:Q10876391. } }, 1, 0) AS ?realReferences) } GROUP BY ?religion } AS %results WHERE { INCLUDE %results. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count)