query-6044da04b668d0db52d44d6488600c60

rq turtle/ttl

Botanists with more than one author abbreviationWikidata:Database reports/Constraint violations/P586#"Single value" violations Wikidata:Database reports/Constraint violations/P428#"Scope" violations

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?count ?sample1  ?sample2  ?exception
WHERE
{
    {
        SELECT ?item (COUNT(?value) AS ?count) (MIN(?value) AS ?sample1) (MAX(?value) AS ?sample2) {
            ?item p:P428 [ ps:P428 ?val; wikibase:rank ?rank ] .
            FILTER( ?rank != wikibase:DeprecatedRank ) .
             {
    SELECT ?formatter WHERE {
        OPTIONAL { wd:P428 wdt:P1630 ?formatter }
    } LIMIT 1
}.
            BIND( IF( BOUND( ?formatter ), URI( REPLACE( ?formatter, '\\$1', ?val ) ), ?val ) AS ?value ) .
        } GROUP BY ?item HAVING ( ?count > 1 )
    } .
    OPTIONAL {
        wd:P428 p:P2302 [ ps:P2302 wd:Q19474404; pq:P2303 ?exc ] .
        FILTER( ?exc = ?item ) .
    } .
    BIND( BOUND( ?exc ) AS ?exception ) .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?count"):::projected v2("?exc") v10("?exception"):::projected v6("?formatter") v3("?item"):::projected v4("?rank") v8("?sample1"):::projected v9("?sample2"):::projected v5("?val") v7("?value") a1((" ")) a2((" ")) c15(["en"]):::literal c6(["wd:P428"]):::iri c9(["wd:Q19474404"]):::iri c13(["bd:serviceParam"]):::iri f0[["?count > '1^^xsd:integer'"]] f0 --> v8 f1[["?rank != 'wikibase:DeprecatedRank'"]] f1 --> v4 a1 --"p:statement/P428"--> v5 a1 --"wikibase:rank"--> v4 v3 --"p:P428"--> a1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; c6 -."p:direct/P1630".-> v6 end bind2[/"if(bound(?formatter),replace(?formatter,'\$1',?val),?val)"/] v6 --o bind2 v5 --o bind2 bind2 --as--o v7 bind6[/"count(?value)"/] v7 --o bind6 bind6 --as--o v8 bind7[/"min(?value)"/] v7 --o bind7 bind7 --as--o v8 bind8[/"max(?value)"/] v7 --o bind8 bind8 --as--o v9 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; a2 -."p:statement/P2302".-> c9 a2 --"p:qualifier/P2303"--> v2 c6 --"p:P2302"--> a2 end bind9[/"bound(?exc)"/] v2 --o bind9 bind9 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end