Hi Ruben,
Stardog 6.1 released yesterday improves the situation here. This now will evaluate as you'd expect and much faster when the number of distinct predicates is low but the number of instances is high:
SELECT ?predicate
FROM <https://example.org/data/>
WHERE
{ #pragma optimizer.filters.exists off
{ select distinct ?predicate { [] ?predicate [] } }
FILTER EXISTS {
?instance <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/SomeClass> .
?instance ?predicate ?any.
}
}
In the future we'll make sure the hint won't be needed and also that the optimiser could rewrite your original query into this form.
Best,
Pavel