query-c2654cd732898326a6bd145cab5ba148
Also, if I remove the 19:56, 31 October 2020 (UTC)) talk (JhealdThis kind of time-out is the sort of thing that could happen from a typo, if the typo led to a line with a triple with unbound variables. But I don't think I've made a typo, or got unbound variables that I can see. Can anybody spot or explain what might be going on here? Query:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT
?name ?minister ?moves ?seq ?place_name ?from_lat ?from_lon ?lat ?lon
WHERE {
{
SELECT DISTINCT ?minister ?seq (COALESCE(?from1, ?place) AS ?from) ?place ?place_name ?StartTime WHERE {
{
SELECT DISTINCT ?minister (COUNT(DISTINCT(?rs1)) AS ?seq) ?place ?StartTime WHERE {
INCLUDE %ministers .
{
SELECT DISTINCT ?minister (?place AS ?pl1) (?StartTime AS ?st1) (?res_stmt AS ?rs1) WHERE {
INCLUDE %ministers .
}
}
FILTER ((?st1 < ?StartTime) || ((?st1 = ?StartTime) && (STR (?rs1) <= STR(?res_stmt)))) .
} GROUP BY ?minister ?place ?StartTime ?res_stmt
ORDER BY ?minister ?seq
}.
BIND ((?seq) AS ?seq1) .
OPTIONAL {
SELECT ?minister (?seq + 1 AS ?seq1) (?place AS ?from1) WHERE {
{
SELECT DISTINCT ?minister (COUNT(DISTINCT(?rs1)) AS ?seq) ?place ?StartTime WHERE {
INCLUDE %ministers .
{
SELECT DISTINCT ?minister (?place AS ?pl1) (?StartTime AS ?st1) (?res_stmt AS ?rs1) WHERE {
INCLUDE %ministers .
}
}
FILTER ((?st1 < ?StartTime) || ((?st1 = ?StartTime) && (STR (?rs1) <= STR(?res_stmt)))) .
} GROUP BY ?minister ?place ?StartTime ?res_stmt
ORDER BY ?minister ?seq
}.
}
}
FILTER (bound(?from1)|| bound(?place)) .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?place rdfs:label ?place_name .
}
}
}
{
SELECT ?minister (MAX(?seq) AS ?moves) WHERE {
{
SELECT DISTINCT ?minister (COUNT(DISTINCT(?rs1)) AS ?seq) ?place ?StartTime WHERE {
INCLUDE %ministers .
{
SELECT DISTINCT ?minister (?place AS ?pl1) (?StartTime AS ?st1) (?res_stmt AS ?rs1) WHERE {
INCLUDE %ministers .
}
}
FILTER ((?st1 < ?StartTime) || ((?st1 = ?StartTime) && (STR (?rs1) <= STR(?res_stmt)))) .
} GROUP BY ?minister ?place ?StartTime ?res_stmt
ORDER BY ?minister ?seq
} } GROUP BY ?minister
}
?place p:P625 / psv:P625 / wikibase:geoLatitude ?lat .
?place p:P625 / psv:P625 / wikibase:geoLongitude ?lon .
?from p:P625 ?from_coords_stmt .
?from_coords_stmt psv:P625 / wikibase:geoLatitude ?from_lat .
?from_coords_stmt psv:P625 / wikibase:geoLongitude ?from_lon .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?minister rdfs:label ?name .
}
}
ORDER BY DESC(?moves) ?minister ?seq