query-ac079deedd07822cf2d1ac61c03c6eae

rq turtle/ttl

TODO

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#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?dir ?familyName ?director ?count ?episodes 



WHERE {
   {
  SELECT ?dir (COUNT(?ordinal) as ?count) (GROUP_CONCAT(?ordinal;separator=", ") AS ?episodes) WHERE {
     {
  SELECT (str(?ord) AS ?ordinal) ?dir WHERE {
    ?film p:P179 ?series . ?series v:P179 wd:Q689438 . ?series pq:P1545 ?ord .
    ?film wdt:P577 ?publication . FILTER(year(?publication)<2022)
    ?film wdt:P57 ?dir .
  } ORDER BY ?ord
}.
  } GROUP BY ?dir 
}.
  ?dir rdfs:label ?director . FILTER(lang(?director) = "de")
  OPTIONAL{?dir wdt:P734 ?family . ?family rdfs:label ?familyName .  FILTER(lang(?familyName) = "de")}
} ORDER BY ASC(STR(?familyName)) ?director

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?count"):::projected v7("?dir"):::projected v2("?director"):::projected v10("?episodes"):::projected v11("?family") v1("?familyName"):::projected v5("?film") v3("?ord") v8("?ordinal") v4("?publication") v6("?series") c5(["wd:Q689438"]):::iri f0[["?director = 'de'"]] f0 --> v2 f1[["year-from-dateTime(?publication) < '2022^^xsd:integer'"]] f1 --> v4 v5 --"p:P179"--> v6 v6 --"p:statement/P179"--> c5 v6 --"p:qualifier/P1545"--> v3 v5 --"p:direct/P577"--> v4 v5 --"p:direct/P57"--> v7 bind2[/"str(?ord)"/] v3 --o bind2 bind2 --as--o v8 bind5[/"count(?ordinal)"/] v8 --o bind5 bind5 --as--o v9 bind6[/"?ordinal"/] v8 --o bind6 bind6 --as--o v10 v7 --"rdfs:label"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P734".-> v11 v11 --"rdfs:label"--> v1 end