query-676b4aac025a51101a4a8ecb293d1c17
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?lastname ?lastnameLabel
WHERE
{
{ SELECT ?lastname ?lastnameLabel WHERE
{
{
SELECT (COUNT(*) AS ?count) ?lastname WHERE {
?person wdt:P27 wd:Q20 .
?person wdt:P734 ?lastname .
} GROUP BY ?lastname HAVING (?count>99) } ?lastname rdfs:label ?lastnameLabel. filter(lang(?lastnameLabel)="nn")
} }
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search";
wikibase:endpoint "www.wikidata.org";
mwapi:srsearch ?lastnameLabel.
?item wikibase:apiOutputItem mwapi:title .
}
?item wdt:P31 wd:Q5.
FILTER NOT EXISTS { ?item wdt:P734 []. }
FILTER NOT EXISTS { ?item wdt:P27 []. }
?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en") filter(strends(str(?itemLabel),?lastnameLabel))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nn,en". }
} ORDER BY ?lastnameLabel ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?count")
v3("?item"):::projected
v2("?itemLabel"):::projected
v6("?lastname"):::projected
v1("?lastnameLabel"):::projected
v5("?person")
a2((" "))
a1((" "))
c13(["www.wikidata.org"]):::literal
c6(["wd:Q20"]):::iri
c21(["#91;AUTO_LANGUAGE#93;,nn,en"]):::literal
c9(["bd:serviceParam"]):::iri
c11(["Search"]):::literal
c18(["wd:Q5"]):::iri
c16(["mwapi:title"]):::iri
f0[["ends-with(str(?itemLabel),?lastnameLabel)"]]
f0 --> v2
f0 --> v1
f1[["?itemLabel = 'en'"]]
f1 --> v2
f2[["not "]]
subgraph f2e0["Exists Clause"]
e0v1 --"wdt:P27"--> e0a1
e0v1("?item"):::projected
e0a1((" ")):::projected
end
f2--EXISTS--> f2e0
f2 --> v3
f2 --> c2
f2 --> a1
v3 --"wdt:P27"--> a1
f3[["not "]]
subgraph f3e1["Exists Clause"]
e1v1 --"wdt:P734"--> e1a1
e1v1("?item"):::projected
e1a1((" ")):::projected
end
f3--EXISTS--> f3e1
f3 --> v3
f3 --> c3
f3 --> a2
v3 --"wdt:P734"--> a2
f4[["?lastnameLabel = 'nn'"]]
f4 --> v1
f5[["?count > '99^^xsd:integer'"]]
f5 --> v7
v5 --"wdt:P27"--> c6
v5 --"wdt:P734"--> v6
bind7[/"count(*)"/]
bind7 --as--o v7
v6 --"rdfs:label"--> v1
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c9 --"mwapi:api"--> c11
c9 --"mwapi:endpoint"--> c13
c9 --"mwapi:srsearch"--> v1
v3 --"mwapi:apiOutputItem"--> c16
end
v3 --"wdt:P31"--> c18
v3 --"rdfs:label"--> v2
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c9 --"mwapi:language"--> c21
end