query-feefb4c0b02d509e26d10e31cbb07150

rq turtle/ttl

Queries All films with a Feldman score

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (MIN(YEAR(?date)) AS ?year) ?feldman_resultLabel (GROUP_CONCAT(DISTINCT ?enLabel; separator=', ') AS ?criteria) ?score ?score_raw (COUNT(DISTINCT ?enLabel) AS ?criteria_count) (GROUP_CONCAT(DISTINCT ?comm_label; separator = ", ") AS ?comments) WHERE {

    ?item p:P5021 ?st. ?st ps:P5021 wd:Q104144557; pq:P9259 ?feldman_result.
    #getting criteria and score
    OPTIONAL{?st pq:P1013 ?criterium. ?criterium rdfs:label ?enLabel. FILTER(LANG(?enLabel)="en")}
    OPTIONAL{?st pq:P444 ?score_raw. BIND(xsd:integer(REPLACE(STR(?score_raw), "/.+","")) AS ?score)}
    OPTIONAL{?st pq:P5102 ?comment. ?comment rdfs:label ?comm_label. FILTER(LANG(?comm_label)="en")}
    OPTIONAL{?item wdt:P577 ?date}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?feldman_resultLabel ?score ?score_raw
ORDER BY DESC(?score)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?comm_label"):::projected v9("?comment") v14("?comments") v12("?criteria") v13("?criteria_count") v7("?criterium") v10("?date"):::projected v3("?enLabel"):::projected v6("?feldman_result") v4("?item"):::projected v9("?score"):::projected v8("?score_raw"):::projected v5("?st") v11("?year") c12(["bd:serviceParam"]):::iri c4(["wd:Q104144557"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal v4 --"p:P5021"--> v5 v5 --"p:statement/P5021"--> c4 v5 --"p:qualifier/P9259"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P1013".-> v7 v7 --"rdfs:label"--> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P444".-> v8 bind0[/"http://www.w3.org/2001/XMLSchema#integer(replace(str(?score_raw),'/.+',''))"/] v8 --o bind0 bind0 --as--o v9 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P5102".-> v9 v9 --"rdfs:label"--> v2 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P577".-> v10 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind5[/"min(year-from-dateTime(?date))"/] v10 --o bind5 bind5 --as--o v11 bind6[/"?enLabel"/] v3 --o bind6 bind6 --as--o v12 bind7[/"count(?enLabel)"/] v3 --o bind7 bind7 --as--o v13 bind8[/"?comm_label"/] v2 --o bind8 bind8 --as--o v14