query-749f2ec7f0e47d2544784bd55c52e654

rq turtle/ttl

PalotabarátCOALESCE(?nameLang, wd:Q9067)?nameLang(Q9067)Hungarian Szűrt utónévstatisztikaCsak a magyar utónveket számolja össze 2024. július 12-én 1982 2021. május 6. 1317 2020. július 18-án 1173

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?name ?nameLabel ?count WHERE { 
    {
        SELECT ?name (COUNT(*) AS ?count) WHERE {
            {?item wdt:P27 wd:Q28} UNION {?item wdt:P27 wd:Q171150}  UNION {?item wdt:P27 wd:Q655621} .
            ?item wdt:P31 wd:Q5 .
            ?item p:P735 ?nameStatement .
            ?nameStatement ps:P735 ?name .
            OPTIONAL { ?nameStatement pq:P407 ?nameLang } .
            FILTER(COALESCE(?nameLang, wd:Q9067) = wd:Q9067) .
        } GROUP BY ?name
    }
    SERVICE wikibase:label {            # ... include the labels
        bd:serviceParam wikibase:language "hu" .
    }
} ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count"):::projected v3("?item") v5("?name"):::projected v2("?nameLang") v4("?nameStatement") c4(["wd:Q171150"]):::iri c14(["hu"]):::literal c3(["wd:Q28"]):::iri c5(["wd:Q655621"]):::iri c12(["bd:serviceParam"]):::iri c7(["wd:Q5"]):::iri f0[["?nameLang'wd:Q9067' = 'wd:Q9067'"]] f0 --> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P27"--> c5 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P27"--> c4 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P27"--> c3 end union0r <== or ==> union0l end v3 --"p:direct/P31"--> c7 v3 --"p:P735"--> v4 v4 --"p:statement/P735"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P407".-> v2 end bind2[/"count(*)"/] bind2 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end