query-d67eb04e2dfb6b067bdc2f66be70bcc2

rq turtle/ttl

Improved MachtSinn query times outAny way to improve this?

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT * WHERE {
   {
  SELECT * 
  WHERE {
    ?lexeme wikibase:lemma ?lemma;
         dct:language ?lang;
         wikibase:lexicalCategory ?cat.
    OPTIONAL { ?lexeme wdt:P5185 ?genus. } .
  } }  FILTER NOT EXISTS {
    ?lexeme ontolex:sense ?sense.
    ?sense wdt:P5137 ?item.
  }.
  FILTER NOT EXISTS { ?item a wikibase:Property}.
  FILTER NOT EXISTS { ?lexeme wdt:P5402 ?homograph }.
  ?item rdfs:label ?lemma.
  ?item schema:description ?desc.   
  FILTER(LANG(?desc) = LANG(?lemma)).

  # Filter out common false-positives
  FILTER NOT EXISTS { ?item wdt:P131 ?_ }.
  FILTER NOT EXISTS {
    VALUES ?not { 
    wd:Q4167410 
    wd:Q101352 
    wd:Q13417114 
    wd:Q15632617  
    wd:Q215380  # bands
    wd:Q23786   # eye color
    wd:Q40056   # software
    wd:Q3491429 # military terms
    wd:Q7187    # gene
    wd:Q19798644 # wikibase model terms
    wd:Q11668273 # shogi pieces
    wd:Q17155032 # type of software
    wd:Q17638537 # routine - fix computer terminology
    wd:Q11446    # ships
    wd:Q2235308  # types of ships
    wd:Q17537576 # any creative work incl. music, video, text, etc.
    wd:Q8134     # economics
    wd:Q20202269 # music terms
    wd:Q395        # math
    wd:Q494452 # heraldry
    wd:Q1391494 # technical terminology
    wd:Q57814795 # domesticated animal
    wd:Q1725664 # terminology of any kind
    wd:Q43229  # organization of any kind
    wd:Q147276  # names of any kind
    wd:Q15642541 # human settlement definions
    wd:Q5        # human
    wd:Q4167836  # wikimedia cat
  }.
    ?item wdt:P31/(wdt:P279*) ?not  }.
  # filter on properties:
  FILTER NOT EXISTS { 
    VALUES ?not2 {
      wdt:P688 # gene stuff
      wdt:P195 # collection (of art)
      wdt:P1482 # stack exchange
      }
      ?item ?not2 ?_ }. 
  # anything not having a P31 has to go too (this is the first thing to relax when few positives are left)
  #filter not exists {?item wdt:P31 ?dummy.} # stuff without P31 which is usually false positives 
  # special terminology often match these descriptions
  FILTER (!regex(?desc, '.*theory.*')) .      
  FILTER (!regex(?desc, '.*mathemat.*')) .
  FILTER (!regex(?desc, '.*geolog.*')) .
  FILTER (!regex(?desc, '.*anatomy.*')) .
  FILTER (!regex(?desc, '.*military.*')) .
  FILTER (!regex(?desc, '.*taxonomic.*')) .
  FILTER (!regex(?desc, '.*C++.*')) .
  FILTER (!regex(?desc, '.*Unix.*')) .
  FILTER (!regex(?desc, '.* law .*')) .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?_") v11("?cat"):::projected v1("?desc"):::projected v12("?genus"):::projected v8("?homograph") v3("?item"):::projected v10("?lang"):::projected v6("?lemma"):::projected v7("?lexeme"):::projected v5("?not") v2("?not2") v9("?sense") a1((" ")) c15(["wikibase:Property"]):::iri f0[["not regex(?desc,'.* law .*')"]] f0 --> v1 f1[["not regex(?desc,'.*Unix.*')"]] f1 --> v1 f2[["not regex(?desc,'.*C++.*')"]] f2 --> v1 f3[["not regex(?desc,'.*taxonomic.*')"]] f3 --> v1 f4[["not regex(?desc,'.*military.*')"]] f4 --> v1 f5[["not regex(?desc,'.*anatomy.*')"]] f5 --> v1 f6[["not regex(?desc,'.*geolog.*')"]] f6 --> v1 f7[["not regex(?desc,'.*mathemat.*')"]] f7 --> v1 f8[["not regex(?desc,'.*theory.*')"]] f8 --> v1 f9[["not "]] subgraph f9e0["Exists Clause"] bind0[/VALUES ?not2/] bind0-->e0v1 bind00(["wdt:P688"]) bind00 --> bind0 bind01(["wdt:P195"]) bind01 --> bind0 bind02(["wdt:P1482"]) bind02 --> bind0 e0v2 -->e0v1--> e0v3 e0v3("?_"):::projected e0v2("?item"):::projected e0v1("?not2"):::projected end f9--EXISTS--> f9e0 f9 --> v3 f9 --> v2 f9 --> v4 bind10[/VALUES ?not2/] bind10-->v2 bind100(["wdt:P688"]) bind100 --> bind10 bind101(["wdt:P195"]) bind101 --> bind10 bind102(["wdt:P1482"]) bind102 --> bind10 v3 -->v2--> v4 f11[["not "]] subgraph f11e1["Exists Clause"] bind0[/VALUES ?not/] bind0-->e1v1 bind00(["wd:Q4167410"]) bind00 --> bind0 bind01(["wd:Q101352"]) bind01 --> bind0 bind02(["wd:Q13417114"]) bind02 --> bind0 bind03(["wd:Q15632617"]) bind03 --> bind0 bind04(["wd:Q215380"]) bind04 --> bind0 bind05(["wd:Q23786"]) bind05 --> bind0 bind06(["wd:Q40056"]) bind06 --> bind0 bind07(["wd:Q3491429"]) bind07 --> bind0 bind08(["wd:Q7187"]) bind08 --> bind0 bind09(["wd:Q19798644"]) bind09 --> bind0 bind010(["wd:Q11668273"]) bind010 --> bind0 bind011(["wd:Q17155032"]) bind011 --> bind0 bind012(["wd:Q17638537"]) bind012 --> bind0 bind013(["wd:Q11446"]) bind013 --> bind0 bind014(["wd:Q2235308"]) bind014 --> bind0 bind015(["wd:Q17537576"]) bind015 --> bind0 bind016(["wd:Q8134"]) bind016 --> bind0 bind017(["wd:Q20202269"]) bind017 --> bind0 bind018(["wd:Q395"]) bind018 --> bind0 bind019(["wd:Q494452"]) bind019 --> bind0 bind020(["wd:Q1391494"]) bind020 --> bind0 bind021(["wd:Q57814795"]) bind021 --> bind0 bind022(["wd:Q1725664"]) bind022 --> bind0 bind023(["wd:Q43229"]) bind023 --> bind0 bind024(["wd:Q147276"]) bind024 --> bind0 bind025(["wd:Q15642541"]) bind025 --> bind0 bind026(["wd:Q5"]) bind026 --> bind0 bind027(["wd:Q4167836"]) bind027 --> bind0 e1v2 --"wdt:P31"--> e1a1 e1a1 --"wdt:P279"--> e1v1 e1v2("?item"):::projected e1v1("?not"):::projected e1a1((" ")):::projected end f11--EXISTS--> f11e1 f11 --> v3 f11 --> c10 f11 --> a1 f11 --> c11 f11 --> v5 bind12[/VALUES ?not/] bind12-->v5 bind120(["wd:Q4167410"]) bind120 --> bind12 bind121(["wd:Q101352"]) bind121 --> bind12 bind122(["wd:Q13417114"]) bind122 --> bind12 bind123(["wd:Q15632617"]) bind123 --> bind12 bind124(["wd:Q215380"]) bind124 --> bind12 bind125(["wd:Q23786"]) bind125 --> bind12 bind126(["wd:Q40056"]) bind126 --> bind12 bind127(["wd:Q3491429"]) bind127 --> bind12 bind128(["wd:Q7187"]) bind128 --> bind12 bind129(["wd:Q19798644"]) bind129 --> bind12 bind1210(["wd:Q11668273"]) bind1210 --> bind12 bind1211(["wd:Q17155032"]) bind1211 --> bind12 bind1212(["wd:Q17638537"]) bind1212 --> bind12 bind1213(["wd:Q11446"]) bind1213 --> bind12 bind1214(["wd:Q2235308"]) bind1214 --> bind12 bind1215(["wd:Q17537576"]) bind1215 --> bind12 bind1216(["wd:Q8134"]) bind1216 --> bind12 bind1217(["wd:Q20202269"]) bind1217 --> bind12 bind1218(["wd:Q395"]) bind1218 --> bind12 bind1219(["wd:Q494452"]) bind1219 --> bind12 bind1220(["wd:Q1391494"]) bind1220 --> bind12 bind1221(["wd:Q57814795"]) bind1221 --> bind12 bind1222(["wd:Q1725664"]) bind1222 --> bind12 bind1223(["wd:Q43229"]) bind1223 --> bind12 bind1224(["wd:Q147276"]) bind1224 --> bind12 bind1225(["wd:Q15642541"]) bind1225 --> bind12 bind1226(["wd:Q5"]) bind1226 --> bind12 bind1227(["wd:Q4167836"]) bind1227 --> bind12 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v5 f13[["not "]] subgraph f13e2["Exists Clause"] e2v1 --"wdt:P131"--> e2v2 e2v2("?_"):::projected e2v1("?item"):::projected end f13--EXISTS--> f13e2 f13 --> v3 f13 --> c12 f13 --> v4 v3 --"wdt:P131"--> v4 f14[["?desc = ?lemma"]] f14 --> v1 f14 --> v6 f15[["not "]] subgraph f15e3["Exists Clause"] e3v1 --"wdt:P5402"--> e3v2 e3v2("?homograph"):::projected e3v1("?lexeme"):::projected end f15--EXISTS--> f15e3 f15 --> v7 f15 --> c13 f15 --> v8 v7 --"wdt:P5402"--> v8 f16[["not "]] subgraph f16e4["Exists Clause"] e4v1 --"a"--> e4c2 e4v1("?item"):::projected e4c2(["wikibase:Property"]):::iri end f16--EXISTS--> f16e4 f16 --> v3 f16 --> c14 f16 --> c15 v3 --"a"--> c15 f17[["not "]] subgraph f17e5["Exists Clause"] e5v1 --"ontolex:sense"--> e5v2 e5v2 --"wdt:P5137"--> e5v3 e5v3("?item"):::projected e5v1("?lexeme"):::projected e5v2("?sense"):::projected end f17--EXISTS--> f17e5 f17 --> v7 f17 --> c16 f17 --> v9 f17 --> c17 f17 --> v3 v7 --"ontolex:sense"--> v9 v9 --"wdt:P5137"--> v3 v7 --"wikibase:lemma"--> v6 v7 --"dct:language"--> v10 v7 --"wikibase:lexicalCategory"--> v11 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P5185".-> v12 end v3 --"rdfs:label"--> v6 v3 --"schema:description"--> v1