query-a1a6d61c0ffd832534e30b3923187717

rq turtle/ttl

identical label - optimization 10 LIMIT } # FILTER NOT EXISTS { ?item wdt:P31 wd:Q4167410 } # FILTER NOT EXISTS { ?dab wdt:P31 ?inst . FILTER( ?inst != wd:Q4167410 ) } ) ?item != ?dab (FILTER } ?dab P1889:wdt ?item { NOT EXISTS FILTER . Q4167410:wd P31:wdt ; ?l label:rdfs ?dab # "en" or another language )"en" = )?l(lang (FILTER . ?l label:rdfs ; Q101352:wd P31:wdt ?item { WHERE ?l ?dab ?item SELECT 10:41, 22 September 2021 (UTC) JuraI tried various hints to optimize the above query, but it ends up timing out when I increase the limit. The idea is to find missing P1889 statements (maybe not many are left). There are about 500k family name items and 1.3 million dab items. ---

Use at

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/>
SELECT *
WHERE
{


{
  SELECT * { ?item wdt:P31 wd:Q101352 .
    MINUS { ?item p:P1889 [] }
  } OFFSET 75000 LIMIT 25000
}    ?item rdfs:label ?l . FILTER(  lang(?l) = "en") 
    ?dab  rdfs:label ?l ; wdt:P31 wd:Q4167410 .
    FILTER( ?dab != ?item )   
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?dab"):::projected v2("?item"):::projected v3("?l"):::projected a1((" ")) c3(["wd:Q101352"]):::iri c6(["wd:Q4167410"]):::iri f0[["?dab != ?item"]] f0 --> v1 f0 --> v2 f1[["?l = 'en'"]] f1 --> v3 v2 --"p:direct/P31"--> c3 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P1889"--> a1 end v2 --"rdfs:label"--> v3 v1 --"rdfs:label"--> v3 v1 --"p:direct/P31"--> c6