query-76aad23c9eed4d0f4b595d97b60b45e9

rq turtle/ttl

Popular television series (in treeview) Popular television series (in treeview) Séries télévisées populaires (arborescence) Popular television series (in treeview) Popular television series (in treeview) Populaire tv-serie (in boomweergave) Populära TV-serier (i trädvy) Popular television series (in treeview) Popular television series (in treeview) 热门电视剧集(树状图)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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 bd: <http://www.bigdata.com/rdf#>
#added before 2016-10

#defaultView:TreeMap
SELECT ?show ?showLabel  ?season ?cleanSeasonLabel ?episode ?episodeLabel
WHERE
{
    {
        BIND(wd:Q886 as ?show) .
        ?season wdt:P361 ?show .
        ?season rdfs:label ?_seasonLabel.
        FILTER((LANG(?_seasonLabel)) = "en")
        BIND(SUBSTR(?_seasonLabel, 0, STRLEN(?_seasonLabel)-23) AS ?cleanSeasonLabel)
        ?episode wdt:P361 ?season .
    } 
    UNION
    {
        BIND(wd:Q16538 as ?show) .
        ?season wdt:P361 ?show .
        ?season rdfs:label ?_seasonLabel.
        FILTER((LANG(?_seasonLabel)) = "en")
        BIND(SUBSTR(?_seasonLabel, 0, STRLEN(?_seasonLabel)-20) AS ?cleanSeasonLabel)
        ?episode wdt:P361 ?season .
    }  
    UNION
    {
        BIND(wd:Q147235 as ?show) .
        ?season wdt:P361 ?show .
        ?season rdfs:label ?_seasonLabel.
        FILTER((LANG(?_seasonLabel)) = "en")
        BIND(CONCAT("S", SUBSTR(?_seasonLabel, 25)) AS ?cleanSeasonLabel)
        ?episode wdt:P361 ?season .
    }

    SERVICE wikibase:label {  bd:serviceParam wikibase:language "en" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?_seasonLabel") v6("?cleanSeasonLabel"):::projected v5("?episode"):::projected v3("?season"):::projected v6("?show"):::projected c5(["bd:serviceParam"]):::iri c1(["en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; f0[["?_seasonLabel = 'en'"]] f0 --> v1 bind1[/"'wd:Q147235'"/] bind1 --as--o v6 v3 --"wdt:P361"--> v6 v3 --"rdfs:label"--> v1 bind2[/"concat('S',substring(?_seasonLabel,'25^^xsd:integer'))"/] v1 --o bind2 bind2 --as--o v6 v5 --"wdt:P361"--> v3 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; f3[["?_seasonLabel = 'en'"]] f3 --> v1 bind4[/"'wd:Q16538'"/] bind4 --as--o v6 v3 --"wdt:P361"--> v6 v3 --"rdfs:label"--> v1 bind5[/"substring(?_seasonLabel,'0^^xsd:integer',string-length(?_seasonLabel) + '-20^^xsd:integer')"/] v1 --o bind5 bind5 --as--o v6 v5 --"wdt:P361"--> v3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f6[["?_seasonLabel = 'en'"]] f6 --> v1 bind7[/"'wd:Q886'"/] bind7 --as--o v6 v3 --"wdt:P361"--> v6 v3 --"rdfs:label"--> v1 bind8[/"substring(?_seasonLabel,'0^^xsd:integer',string-length(?_seasonLabel) + '-23^^xsd:integer')"/] v1 --o bind8 bind8 --as--o v6 v5 --"wdt:P361"--> v3 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c1 end