query-2248e2b79dc0df5f2ff74159a1fce04c

rq turtle/ttl

Possible issues with birth- and/or deathdate

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?authorabbrv ?itemLabelDe (SUBSTR(?birthdate1, 1, 10) as ?birthdate) (SUBSTR(?deathdate1, 1, 10) as ?deathdate) WHERE {
  ?item wdt:P428 ?authorabbrv .
  OPTIONAL {?item wdt:P569 ?birthdate1} .
  OPTIONAL {?item wdt:P570 ?deathdate1} .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
    ?item rdfs:label ?itemLabelDe .
  }
  {
  SELECT ?authorabbrv (COUNT(?authorabbrv) AS ?no_authorabbrv) WHERE { 
     ?item wdt:P428 ?authorabbrv .
     OPTIONAL {?item wdt:P569 ?birthdate} .
     OPTIONAL {?item wdt:P570 ?deathdate} .  
  }
  GROUP BY ?authorabbrv
  HAVING(?no_authorabbrv > 1)         
  }
}
ORDER BY ASC(?authorabbrv)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?authorabbrv"):::projected v9("?birthdate") v3("?birthdate1"):::projected v9("?deathdate") v4("?deathdate1"):::projected v2("?item"):::projected v5("?itemLabelDe"):::projected v9("?no_authorabbrv") c7(["de"]):::literal c5(["bd:serviceParam"]):::iri v2 --"wdt:P428"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P569".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P570".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 v2 --"rdfs:label"--> v5 end f0[["?no_authorabbrv > '1^^xsd:integer'"]] f0 --> v9 v2 --"wdt:P428"--> v1 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P569".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P570".-> v9 end bind2[/"count(?authorabbrv)"/] v1 --o bind2 bind2 --as--o v9 bind3[/"substring(?birthdate1,'1^^xsd:integer','10^^xsd:integer')"/] v3 --o bind3 bind3 --as--o v9 bind4[/"substring(?deathdate1,'1^^xsd:integer','10^^xsd:integer')"/] v4 --o bind4 bind4 --as--o v9