query-33a44acce74e87c7dfda5e6b658401b1

rq turtle/ttl

Propertiesstart time (P580)location (P276)country (P17)distribution map (P1846)subreddit (P3984)hashtag (P2572)instance of (P31)number of deaths (P1120)number of cases (P1603)of (P642)

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 ?beginning ?countryLabel ?locationLabel ?deaths ?cases  ?distribution_map 

( GROUP_CONCAT ( DISTINCT ?subreddit; separator="; " ) AS ?subreddits )
( GROUP_CONCAT ( DISTINCT ?hashtag; separator="; " ) AS ?hashtags )

WHERE
{
    ?item p:P31 ?statement. 
      ?statement ps:P31 wd:Q3241045. 
      ?statement pq:P642 wd:Q84263196. 

    OPTIONAL{?item wdt:P580  ?beginning .}     
    OPTIONAL{?item wdt:P276  ?location .}
    OPTIONAL{?item wdt:P17   ?country .} 

# Using p instead of wdt to ignore ranking.

    OPTIONAL{?item p:P1120 [ps:P1120 ?deaths] .} 
    OPTIONAL{?item p:P1603 [ps:P1603 ?cases] .}
    OPTIONAL{?item wdt:P1846 ?distribution_map .}
    OPTIONAL{?item wdt:P3984 ?subreddit .}    
    OPTIONAL{?item wdt:P2572 ?hashtag .} 

# Get only the highest number for these status.
    FILTER NOT EXISTS {
    ?item p:P1120 [ps:P1120 ?deaths_] .
    FILTER (?deaths_ > ?deaths)
}
        FILTER NOT EXISTS {
    ?item p:P1603 [ps:P1603 ?cases_] .
    FILTER (?cases_ > ?cases)
}

    SERVICE wikibase:label { #BabelRainbow
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"
    }
}
GROUP BY  ?item ?itemLabel ?beginning ?countryLabel ?locationLabel ?deaths ?cases  ?distribution_map 
ORDER BY ?item

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?beginning"):::projected v3("?cases"):::projected v2("?cases_") v9("?country") v5("?deaths"):::projected v4("?deaths_") v10("?distribution_map"):::projected v12("?hashtag"):::projected v14("?hashtags") v1("?item"):::projected v8("?location") v6("?statement") v11("?subreddit"):::projected v13("?subreddits") a3((" ")) a4((" ")) a2((" ")) a1((" ")) c9(["wd:Q84263196"]):::iri c7(["wd:Q3241045"]):::iri c17(["bd:serviceParam"]):::iri c19(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["?cases_ > ?cases"]] e0f0 --> e0v1 e0f0 --> e0v2 e0a1 --"p:statement/P1603"--> e0v1 e0v3 --"p:P1603"--> e0a1 e0v2("?cases"):::projected e0v1("?cases_"):::projected e0v3("?item"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> v3 f0 --> a1 f0 --> c1 f0 --> v1 f0 --> c2 f1[["?cases_ > ?cases"]] f1 --> v2 f1 --> v3 a1 --"p:statement/P1603"--> v2 v1 --"p:P1603"--> a1 f2[["not "]] subgraph f2e1["Exists Clause"] e1f0[["?deaths_ > ?deaths"]] e1f0 --> e1v1 e1f0 --> e1v2 e1a1 --"p:statement/P1120"--> e1v1 e1v3 --"p:P1120"--> e1a1 e1v2("?deaths"):::projected e1v1("?deaths_"):::projected e1v3("?item"):::projected e1a1((" ")):::projected end f2--EXISTS--> f2e1 f2 --> v4 f2 --> v5 f2 --> a2 f2 --> c3 f2 --> v1 f2 --> c4 f3[["?deaths_ > ?deaths"]] f3 --> v4 f3 --> v5 a2 --"p:statement/P1120"--> v4 v1 --"p:P1120"--> a2 v1 --"p:P31"--> v6 v6 --"p:statement/P31"--> c7 v6 --"p:qualifier/P642"--> c9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P580".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P276".-> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P17".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; a3 -."p:statement/P1120".-> v5 v1 --"p:P1120"--> a3 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; a4 -."p:statement/P1603".-> v3 v1 --"p:P1603"--> a4 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P1846".-> v10 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P3984".-> v11 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P2572".-> v12 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end bind6[/"?subreddit"/] v11 --o bind6 bind6 --as--o v13 bind7[/"?hashtag"/] v12 --o bind7 bind7 --as--o v14