query-da452063b36bc4a7ecad6f7f65602885

rq turtle/ttl

SPARQL query

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?wikidata_id ?name ?url ?ward_id ?party_id ?start ?end WHERE {
    BIND (wd:Q55465119 as ?legislature) .
    ?member wdt:P361 ?legislature ;
    MINUS {?member wdt:P576 [] }
    MINUS { ?legislature wdt:P576 [] }
    ?node ps:P39 ?member .
    OPTIONAL { ?node pq:P4100 ?party_id }
    OPTIONAL { ?node pq:P580 ?start }
    OPTIONAL { ?node pq:P768 ?ward_id }
    OPTIONAL { ?node pq:P582 ?end }
    ?node ps:P39 ?position .
    ?position wdt:P31 ?positiontype .
    ?wikidata_id p:P39 ?node .
    OPTIONAL {
        ?wikidata_id p:P973 ?describedAt .
        ?describedAt ps:P973 ?url .
        OPTIONAL {
            ?describedAt pq:P1810 ?name .
        }
        FILTER(CONTAINS(LCASE(STR(?url)), "democracy.leeds.gov.uk/"))
    }
    FILTER(!BOUND(?end) || ?end > NOW())
}
ORDER BY ?wikidata_id

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?describedAt") v2("?end"):::projected v4("?legislature") v5("?member") v13("?name"):::projected v6("?node") v7("?party_id"):::projected v10("?position") v11("?positiontype") v8("?start"):::projected v3("?url"):::projected v9("?ward_id"):::projected v1("?wikidata_id"):::projected a1((" ")) a2((" ")) f0[["(not bound(?end) || ?end > NOW())"]] f0 --> v2 bind1[/"'wd:Q55465119'"/] bind1 --as--o v4 v5 --"p:direct/P361"--> v4 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v5 --"p:direct/P576"--> a1 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v4 --"p:direct/P576"--> a2 end v6 --"p:statement/P39"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P4100".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P580".-> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P768".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P582".-> v2 end v6 --"p:statement/P39"--> v10 v10 --"p:direct/P31"--> v11 v1 --"p:P39"--> v6 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P973".-> v12 v12 --"p:statement/P973"--> v3 subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v12 -."p:qualifier/P1810".-> v13 end end