I'm using the following query to receive label and description of all Wikidata-entries with geo-location in a geo-bounding box:
SELECT DISTINCT ?place ?placeLabel ?placeDescription ?location WHERE
{
SERVICE wikibase:box
{
?place wdt:P625 ?location.
bd:serviceParam wikibase:cornerWest 'Point({0} {1})'^^geo:wktLiteral.
bd:serviceParam wikibase:cornerEast 'Point({2} {3})'^^ geo:wktLiteral.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language '{4},en,fr,es'. }
?place(wdt:P31/wdt:P279*) wd:Q618123.
}
This works fine, but now I would like to also have the link to the wikipedia article included in the result. I tried to modify the query to:
SELECT DISTINCT ?place ?placeLabel ?placeDescription ?location ?article WHERE
but it doesn't work, articles are not returned. Any idea, how this works?
Edit: after all the useful hints from you guys, here is the version, which works fine now:
SELECT DISTINCT ?place ?placeLabel ?placeDescription ?location ?article WHERE
{
SERVICE wikibase:box
{
?place wdt:P625 ?location.
bd:serviceParam wikibase:cornerWest 'Point({0} {1})'^^geo:wktLiteral.
bd:serviceParam wikibase:cornerEast 'Point({2} {3})'^^ geo:wktLiteral.
}
SERVICE wikibase:label
{
bd:serviceParam wikibase:language '[AUTO_LANGUAGE],en,fr,es,{4}'.
?place schema:description ?placeDescription ; rdfs:label ?placeLabel.
}
# all places with a location
?place(wdt:P31/wdt:P279*) wd:Q618123.
# include wikipedia links
?article schema:about ?place.
FILTER REGEX(STR(?article), '.wikipedia.org/wiki/').
# optional, only places containing string in label
FILTER CONTAINS(lcase(?placeLabel), '{5}').
}