SELECT ?osmd (SAMPLE(?kv) AS ?kv) ?wd (SAMPLE(?blank) AS ?blank) (SAMPLE(?template) AS ?template) (SAMPLE(?refFormatter) AS ?refFormatter) (SAMPLE(?wdKV) AS ?wdKV) WHERE {
?osmd osmdt:P10 osmd:Q497;
BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?qid)) AS ?wd)
SERVICE <https://query.wikidata.org/sparql> {
?wd wdt:P8498 ?refFormatter.
FILTER(CONTAINS(?kv, ":") || BOUND(?qid))