query-4a288ecb7669b71cc0eea22c97ca5c71
Fix ru description for given names
Use at
- https://query.wikidata.org/sparql
 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT *
{
    # male given names
    ?item schema:description "мужское личное имя"@ru .
    ?item wdt:P282 wd:Q8229 .
    MINUS { ?item wdt:P282 ?ws . FILTER(?ws != wd:Q8229 ) }   # remove some items that may have a second P282 incorrectly defined
    ?item wdt:P1705 ?nl . 
    FILTER ( regex (?nl, "^[A-Z].+$") )   # basic filter for Latin script
    ?item wdt:P31 wd:Q12308941 .
    MINUS { ?item wdt:P31 ?instance . FILTER(?instance != wd:Q12308941 ) }   # to be safe, remove items that have a second P31 defined
    BIND ( CONCAT("мужское личное имя - ", str(?nl) ) as ?new_ru_description) 
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?instance"):::projected 
  v2("?item"):::projected 
  v5("?new_ru_description"):::projected 
  v1("?nl"):::projected 
  v3("?ws"):::projected 
  c8(["wd:Q12308941"]):::iri 
  c5(["wd:Q8229"]):::iri 
  c3([sмужское личное имя^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>"]):::literal 
  f0[["regex(?nl,'^#91;A-Z#93;.+$')"]]
  f0 --> v1
  v2 --"schema:description"-->  c3
  v2 --"wdt:P282"-->  c5
  subgraph minus1["MINUS"]
    style minus1 stroke-width:6px,fill:pink,stroke:red;
    f2[["?ws != 'wd:Q8229'"]]
    f2 --> v3
    v2 --"wdt:P282"-->  v3
  end
  v2 --"wdt:P1705"-->  v1
  v2 --"wdt:P31"-->  c8
  subgraph minus3["MINUS"]
    style minus3 stroke-width:6px,fill:pink,stroke:red;
    f4[["?instance != 'wd:Q12308941'"]]
    f4 --> v4
    v2 --"wdt:P31"-->  v4
  end
  bind5[/"concat('мужское личное имя - ',str(?nl))"/]
  v1 --o bind5
  bind5 --as--o v5