Wikidata:WikiProject Sweden/Queries
Welcome
to
WikiProject Sweden
This is a page for collecting interesting queries related to Sweden that either does not fit in any of the sub projects or are so good they should be showcased. If you need help with building a query, see Wikidata:Request a query.
Infrastructure
editThe subway network in Stockholm and all the stations
edit#title:The subway network in Stockholm
#defaultView:Map{"hide":["?coords", "?line","?rgb"]}
SELECT ?station ?stationLabel ?coords ?line ?layer ?rgb (SAMPLE(?image) AS ?image) (sample(year(?opening)) as ?opening) WHERE {
?station wdt:P31 wd:Q928830;
wdt:P131* wd:Q104231;
wdt:P625 ?coords;
p:P197 ?pred.
?pred ps:P197 ?conn;
pq:P81 ?subwayLine.
MINUS { ?pred pq:P582 [] }
OPTIONAL { ?station wdt:P18 ?image }.
OPTIONAL { ?station wdt:P1619 ?opening }.
?conn wdt:P625 ?cds;
wdt:P31 wd:Q928830.
BIND(IF(xsd:double(?depth/10) = xsd:integer(?depth/10),?cds,"") as ?coords)
?conn p:P625/psv:P625/wikibase:geoLatitude ?lat1 ; p:P625/psv:P625/wikibase:geoLongitude ?lon1 .
?station p:P625/psv:P625/wikibase:geoLatitude ?lat2 ; p:P625/psv:P625/wikibase:geoLongitude ?lon2 .
BIND(CONCAT('LINESTRING(', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) . BIND(STRDT(?str, geo:wktLiteral) AS ?line)
?subwayLine wdt:P465 ?rgb .
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv". ?subwayLine rdfs:label ?layer. ?station rdfs:label ?stationLabel }
}
GROUP BY ?station ?stationLabel ?coords ?line ?layer ?rgb
A map of all lighthouses in Sweden
edit#title:Lighthouses in Sweden
#defaultView:Map
SELECT DISTINCT ?item ?name ?coor ?image ?character ?focal_height ?lysvidd ?admiralty
WHERE
{
?item wdt:P31 wd:Q39715 .
?item wdt:P17 wd:Q34 .
OPTIONAL { ?item wdt:P18 ?image }
OPTIONAL { ?item wdt:P625 ?coor }
OPTIONAL { ?item wdt:P1448 ?name }
OPTIONAL { ?item wdt:P1030 ?character }
OPTIONAL { ?item wdt:P2923 ?foc }
OPTIONAL { ?item wdt:P2929 ?lys }
OPTIONAL { ?item wdt:P3562 ?admiralty }
BIND(CONCAT("Lyshöjd: ", str(?foc), " m") AS ?focal_height)
BIND(CONCAT("Lysvidd: ", str(?lys), " NM") AS ?lysvidd)
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en" }
}
Politics and law
editWhich justices on the Supreme Court of Sweden (Q741421) dissent most often?
editAnimated bar chart.
#title:Dissenting justices on the Supreme Court of Sweden
#defaultView:BarChart
SELECT ?justiceLabel (count(?case) as ?num) ?opLabel ?year WHERE {
?case wdt:P31 wd:Q96482904;
wdt:P577 ?date;
p:P527 [ps:P527 ?op;
pq:P7122 ?justice].
BIND ( str(year(?date)) as ?year )
FILTER ( ?op = wd:Q1087840 || ?op = wd:Q1092720 || ?op = wd:Q6738447 ).
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
GROUP BY ?justice ?justiceLabel ?opLabel ?year
Which justices on the Supreme Court of Sweden (Q741421) cite their own legislative history?
edit#title: Justice that cites reports by commissions they self took part in
SELECT ?Justice ?Case ?Rapporteur ?SOU ?Report ?Commission ?Role WHERE {
?justice wdt:P39 wd:Q96336792.
?commission p:P710 [ ps:P710 ?justice; pq:P3831 ?role ];
wdt:P800 ?report.
?report wdt:P1031 ?SOU.
?case wdt:P1594 ?justice;
wdt:P2860 ?report.
OPTIONAL {
?case p:P1594 ?statement.
?statement ps:P1594 ?justice; pq:P3831 wd:Q96971913.
}
BIND ( IF ( BOUND (?statement) , 'yes', 'no' ) AS ?Rapporteur )
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en,sv".
?justice rdfs:label ?Justice.
?case rdfs:label ?Case.
?role rdfs:label ?Role.
?commission rdfs:label ?Commission.
?report rdfs:label ?Report.
}
}
ORDER BY ?justice ?report
Current laws
edit#title:Current laws
SELECT ?law ?lawLabel ?typeLabel WHERE {
?law wdt:P31/wdt:P279* wd:Q820655;
wdt:P1001|wd:P17 wd:Q34;
wdt:P31 ?type.
MINUS{ ?law wdt:P1366 [] }
MINUS{ ?law wdt:P576 [] }
MINUS{ ?law wdt:P2568 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
Motion counts by main subject
edit#title:Motion counts by subject
SELECT (COUNT(?item) AS ?count) ?theme ?themeLabel WHERE {
?item wdt:P31/wdt:P279 wd:Q452237;
wdt:P1001 wd:Q34;
wdt:P921 ?theme
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?theme ?themeLabel
ORDER BY DESC(?count)
Ombudsman positions
edit#title:Ombudsman positions
SELECT ?item ?itemLabel
WHERE {
?item wdt:P31 wd:Q4164871;
wdt:P279* wd:Q169180;
wdt:P17 wd:Q34 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
Parliamentarians who left their party (politiska vildar)
edit#title:Politiska vildar
SELECT ?vilde ?vildeLabel ?partiLabel (MIN(?_start) AS ?start) (MAX(?_slut) AS ?slut) WHERE {
?vilde p:P39 ?bef_node.
?bef_node ps:P39 wd:Q10655178;
a wdno:P4100;
pq:P2937 ?mandp.
OPTIONAL {?bef_node pq:P580 ?_start}
OPTIONAL {?bef_node pq:P582 ?_slut}
?vilde p:P39 [pq:P2937 ?mandp; pq:P4100 ?parti].
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
}
GROUP BY ?vilde ?vildeLabel ?partiLabel ?mandp
ORDER BY ?start