query-a49a618de27f9bedcc5d3c02cfa5526a
title:Italian homonym people with or without SBN SELECT (SAMPLE(?itemlabel_) AS ?itemlabel) (GROUP_CONCAT(STRAFTER(STR(?item_), STR(wd:)); SEPARATOR=", ") AS ?items) (GROUP_CONCAT(STR(?authid_); SEPARATOR=", ") AS ?authid) (COUNT(?item_) AS ?count) WITH { SELECT DISTINCT ?item_ WHERE { VALUES ?v { wd:Q172579 wd:Q38 } ?item_ wdt:P27 ?v ; wdt:P214 []. } } as %i WHERE { INCLUDE %i ?item_ rdfs:label ?itemlabel_ . FILTER(LANG(?itemlabel_) = "it") OPTIONAL { ?item_ wdt:P396 ?authid_ . } } GROUP BY ?itemlabel_ HAVING (?count > 1) ORDER BY DESC(?count) (?itemlabel) LIMIT 500
Use at
- https://query.wikidata.org/sparql
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#>
#title:Italian homonym people with or without SBN
SELECT
(SAMPLE(?itemlabel_) AS ?itemlabel)
(GROUP_CONCAT(STRAFTER(STR(?item_), STR(wd:)); SEPARATOR=", ") AS ?items)
(GROUP_CONCAT(STR(?authid_); SEPARATOR=", ") AS ?authid)
(COUNT(?item_) AS ?count)
WHERE {
{ SELECT DISTINCT ?item_ WHERE {
VALUES ?v { wd:Q172579 wd:Q38 }
?item_ wdt:P27 ?v ; wdt:P214 [].
} } ?item_ rdfs:label ?itemlabel_ . FILTER(LANG(?itemlabel_) = "it")
OPTIONAL { ?item_ wdt:P396 ?authid_ . }
}
GROUP BY ?itemlabel_
HAVING (?count > 1)
ORDER BY DESC(?count) (?itemlabel)
LIMIT 500
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?authid")
v6("?authid_"):::projected
v9("?count")
v5("?item_"):::projected
v7("?itemlabel")
v3("?itemlabel_"):::projected
v7("?items")
v4("?v")
a1((" "))
f0[["?count > '1^^xsd:integer'"]]
f0 --> v9
f1[["?itemlabel_ = 'it'"]]
f1 --> v3
bind2[/VALUES ?v/]
bind2-->v4
bind20(["wd:Q172579"])
bind20 --> bind2
bind21(["wd:Q38"])
bind21 --> bind2
v5 --"wdt:P27"--> v4
v5 --"wdt:P214"--> a1
v5 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P396".-> v6
end
bind7[/"sample(?itemlabel_)"/]
v3 --o bind7
bind7 --as--o v7
bind8[/"substring-after(str(?item_),str('wd:'))"/]
v5 --o bind8
bind8 --as--o v7
bind9[/"str(?authid_)"/]
v6 --o bind9
bind9 --as--o v8
bind10[/"count(?item_)"/]
v5 --o bind10
bind10 --as--o v9