query-b44275172171afa07066ae794bcfed69

rq turtle/ttl

title:Nr views of Outdoor gyms videos in Sweden per producer SELECT ?producerWD ?producer ?description (sum(?nrviews) AS ?nrViewsTotal) (count(?nrviews) AS ?nrVideos) ?www WHERE { ?item wdt:P6104 wd:Q107186275; wdt:P17 wd:Q34. { ?item p:P1651 ?Pyoutubev. ?Pyoutubev ps:P1651 ?youtubev. OPTIONAL { ?Pyoutubev pq:P407 ?language. } OPTIONAL { ?Pyoutubev pq:P5436 ?nrviews. } ?Pyoutubev pq:P2397 ?channel. ?producerWD wdt:P2397 ?channel. OPTIONAL { ?producerWD rdfs:label ?producer. FILTER((LANG(?producer)) = "en")} OPTIONAL{ ?producerWD schema:description ?description. FILTER((LANG(?description)) = "en") } OPTIONAL { ?producerWD wdt:P856 ?www.} OPTIONAL { ?producerWD wdt:P1581 ?www.} } } GROUP BY ?channel ?producer ?www ?description ?producerWD ORDER BY DESC (?nrViewsTotal)

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#title:Nr views of Outdoor gyms videos in Sweden per producer
SELECT ?producerWD ?producer ?description
(sum(?nrviews) AS ?nrViewsTotal)
(count(?nrviews) AS ?nrVideos)  ?www WHERE {
  ?item wdt:P6104 wd:Q107186275;
    wdt:P17 wd:Q34.
  {
    ?item p:P1651 ?Pyoutubev.
    ?Pyoutubev ps:P1651 ?youtubev.
    OPTIONAL { ?Pyoutubev pq:P407 ?language. }
    OPTIONAL { ?Pyoutubev pq:P5436 ?nrviews. }
    ?Pyoutubev pq:P2397 ?channel.
    ?producerWD wdt:P2397 ?channel.
    OPTIONAL {
      ?producerWD rdfs:label ?producer.
      FILTER((LANG(?producer)) = "en")}
     OPTIONAL{  ?producerWD schema:description ?description.
      FILTER((LANG(?description)) = "en")
    }
  OPTIONAL { ?producerWD wdt:P856 ?www.}
  OPTIONAL { ?producerWD wdt:P1581 ?www.} 
  }
}
GROUP BY ?channel ?producer ?www ?description ?producerWD
ORDER BY DESC (?nrViewsTotal)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?Pyoutubev") v9("?channel") v3("?description"):::projected v2("?item") v7("?language") v12("?nrVideos") v12("?nrViewsTotal") v8("?nrviews"):::projected v4("?producer"):::projected v10("?producerWD"):::projected v11("?www"):::projected v6("?youtubev") c4(["wd:Q34"]):::iri c2(["wd:Q107186275"]):::iri v2 --"p:direct/P6104"--> c2 v2 --"p:direct/P17"--> c4 v2 --"p:P1651"--> v5 v5 --"p:statement/P1651"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P407".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P5436".-> v8 end v5 --"p:qualifier/P2397"--> v9 v10 --"p:direct/P2397"--> v9 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v10 -."rdfs:label".-> v4 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v10 -."schema:description".-> v3 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v10 -."p:direct/P856".-> v11 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v10 -."p:direct/P1581".-> v11 end bind2[/"sum(?nrviews)"/] v8 --o bind2 bind2 --as--o v12 bind3[/"count(?nrviews)"/] v8 --o bind3 bind3 --as--o v12