User:Shinnin/sparql
Constraint violations
editcategory's main topic (P301) inverse constraint violations where the linked item is a Wikimedia list:
SELECT ?item ?category ?itemLabel ?categoryLabel
WHERE
{
?item wdt:P31 wd:Q13406463.
?category wdt:P301 ?item
FILTER NOT EXISTS { ?item wdt:P910 ?category }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
# Item was added to a collection before the item was created.
SELECT ?item ?itemLabel ?inception ?inception_precision ?start ?start_precision
WHERE
{
?item wdt:P571 ?statement;
p:P571/psv:P571 [
wikibase:timePrecision ?inception_precision;
wikibase:timeValue ?inception ;
];
p:P195 ?collection.
?collection pqv:P580 [
wikibase:timePrecision ?start_precision;
wikibase:timeValue ?start ;
].
FILTER((?inception_precision = ?start_precision && ?inception > ?start) ||
(?inception_precision = 9 && ?start_precision > 9 && YEAR(?inception) > YEAR(?start)) ||
(?start_precision = 9 && ?inception_precision > 9 && YEAR(?inception) > YEAR(?start)) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Queries related to Finland or Finnish Wikipedia
editMembers of the Parliament of Finland
editBoth of these queries should return an empty list.
Items with position held (P39) member of the Parliament of Finland (Q17592486), but no Finnish MP ID (P2181).
SELECT ?item ?itemLabel ?itemDescription
WHERE
{
?item wdt:P39 wd:Q17592486.
FILTER NOT EXISTS { ?item wdt:P2181 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" }
}
Items with Finnish MP ID (P2181), but no position held (P39) member of the Parliament of Finland (Q17592486).
SELECT ?item ?itemLabel ?itemDescription
WHERE
{
?item wdt:P2181 []
FILTER NOT EXISTS { ?item wdt:P39 wd:Q17592486. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" }
}
Featured articles in Finnish Wikipedia
editSELECT ?item ?sitelink ?itemLabel WHERE {
?sitelink schema:isPartOf <https://fi.wikipedia.org/>;
schema:about ?item;
wikibase:badge wd:Q17437796 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" } .
} ORDER BY ?itemLabel
TreeMap of the 1st Parliament of Finland
edit#defaultView:TreeMap
SELECT ?district ?districtLabel ?item ?itemLabel
WHERE
{
VALUES ?district { wd:Q3736054 wd:Q5450453 wd:Q6304483 wd:Q6304614
wd:Q6304273 wd:Q11901356 wd:Q5475162 wd:Q6304318
wd:Q6304515 wd:Q6305040 wd:Q11899973 wd:Q11899976
wd:Q11899974 wd:Q18342082 wd:Q11886106 wd:Q6488275}
BIND(wd:Q17592486 as ?member)
BIND(wd:Q2052948 as ?election) .
?item wdt:P39 ?member;
p:P39 ?statement.
?statement ps:P39 ?member;
pq:P2715 ?election;
pq:P768 ?district.
?item rdfs:label ?_itemLabel.
?item wdt:P102 ?politicalparty;
rdfs:label ?_ppLabel.
FILTER((LANG(?_ppLabel)) = "fi")
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" }
}
Timeline of Finnish elections
edit#defaultView:Timeline
SELECT DISTINCT ?item ?itemLabel ?year ?pic ?time
WHERE
{
VALUES ?election { wd:Q10638581 wd:Q2112448 wd:Q18693936 wd:Q15154951 }
?item wdt:P31 ?election.
OPTIONAL { ?item wdt:P585 ?time .}
OPTIONAL { ?item wdt:P580 ?time .}
BIND(YEAR(?time) as ?year)
OPTIONAL { ?item wdt:P18 ?pic }
FILTER NOT EXISTS { ?item wdt:P1001 ?alue. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi" }
}
Finnish parliamentary elections
editSELECT DISTINCT ?item ?itemLabel ?year
WHERE
{
?item wdt:P179 wd:Q2112448 .
OPTIONAL { ?item wdt:P580 ?start. }
OPTIONAL { ?item wdt:P585 ?pit. }
BIND ( IF(BOUND(?pit), YEAR(?pit), YEAR(?start)) AS ?year )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?year
Finlandia Prize winners
editFinlandia Award (Q50432647) winners.
SELECT ?item ?itemLabel ?work ?workLabel ?langLabel (YEAR(?time) AS ?year)
WHERE
{
?item p:P166 ?statement.
?statement ps:P166 wd:Q50432647;
pq:P585 ?time;
pq:P1686 ?work.
OPTIONAL {
?work wdt:P407 ?lang.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?year
Statutes of Finland
editSELECT ?item ?itemLabel ?catalog_code ?jurisdictionLabel ?inception ?abolished
WHERE
{
?item wdt:P31/wdt:P279* wd:Q820655.
?item p:P528 ?catalog.
?catalog ps:P528 ?catalog_code;
pq:P972 wd:Q4411194.
OPTIONAL { ?item wdt:P1001 ?jurisdiction. }
OPTIONAL { ?item wdt:P571 ?inception. }
OPTIONAL { ?item wdt:P576 ?abolished. }
FILTER ( ?jurisdiction = wd:Q33 || ?jurisdiction = wd:Q5689 )
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi,en". }
}
Missing family names
editSELECT ?name (COUNT(?item) AS ?count)
WHERE
{
?item wdt:P27 wd:Q33;
rdfs:label ?fiLabel.
FILTER(LANG(?fiLabel) = 'fi')
BIND(STRAFTER(?fiLabel, ' ') AS ?name)
FILTER NOT EXISTS {
?item wdt:P734 ?familyname.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?name
HAVING (?count > 3)
ORDER BY DESC(?count)
Citizens of Finland before Finland existed
editPeople who died before Finland became independent country, but who are marked as citizens of Finland.
SELECT ?item ?itemLabel ?dod
WHERE
{
?item wdt:P27 wd:Q33;
wdt:P570 ?dod;
wdt:P31 wd:Q5.
wd:Q33 p:P31 ?statement.
?statement ps:P31 wd:Q3624078;
pq:P580 ?independence.
BIND (YEAR(?dod) AS ?dod_year)
FILTER( ( ?dod_year < YEAR(?independence) ) ||
( (?dod_year = YEAR(?independence) ) && (MONTH(?dod) < MONTH(?independence)) ) ||
( (?dod_year = YEAR(?independence) ) && (MONTH(?dod) = MONTH(?independence)) && (DAY(?dod) < DAY(?independence)) ) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi,en". }
}
ORDER BY DESC(?dod)
Missing labels
editItem has a main category with a label
editNon-list items that don't have a label in Finnish, but there is a main category that has a label in Finnish and that category has a return link to the item.
# Non-list items that don't have a label in Finnish,
# but there is a main category that has a label in Finnish and that category has a return link to the item.
SELECT ?item ?itemLabel ?category ?categoryLabelFR WHERE {
?item wdt:P910 ?category.
?category wdt:P301 ?item.
?category rdfs:label ?categoryLabelFR filter (lang(?categoryLabelFR) = "fi") .
FILTER NOT EXISTS {?item wdt:P31/wdt:P279* wd:Q13406463 } .
FILTER NOT EXISTS {?item rdfs:label ?itemLabelFR filter (lang(?itemLabelFR) = "fi")} .
}
LIMIT 1000
Label in another language
editSELECT ?item ?itemLabel ?labelFI
WHERE
{
?item wdt:P31 wd:Q3863.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
FILTER (EXISTS {
?item rdfs:label ?labelEN.
FILTER(LANG(?labelEN) = "en")
})
FILTER (NOT EXISTS {
?item rdfs:label ?labelFI.
FILTER(LANG(?labelFI) = "fi")
})
}
LIMIT 2000
Other
editDisambiguation pages with the same name.
SELECT DISTINCT ?item ?item2 (SAMPLE(?iLabel) AS ?label)
WHERE
{
?item2 wdt:P31/wdt:P279* wd:Q4167410;
wikibase:sitelinks 1 ;
rdfs:label ?iLabel.
#?sitelinkfi schema:isPartOf <https://sv.wikipedia.org/>;
# schema:about ?item2.
?item wdt:P31/wdt:P279* wd:Q4167410;
rdfs:label ?iLabel.
FILTER(?item != ?item2)
FILTER(xsd:integer(STRAFTER(STR(?item2), 'www.wikidata.org/entity/Q')) > 100000000)
}
GROUP BY ?item ?item2
ORDER BY DESC(?item2)
LIMIT 100
SELECT DISTINCT ?item ?itemLabel ?target ?targetLabel
WHERE
{
?item wdt:P31 wd:Q28065731 ;
wikibase:sitelinks 0 .
OPTIONAL {
?item p:P31 ?statement .
?statement ps:P31 wd:Q28065731 ;
pq:P642 ?target .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,fi,en". }
}
LIMIT 100
SELECT DISTINCT ?item ?fidesc
WHERE
{
?item wdt:P31 wd:Q5 ;
schema:description ?fidesc .
FILTER(LANG(?fidesc) = 'fi')
FILTER(REGEX(?fidesc, "^([A-Z])[a-z]+inen"))
}
LIMIT 10
SELECT DISTINCT ?item ?itemLabel ?item2 ?item2Label
WHERE
{
?item p:P4224 ?statement .
?statement pq:P57 ?person ;
ps:P4224 ?type .
?item2 p:P4224 ?statement2 .
?statement2 pq:P57 ?person ;
ps:P4224 ?type .
FILTER(?item != ?item2)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,sv,fi,de,pt,lb,ja,ru,pl,uk,eu,nl". }
}
LIMIT 1000
SELECT ?item ?itemLabel ?code ?alt
WHERE
{
?item p:P528 ?statement .
?statement ps:P528 ?code ;
pq:P972 wd:Q4411194 .
FILTER NOT EXISTS {
?item skos:altLabel ?alt .
FILTER(LANG(?alt) = 'fi')
FILTER ( str(?alt) = ?code )
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi,en". }
}