query-d6bc4f0380d07492d6cd56c43e7d3c0a
SPARQL Query:
Use at
- https://query.wikidata.org/sparql
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#>
SELECT ?pm ?pmLabel ?start_date ?end_date (SAMPLE(?party) AS ?party) (SAMPLE(?partyLabel) AS ?partyLabel) WHERE {
?pm p:P39 ?statement.
?statement ps:P39 wd:Q1587677;
pq:P580 ?start_date.
OPTIONAL { ?statement pq:P582 ?end_date. }
OPTIONAL { ?pm wdt:P102 ?party. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?pm ?pmLabel ?start_date ?end_date
ORDER BY DESC (?start_date)
LIMIT 7
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?end_date"):::projected
v7("?party"):::projected
v7("?partyLabel"):::projected
v2("?pm"):::projected
v1("?start_date"):::projected
v3("?statement")
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q1587677"]):::iri
v2 --"p:P39"--> v3
v3 --"p:statement/P39"--> c3
v3 --"p:qualifier/P580"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P102".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind2[/"sample(?party)"/]
v7 --o bind2
bind2 --as--o v7
bind3[/"sample(?partyLabel)"/]
v7 --o bind3
bind3 --as--o v7