query-16937085aab5a54eeb305d202c9ca8c1
rq turtle/ttl
) disambiguations or incomplete elements, which I don't want.(Q4167410)Wikimedia disambiguation page (P31) instance of" - without it Google sometimes outputs ids for unregistered (without Thing), searching by sitelink names. Other important filter is "types=MREID Resolver or API explorer (https://kgsearch.googleapis.com/v1/entities:search?key=&query=Wolfgang+Amadeus+Mozart&languages=en&languages=fr&languages=de&languages=ja&languages=pt&languages=ru&languages=es&languages=ar&languages=bn&languages=ca&languages=zh&languages=cs&languages=nl&languages=fi&languages=el&languages=hi&languages=hu&languages=id&languages=it&languages=ko&languages=no&languages=fa&languages=pl&languages=sv&languages=tr&languages=uk&languages=vi&languages=sq&languages=hy&languages=eu&languages=bg&languages=hr&languages=da&languages=gl&languages=is&languages=lv&languages=lt&languages=ro&languages=sr&languages=sk&languages=sl&languages=th&languages=ga&languages=km&languages=lo&types=Thing&limit=500Hi, I'm using queries like There is a daily free limit of 100 000 searches in entities:search, which is more than enough for my goals.To get a bunch of QIDs for processing, I currently use this form of query:
Use at
https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?article ?name WHERE {
SERVICE bd:slice {
?article schema:isPartOf <https://en.wikipedia.org/>.
bd:serviceParam bd:slice.offset 6080000 .
bd:serviceParam bd:slice.limit 10000 .
}
?article schema:about ?item .
FILTER NOT EXISTS { ?item wdt:P31 wd:Q4167836 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q4167410 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q14204246 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q11753321 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q30432511 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q4820 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q101352 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q3186692 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q577 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q13406463 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q29964144 }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q22808320 }
OPTIONAL { ?item wdt:P646 ?a }
FILTER(!BOUND(?a)).
OPTIONAL { ?item wdt:P2671 ?b }
FILTER(!BOUND(?b)).
?article schema:name ?name .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?a")
v4("?article"):::projected
v1("?b")
v3("?item"):::projected
v5("?name"):::projected
c2(["wd:Q22808320"]):::iri
c7(["wd:Q101352"]):::iri
c12(["wd:Q4167410"]):::iri
c11(["wd:Q14204246"]):::iri
c4(["wd:Q13406463"]):::iri
c5(["wd:Q577"]):::iri
c16([https://en.wikipedia.org/]):::iri
c17(["bd:serviceParam"]):::iri
c19(["6080000^^xsd:integer"]):::literal
c3(["wd:Q29964144"]):::iri
c9(["wd:Q30432511"]):::iri
c10(["wd:Q11753321"]):::iri
c6(["wd:Q3186692"]):::iri
c21(["10000^^xsd:integer"]):::literal
c13(["wd:Q4167836"]):::iri
c8(["wd:Q4820"]):::iri
f0[["not bound(?b)"]]
f0 --> v1
f1[["not bound(?a)"]]
f1 --> v2
f2[["not "]]
subgraph f2e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?item"):::projected
e0c2(["wd:Q22808320"]):::iri
end
f2--EXISTS--> f2e0
f2 --> v3
f2 --> c1
f2 --> c2
v3 --"wdt:P31"--> c2
f3[["not "]]
subgraph f3e1["Exists Clause"]
e1v1 --"wdt:P31"--> e1c2
e1v1("?item"):::projected
e1c2(["wd:Q29964144"]):::iri
end
f3--EXISTS--> f3e1
f3 --> v3
f3 --> c1
f3 --> c3
v3 --"wdt:P31"--> c3
f4[["not "]]
subgraph f4e2["Exists Clause"]
e2v1 --"wdt:P31"--> e2c2
e2v1("?item"):::projected
e2c2(["wd:Q13406463"]):::iri
end
f4--EXISTS--> f4e2
f4 --> v3
f4 --> c1
f4 --> c4
v3 --"wdt:P31"--> c4
f5[["not "]]
subgraph f5e3["Exists Clause"]
e3v1 --"wdt:P31"--> e3c2
e3v1("?item"):::projected
e3c2(["wd:Q577"]):::iri
end
f5--EXISTS--> f5e3
f5 --> v3
f5 --> c1
f5 --> c5
v3 --"wdt:P31"--> c5
f6[["not "]]
subgraph f6e4["Exists Clause"]
e4v1 --"wdt:P31"--> e4c2
e4v1("?item"):::projected
e4c2(["wd:Q3186692"]):::iri
end
f6--EXISTS--> f6e4
f6 --> v3
f6 --> c1
f6 --> c6
v3 --"wdt:P31"--> c6
f7[["not "]]
subgraph f7e5["Exists Clause"]
e5v1 --"wdt:P31"--> e5c2
e5v1("?item"):::projected
e5c2(["wd:Q101352"]):::iri
end
f7--EXISTS--> f7e5
f7 --> v3
f7 --> c1
f7 --> c7
v3 --"wdt:P31"--> c7
f8[["not "]]
subgraph f8e6["Exists Clause"]
e6v1 --"wdt:P31"--> e6c2
e6v1("?item"):::projected
e6c2(["wd:Q4820"]):::iri
end
f8--EXISTS--> f8e6
f8 --> v3
f8 --> c1
f8 --> c8
v3 --"wdt:P31"--> c8
f9[["not "]]
subgraph f9e7["Exists Clause"]
e7v1 --"wdt:P31"--> e7c2
e7v1("?item"):::projected
e7c2(["wd:Q30432511"]):::iri
end
f9--EXISTS--> f9e7
f9 --> v3
f9 --> c1
f9 --> c9
v3 --"wdt:P31"--> c9
f10[["not "]]
subgraph f10e8["Exists Clause"]
e8v1 --"wdt:P31"--> e8c2
e8v1("?item"):::projected
e8c2(["wd:Q11753321"]):::iri
end
f10--EXISTS--> f10e8
f10 --> v3
f10 --> c1
f10 --> c10
v3 --"wdt:P31"--> c10
f11[["not "]]
subgraph f11e9["Exists Clause"]
e9v1 --"wdt:P31"--> e9c2
e9v1("?item"):::projected
e9c2(["wd:Q14204246"]):::iri
end
f11--EXISTS--> f11e9
f11 --> v3
f11 --> c1
f11 --> c11
v3 --"wdt:P31"--> c11
f12[["not "]]
subgraph f12e10["Exists Clause"]
e10v1 --"wdt:P31"--> e10c2
e10v1("?item"):::projected
e10c2(["wd:Q4167410"]):::iri
end
f12--EXISTS--> f12e10
f12 --> v3
f12 --> c1
f12 --> c12
v3 --"wdt:P31"--> c12
f13[["not "]]
subgraph f13e11["Exists Clause"]
e11v1 --"wdt:P31"--> e11c2
e11v1("?item"):::projected
e11c2(["wd:Q4167836"]):::iri
end
f13--EXISTS--> f13e11
f13 --> v3
f13 --> c1
f13 --> c13
v3 --"wdt:P31"--> c13
subgraph s1["http://www.bigdata.com/rdf#slice"]
style s1 stroke-width:4px;
v4 --"schema:isPartOf"--> c16
c17 --"bd:slice.offset"--> c19
c17 --"bd:slice.limit"--> c21
end
v4 --"schema:about"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P646".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P2671".-> v1
end
v4 --"schema:name"--> v5
Documentation built with MkDocs using Windmill theme by Grist Labs.