query-9933c4648fdd273b8761b1d581d8bdcc

rq turtle/ttl

All Vidhan sabha terms of a single person SELECT DISTINCT ?constituencyLabel ?partyLabel ?start ?electionLabel ?end ?causeLabel { wd:Q28968902 p:P39 ?positionStatement . # all positions held by V. Sugnana Kumari Deo ?positionStatement ps:P39 [wdt:P279* wd:Q24546266] . # filter to positions which are a subclass of MLA, Odisha OPTIONAL { ?positionStatement pq:P768 ?constituency . } # then find various specific values for each term OPTIONAL { ?positionStatement pq:P4100|pq:P102 ?party . } OPTIONAL { ?positionStatement pq:P580 ?start . } OPTIONAL { ?positionStatement pq:P2715 ?election . } OPTIONAL { ?positionStatement pq:P582 ?end . } OPTIONAL { ?positionStatement pq:P1534 ?cause . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". } } ORDER BY ?start

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# All Vidhan sabha terms of a single person
SELECT DISTINCT ?constituencyLabel ?partyLabel ?start ?electionLabel ?end ?causeLabel {
 wd:Q28968902 p:P39 ?positionStatement . # all positions held by V. Sugnana Kumari Deo
  ?positionStatement ps:P39 [wdt:P279* wd:Q24546266] . # filter to positions which are a subclass of MLA, Odisha
 OPTIONAL { ?positionStatement pq:P768 ?constituency . }  # then find various specific values for each term
 OPTIONAL { ?positionStatement pq:P4100|pq:P102 ?party . }
 OPTIONAL { ?positionStatement pq:P580 ?start . }
 OPTIONAL { ?positionStatement pq:P2715 ?election . }
 OPTIONAL { ?positionStatement pq:P582 ?end . }
 OPTIONAL { ?positionStatement pq:P1534 ?cause . }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
}
ORDER BY ?start

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?cause") v3("?constituency") v5("?election") v6("?end"):::projected v4("?party") v2("?positionStatement") v1("?start"):::projected a1((" ")) c4(["wd:Q24546266"]):::iri c16(["#91;AUTO_LANGUAGE#93;, en"]):::literal c14(["bd:serviceParam"]):::iri c1(["wd:Q28968902"]):::iri c1 --"p:P39"--> v2 a1 --"p:direct/P279"--> c4 v2 --"p:statement/P39"--> a1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P768".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 -."p:qualifier/P102".-> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:qualifier/P4100"--> v4 end union0r <== or ==> union0l end end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P580".-> v1 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P2715".-> v5 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P582".-> v6 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P1534".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end