Page MenuHomePhabricator

SPARQL queries limited by server `HTTP/2 504 Gateway Timeout 60s`
Closed, DeclinedPublic

Description

[HTTP/2 504 Gateway Timeout 60798ms]

See also : https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504

Query to run tests (Works in LLQS, fail by 504 in Sparql2data ):

# Issue 1: ?speakers (all) and ?speakersM (male) appear the same 
# Issue 2: languages without male speakers are excluded :( I want to keep them.
SELECT ?languageLabel ?wikidata ?iso 
#(COUNT(DISTINCT(?recordsAll)) AS ?records)
(COUNT(DISTINCT(?speakersAll)) AS ?speakers) 
(COUNT(DISTINCT(?speakersM)) AS ?speakersMales)
(ROUND(?speakers-?speakersMales) AS ?speakersOthers)
wHERE{ 
  ?recordsAll prop:P2 entity:Q2 .    # Filter: items where P2 'instance of' is Q2 'record'
  ?recordsAll prop:P4 ?language .    # Assign value: P4 'language' into variable ?language
  ?language prop:P12 ?wikidata .  # Assign value: P12 'wikidata id' into variable ?WD
  OPTIONAL { ?language prop:P13 ?iso. } # Assign value: P13 'iso639-3' into ?isoCode
  
  ?recordsAll prop:P5 ?speakersAll .   # Assign value: P5 'speaker' into variable ?speakerQid  
  
  OPTIONAL { 
  ?recordsAll prop:P5 ?speakersM .   # Assign value: P5 'speaker' into variable ?speakerQidM
  ?speakersM prop:P8 entity:Q16 .   # Filter: P8 'sex or gender' is Q16 'male
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } 
}
GROUP BY ?languageLabel ?language ?wikidata ?iso

Event Timeline

WDQS timeouts all queries that take longer than 60s to return results. It doesn't matter which SPARQL "service" is queried. That's a hard limit on their side, and therefore there's nothing we can do about it.
If you want to use queries that make use of both SPARQL services, such as the one you provided (https://w.wiki/4idJ), you might want to split them into separate queries, and find a way to pass the results of the first one to the other.