query-8b3f237e64172bba08aac802402bc906

rq turtle/ttl

Number of mentioned places per novel

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT   ?novel ?nid (COUNT(DISTINCT ?place) as ?count)
WHERE {
  VALUES ?collection {
    wd:Q106936149
    wd:Q109123373
  }
    ?novel  wdt:P31  wd:Q7725634;
            wdt:P50 ?author;
            wdt:P747 ?edition.
            ?edition wdt:P1433 ?collection.
    OPTIONAL {
        ?novel wdt:P840 ?place.
    }
    OPTIONAL {
        ?novel rdfs:label ?nid
        filter (lang(?nid) = "sr")
    }
}
GROUP BY ?novel ?nid

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?author") v2("?collection") v7("?count") v5("?edition") v1("?nid"):::projected v3("?novel"):::projected v6("?place"):::projected c3(["wd:Q7725634"]):::iri bind0[/VALUES ?collection/] bind0-->v2 bind00(["wd:Q106936149"]) bind00 --> bind0 bind01(["wd:Q109123373"]) bind01 --> bind0 v3 --"wdt:P31"--> c3 v3 --"wdt:P50"--> v4 v3 --"wdt:P747"--> v5 v5 --"wdt:P1433"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P840".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."rdfs:label".-> v1 end bind2[/"count(?place)"/] v6 --o bind2 bind2 --as--o v7