query-05f3331bdf4ad4f2ae4797266d6bdc3c

rq turtle/ttl

This returns some 729 results. There aren't that many Netflix Originals, and the reason this number is so high is because it is returning a row for every episode of each Netflix Original television series. I only want to return one row for each series - I'm not really that interested in the level of detail of episode at the moment. I'm sure the solution to this is very simple, and that I'm probably going about things the wrong way with the code above, so I'd really appreciate any input on this. And one last question - another the reason the list is so long is because not only are there rows for every episode, there are also multiple rows for episodes with more than one genre. If and when I manage to get this to return just titles of programmes/films, I assume it's going to give me multiple rows for each instance where there are multiple genres. Is there a way to just choose the first instance of the genre (which presumably is the primary genre) and/or have all genres appear in the same row? ).contribs • [[User talk:|talk]] ([[User:|?]] comment was added byunsignedThe preceding – Maybe something like the following can work for you. I skipped P31 entirely, but use MINUS to exclude episodes and seasons. ?title ORDER BY } } ."[AUTO_LANGUAGE],en" language:wikibase serviceParam:bd { label:wikibase SERVICE } Q3464665:wd P31:wdt ?item { MINUS } Q21191270:wd P31:wdt ?item { MINUS } .?narrlocation P840:wdt ?item{ OPTIONAL } .?genre P136:wdt ?item{ OPTIONAL } ?title P1476:wdt ?item{ OPTIONAL .Q907311:wd P449:wdt ?item { WHERE ?narrlocationLabel ?genreLabel ?itemDescription ?itemLabel ?item ?title SELECT 15:08, 30 August 2019 (UTC) Jura --- Below a version that groups by film/series:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
  ?item ?itemLabel ?itemDescription 
  (SAMPLE(?title) as ?title) 
  (GROUP_CONCAT(DISTINCT ?genreLabel; separator= ", ") as ?genres) 
  (GROUP_CONCAT(DISTINCT ?locationLabel; separator= ", ") as ?narrlocs) 
WHERE
{
    { SELECT ?item ?itemLabel ?itemDescription ?title ?genreLabel ?locationLabel 
    WHERE 
    {

        ?item wdt:P449 wd:Q907311.
        OPTIONAL {?item wdt:P1476 ?title }  
        OPTIONAL {?item wdt:P136 ?genre. }
        OPTIONAL {?item wdt:P840 ?location. } 
        MINUS { ?item wdt:P31 wd:Q21191270 }
        MINUS { ?item wdt:P31 wd:Q3464665 }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
   }
}          
GROUP BY ?item ?itemLabel ?itemDescription
ORDER BY ?title

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?genre") v5("?genreLabel"):::projected v7("?genres") v2("?item"):::projected v4("?location") v6("?locationLabel"):::projected v8("?narrlocs") v7("?title"):::projected c10(["bd:serviceParam"]):::iri c12(["en"]):::literal c2(["wd:Q907311"]):::iri c8(["wd:Q3464665"]):::iri c7(["wd:Q21191270"]):::iri v2 --"wdt:P449"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1476".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P136".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P840".-> v4 end subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> c7 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> c8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind5[/"sample(?title)"/] v7 --o bind5 bind5 --as--o v7 bind6[/"?genreLabel"/] v5 --o bind6 bind6 --as--o v7 bind7[/"?locationLabel"/] v6 --o bind7 bind7 --as--o v8