This query gives unexpected random results 2-3 rows.
It should be giving 118694 rows. One row for each building with optional details as blank.
If we remove last OPTIONAL then data seems coming fine.
Logic in query : getting all buildings… for each building if isPrimaryTopicOf present then
show it otherwise blank…for all present isPrimaryTopicOf loading further rdf type.
Please guide further on this, how optional clause works in virtuoso.
This is all about the Virtuoso “Anytime Query” feature and its utilization re “DBpedia Fair Use” policy i.e., prevent any single User Agent from using the endpoint in ways that impede others.
Your query is very expensive, that’s all
Workarounds?
You can use OFFSET and LIMIT to page through the data
You can instantiate your own DBpedia instance and the query will work just fine.
As i understood few buildings(26 in 10k results) i.e ?s variable do not have isPrimaryTopicOf relation…that was reason i put in OPTIONAL clause so they also come in output…
Possibly those null values in ?o1 are making up something unexpected for join of rdf:type.
For Optional clause do we always need to do such null check ?
What is standard best practice for such cases ? Please guide.