query-f61dca9f27000ea97e5ff50d83276556
Problem with TimeoutHello, i wrote a Query, when i took Limit 10, it works. With more Limit, it doesn't work. If i want to us the Statement "minus { ?item1 p:P397 [] }" it also gets a Timeout. How can it get optimized?:
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item1 ?item1Label ?labelnew1 ?item2 ?item2Label
where {
{ SELECT DISTINCT ?item1 ?item2 ?labelnew1
where {
?item1 wdt:P31 wd:Q44559 .
##minus { ?item1 p:P397 [] }.
?item2 wdt:P31 wd:Q523 .
?item1 rdfs:label ?label1.
?item2 rdfs:label ?label2.
FILTER(LANG(?label1) = "en").
FILTER(LANG(?label2) = "en").
bind(substr(?label1, 1, strlen(?label1)-1) as ?labelnew1).
FILTER(?labelnew1 = ?label2).
}
LIMIT 10
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item1"):::projected
v5("?item2"):::projected
v3("?label1")
v2("?label2")
v6("?labelnew1"):::projected
c4(["wd:Q523"]):::iri
c7(["bd:serviceParam"]):::iri
c1(["en"]):::literal
c3(["wd:Q44559"]):::iri
f0[["?labelnew1 = ?label2"]]
f0 --> v6
f0 --> v2
f1[["?label2 = 'en'"]]
f1 --> v2
f2[["?label1 = 'en'"]]
f2 --> v3
v4 --"p:direct/P31"--> c3
v5 --"p:direct/P31"--> c4
v4 --"rdfs:label"--> v3
v5 --"rdfs:label"--> v2
bind3[/"substring(?label1,'1^^xsd:integer',string-length(?label1) + '-1^^xsd:integer')"/]
v3 --o bind3
bind3 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c1
end