I used to execute successfully the following query:

SELECT (COUNT(?r) AS ?count) WHERE { [] <http://www.wikidata.org/prop/direct/P31> ?r }

on http://wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql

However, now this endpoint has been stopped, and when I execute the same query on official wikidata endpoint service: https://query.wikidata.org I get the following error:

java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: org.openrdf.query.QueryInterruptedException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.bigdata.bop.engine.QueryTimeoutException: Query deadline is expired.

This means that the query has exceeded the limit time.

Is there a way to expand executing time, or is there another SPARQL endpoint that allows me to execute the query?

  • What are you trying to do with your query? Other queries work fine. – philshem Oct 23 '16 at 11:47
  • it calculates frequency of using property P31. It is for research purposes. – Nasreddine Oct 23 '16 at 13:33
  • P31 is "instance of" - how long did that take with the original web service? – philshem Oct 23 '16 at 17:42
  • I do not remember; it was calculated normally. – Nasreddine Oct 24 '16 at 8:13
  • What are you trying to calculate? – philshem Oct 24 '16 at 13:46

The following query is almost instant (try it):

SELECT (COUNT(*) AS ?count)  { ?s wdt:P31 ?o }   

In general, one have to download a dump and use it for such queries.

Another option is to use special reports (you should be especially interested in this one):

Additionally, property usage statistics is available on the Property discussion page.


Hackish way: https://query.wikidata.org/sparql?ESTCARD&p=<http://www.wikidata.org/prop/direct/P31>

  • I know this is a bit old but could you perhaps elaborate on why the query you pasted is so much faster? I haven't seen a SPARQL query like that before, you have omitted the WHERE keyword, why is that? I tried to find an explanation but nothing mentions this. Why is your query significantly faster than the (semantically equivalent) query: SELECT (COUNT(?s) AS ?count) WHERE {?s wdt:P31 ?o}? Thanks – JeneralJames Mar 6 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.