Ethan Gruber reported on Twitter that this query incorrectly returns a Geonames URI without a trailing slash:
CONSTRUCT { ?place a skos:Concept; skos:prefLabel ?placeLabel; skos:exactMatch ?osgeo; skos:exactMatch ?tgn; skos:exactMatch ?geonames ; skos:exactMatch ?pleiades ; dct:coverage ?coord . } WHERE { ?place wdt:P1667 "7015539" . OPTIONAL {?place wdt:P3120 ?osgeoid . BIND (uri(concat("http://data.ordnancesurvey.co.uk/id/", ?osgeoid)) as ?osgeo) } OPTIONAL {?place wdt:P1667 ?tgnid . BIND (uri(concat("http://vocab.getty.edu/tgn/", ?tgnid)) as ?tgn)} OPTIONAL {?place wdt:P1566 ?geonamesid . BIND (uri(concat("http://sws.geonames.org/", ?geonamesid, "/")) as ?geonames)} OPTIONAL {?place wdt:P1584 ?pleiadesid . BIND (uri(concat("https://pleiades.stoa.org/places/", ?pleiadesid)) as ?pleiades)} OPTIONAL {?place p:P625/ps:P625 ?coord} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } }
Note that he explicitly concatenates a "/" to it, yet it’s still not in the result:
subject | predicate | object |
---|---|---|
wd:Q931172 | rdf:type | skos:Concept |
wd:Q931172 | skos:prefLabel | Vulci |
wd:Q931172 | skos:exactMatch | http://vocab.getty.edu/tgn/7015539 |
wd:Q931172 | skos:exactMatch | http://sws.geonames.org/3163940 |
wd:Q931172 | skos:exactMatch | https://pleiades.stoa.org/places/413393 |
wd:Q931172 | http://purl.org/dc/terms/coverage | Point(11.631666666 42.418888888) |
I managed to reduce it to this shorter query:
SELECT ?g { BIND(<http://sws.geonames.org/1/> AS ?g) OPTIONAL { BIND("" AS ?_) } }
If the BIND is removed, or made non-optional, the bug doesn’t occur. It also doesn’t happen if you change anything in the domain part of the URI.
I assume this is related to the TrailingSlashRemovingInlineUriHandler that we register for Geonames URIs, though I’m not sure why it only seems to remove the slash in combination with an optional bind.