query-7f4a3378e0fdc0b4741773bca8b2344c

rq turtle/ttl

Most frequently variants of given names Nikola

# 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 WHERE { hint:Query hint:optimizer "None" . { SELECT distinct ?name ?string (COUNT(DISTINCT ?a) AS ?count) WHERE { { SELECT DISTINCT ?name ?string WHERE { {?name wdt:P460 wd:Q15501913 } UNION { wd:Q15501913 wdt:P460 ?name} . ?name wdt:P31 wd:Q12308941 . ?name wdt:P1705 ?string. } } . ?a wdt:P735 ?name . ?a wdt:P31 wd:Q5 . } GROUP BY ?name ?string } . SERVICE wikibase:label { bd:serviceParam wikibase:language "bg,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 Nikola

   #  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 WHERE {

  {
    SELECT distinct ?name ?string (COUNT(DISTINCT ?a) AS ?count) WHERE {
       { 
         SELECT DISTINCT ?name ?string WHERE {
            {?name wdt:P460* wd:Q15501913 } UNION { wd:Q15501913 wdt:P460* ?name} .
            ?name wdt:P31 wd:Q12308941 .
         ?name wdt:P1705 ?string.
         }
       } .
       ?a wdt:P735 ?name .
       ?a wdt:P31 wd:Q5 .
    } GROUP BY ?name ?string
  } . 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "bg,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 v2("?itemLabel") v3("?name"):::projected v4("?string"):::projected c4(["wd:Q12308941"]):::iri c9(["bd:serviceParam"]):::iri c11(["bg,en"]):::literal c7(["wd:Q5"]):::iri c2(["wd:Q15501913"]):::iri 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 bind1[/"count(?a)"/] v5 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end