query-61a7ed3ef95373e0cc60200b0d414d38

rq turtle/ttl

SPARQL query

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT (STRAFTER(STR(?location), STR(wd:)) AS ?country) (STRAFTER(STR(?item), STR(wd:)) AS ?legislature) (xsd:integer(?seatcount) AS ?seats)
  WHERE {
    VALUES ?type { wd:Q10553309 wd:Q140247 }
    ?location wdt:P31 wd:Q6256 .
    ?item wdt:P31/wdt:P279* ?type ; wdt:P1001 ?location . 
    FILTER NOT EXISTS { ?item wdt:P576 [] } . # no end date
    OPTIONAL { ?item wdt:P1342 ?seatcount } 
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?country") v1("?item"):::projected v6("?legislature") v3("?location"):::projected v4("?seatcount"):::projected v7("?seats") v2("?type") a1((" ")) a2((" ")) c3(["wd:Q6256"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P576"--> e0a1 e0v1("?item"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 v1 --"wdt:P576"--> a1 bind1[/VALUES ?type/] bind1-->v2 bind10(["wd:Q10553309"]) bind10 --> bind1 bind11(["wd:Q140247"]) bind11 --> bind1 v3 --"wdt:P31"--> c3 v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> v2 v1 --"wdt:P1001"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P1342".-> v4 end bind2[/"substring-after(str(?location),str('wd:'))"/] v3 --o bind2 bind2 --as--o v5 bind3[/"substring-after(str(?item),str('wd:'))"/] v1 --o bind3 bind3 --as--o v6 bind4[/"http://www.w3.org/2001/XMLSchema#integer(?seatcount)"/] v4 --o bind4 bind4 --as--o v7