query-72a97ba27f9361020d2994bd224d4637

rq turtle/ttl

Series ordinals for multiple given names

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item ?qid WHERE {
  {
    SELECT ?item (COUNT(?givenname) AS ?cnt) WHERE {
      ?item wdt:P106 wd:Q13382576 .
      ?item wdt:P735 ?givenname .
    } GROUP BY ?item
  }
  FILTER(?cnt > 1) .
  MINUS { ?item p:P735/pq:P1545 [] }
  BIND(xsd:integer(SUBSTR(STR(?item), 33)) AS ?qid) .
} ORDER BY DESC(?qid)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?cnt") v4("?givenname") v3("?item"):::projected v5("?qid"):::projected a2((" ")) a1((" ")) c3(["wd:Q13382576"]):::iri f0[["?cnt > '1^^xsd:integer'"]] f0 --> v5 v3 --"p:direct/P106"--> c3 v3 --"p:direct/P735"--> v4 bind2[/"count(?givenname)"/] v4 --o bind2 bind2 --as--o v5 subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v3 --"p:P735"--> a1 a1 --"p:qualifier/P1545"--> a2 end bind4[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/] v3 --o bind4 bind4 --as--o v5