query-ae7219a1937ef3cde38495f56049986e
title:Outdoor gyms in Sweden most viewed youtube video SELECT ?nrviews (SAMPLE(?item) AS ?WD) (SAMPLE(?OutdoorGym) AS ?OutdoorGym) ?youtube (SAMPLE(?admin) AS ?admin) (SAMPLE(?title) AS ?title) WHERE { ?item wdt:P6104 wd:Q107186275; wdt:P17 wd:Q34. OPTIONAL { ?item rdfs:label ?OutdoorGym. FILTER((LANG(?OutdoorGym)) = "sv") } OPTIONAL { ?item wdt:P18 ?img. } OPTIONAL { ?item wdt:P131 ?adminId. ?adminId rdfs:label ?admin. FILTER((LANG(?admin)) = "sv") } OPTIONAL { ?item wdt:P856 ?www. } {
{?item p:P1651 ?Pyoutubev.
?Pyoutubev ps:P1651 ?youtubev.
OPTIONAL { ?Pyoutubev pq:P1810 ?title. }
OPTIONAL { ?Pyoutubev pq:P407 ?language. }
OPTIONAL { ?Pyoutubev pq:P5436 ?nrviews. }
OPTIONAL { ?Pyoutubev pq:P2047 ?length. }
}
} BIND(URI(CONCAT("https://www.youtube.com/watch?v=", ?youtubev)) AS ?youtube) OPTIONAL { ?item wdt:P625 ?coord. } } GROUP BY ?youtube ?nrviews ORDER BY DESC (?nrviews)
Use at
- https://query.wikidata.org/sparql
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#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#title:Outdoor gyms in Sweden most viewed youtube video
SELECT ?nrviews (SAMPLE(?item) AS ?WD) (SAMPLE(?OutdoorGym) AS ?OutdoorGym) ?youtube (SAMPLE(?admin) AS ?admin) (SAMPLE(?title) AS ?title) WHERE {
?item wdt:P6104 wd:Q107186275;
wdt:P17 wd:Q34.
OPTIONAL {
?item rdfs:label ?OutdoorGym.
FILTER((LANG(?OutdoorGym)) = "sv")
}
OPTIONAL { ?item wdt:P18 ?img. }
OPTIONAL {
?item wdt:P131 ?adminId.
?adminId rdfs:label ?admin.
FILTER((LANG(?admin)) = "sv")
}
OPTIONAL { ?item wdt:P856 ?www. }
{
{?item p:P1651 ?Pyoutubev.
?Pyoutubev ps:P1651 ?youtubev.
OPTIONAL { ?Pyoutubev pq:P1810 ?title. }
OPTIONAL { ?Pyoutubev pq:P407 ?language. }
OPTIONAL { ?Pyoutubev pq:P5436 ?nrviews. }
OPTIONAL { ?Pyoutubev pq:P2047 ?length. }
}
}
BIND(URI(CONCAT("https://www.youtube.com/watch?v=", ?youtubev)) AS ?youtube)
OPTIONAL { ?item wdt:P625 ?coord. }
}
GROUP BY ?youtube ?nrviews
ORDER BY DESC (?nrviews)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v16("?OutdoorGym"):::projected
v8("?Pyoutubev")
v15("?WD")
v16("?admin"):::projected
v6("?adminId")
v14("?coord")
v5("?img")
v4("?item"):::projected
v11("?language")
v12("?length")
v1("?nrviews"):::projected
v16("?title"):::projected
v7("?www")
v13("?youtube"):::projected
v9("?youtubev")
c5(["wd:Q34"]):::iri
c3(["wd:Q107186275"]):::iri
v4 --"p:direct/P6104"--> c3
v4 --"p:direct/P17"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:label".-> v16
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P18".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P131".-> v6
v6 --"rdfs:label"--> v16
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P856".-> v7
end
v4 --"p:P1651"--> v8
v8 --"p:statement/P1651"--> v9
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P1810".-> v16
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P407".-> v11
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P5436".-> v1
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P2047".-> v12
end
bind0[/"concat('https://www.youtube.com/watch?v=',?youtubev)"/]
v9 --o bind0
bind0 --as--o v13
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P625".-> v14
end
bind5[/"sample(?item)"/]
v4 --o bind5
bind5 --as--o v15
bind6[/"sample(?OutdoorGym)"/]
v16 --o bind6
bind6 --as--o v16
bind7[/"sample(?admin)"/]
v16 --o bind7
bind7 --as--o v16
bind8[/"sample(?title)"/]
v16 --o bind8
bind8 --as--o v16