User:Daniel Mietchen/Sandbox4URLshortening
Jump to navigation
Jump to search
This page is used in conjunction with m:Special:UrlShortener as a workaround to https://phabricator.wikimedia.org/T220703 . URL shortening can also be triggered via the MediaWiki API.
The following query uses these:
SELECT DISTINCT ?property ?propertyLabel ?propertyDescription ?count
WITH {
SELECT DISTINCT ?property ?propertyType ?propertyLabel ?propertyDescription (GROUP_CONCAT(?propertyAltLabel; SEPARATOR = " // ") AS ?propertyAltLabels) WHERE {
{
SELECT ?property ?propertyType ?propertyLabel ?propertyDescription ?propertyAltLabel WHERE {
?property wikibase:propertyType ?propertyType;
rdfs:label ?propertyLabel.
FILTER((LANG(?propertyLabel)) = "en")
?property skos:altLabel ?propertyAltLabel.
FILTER((LANG(?propertyAltLabel)) = "en")
?property schema:description ?propertyDescription.
FILTER((LANG(?propertyDescription)) = "en")
}
}
BIND("(climat|meteorol|weather|snow|storm|cyclon|hurrican|wildfire|flood|disaster)" AS ?whitelist)
BIND(CONCAT(?propertyLabel, ?propertyAltLabel, ?propertyDescription) AS ?text)
FILTER(REGEX(?text, ?whitelist))
}
GROUP BY ?property ?propertyType ?propertyLabel ?propertyDescription ?propertyAltLabels
ORDER BY (xsd:integer(STRAFTER(STR(?property), "P"))) } AS %items
WITH {
SELECT DISTINCT ?property (COUNT(*) AS ?count) WHERE {
INCLUDE %items.
?item ?p [ ] .
?property a wikibase:Property;
wikibase:claim ?p.
}
GROUP BY ?property
LIMIT 100
} AS %results
WHERE {
INCLUDE %results.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?count)
LIMIT 100