query-4e236e932cda9fba04d641a21cf389de

rq turtle/ttl

Most frequently variants of given names Anton

# Query to find the most-frequently represented # variants of the male given name ?tgt_name # when ?tgt_name = Q2958359 # Query generated by [[Template:NameVariantStatsM]]

SELECT distinct ?name ?nameLabel ?nameDescription ?string ?count ?example ?exampleLabel WHERE { hint:Query hint:optimizer "None" . { SELECT distinct ?name ?string (COUNT(DISTINCT ?a) AS ?count) (SAMPLE(?a) AS ?example) WHERE { { SELECT DISTINCT ?name ?string WHERE { {?name wdt:P460 wd:Q35663473 } UNION { wd:Q35663473 wdt:P460 ?name} . ?name wdt:P31 wd:Q12308941 . ?name wdt:P1705 ?string. } } . ?a wdt:P735 ?name . ?a wdt:P31 wd:Q5 .

?a wdt:P27 wd:болгария.

} GROUP BY ?name ?string

} . SERVICE wikibase:label { bd:serviceParam wikibase:language "ru,en" . } }

HAVING (?count > 1)

ORDER BY DESC(?count) ?itemLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Most frequently variants of given names Anton

   #  Query to find the most-frequently represented
   #  variants of the male given name ?tgt_name
   #  when ?tgt_name = Q2958359
   #  Query generated by [[Template:NameVariantStatsM]]

SELECT distinct ?name ?nameLabel ?nameDescription ?string ?count ?example ?exampleLabel WHERE {

  {
    SELECT distinct ?name ?string (COUNT(DISTINCT ?a) AS ?count) (SAMPLE(?a) AS ?example) WHERE {
       { 
         SELECT DISTINCT ?name ?string WHERE {
            {?name wdt:P460* wd:Q35663473 } UNION { wd:Q35663473 wdt:P460* ?name} .
            ?name wdt:P31 wd:Q12308941 .
         ?name wdt:P1705 ?string.
         }
       } .
       ?a wdt:P735 ?name .
       ?a wdt:P31 wd:Q5 .
#       ?a wdt:P27 wd:болгария.
    } GROUP BY ?name ?string
  } . 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "ru,en" .
  }
}
# HAVING (?count > 1)
ORDER BY DESC(?count) ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?a") v6("?count"):::projected v6("?example"):::projected v2("?itemLabel") v3("?name"):::projected v4("?string"):::projected c2(["wd:Q35663473"]):::iri c4(["wd:Q12308941"]):::iri c9(["bd:serviceParam"]):::iri c7(["wd:Q5"]):::iri c11(["ru,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; c2 --"wdt:P460"--> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P460"--> c2 end union0r <== or ==> union0l end v3 --"wdt:P31"--> c4 v3 --"wdt:P1705"--> v4 v5 --"wdt:P735"--> v3 v5 --"wdt:P31"--> c7 bind2[/"count(?a)"/] v5 --o bind2 bind2 --as--o v6 bind3[/"sample(?a)"/] v5 --o bind3 bind3 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end