Page MenuHomePhabricator

?layerLabel instead of ?layer for Wikidata Query Service map view
Closed, ResolvedPublic

Description

To define layers in mapview the following is currently needed.

Below a working sample to illustrate this.

#defaultView:Map
SELECT ?item ?itemLabel ?layer ?coor
{
	?item wdt:P1435 wd:Q9259 . 
  	?item wdt:P17 ?country .
	?country wdt:P30 wd:Q18 .
  	?item wdt:P625 ?coor
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . 
                            ?country rdfs:label ?layer . 
                            ?item rdfs:label ?itemLabel  }
}

If ?layerLabel could be used instead, this could be simplified to:

#defaultView:Map
SELECT ?item ?itemLabel ?layerLabel ?coor
{
	?item wdt:P1435 wd:Q9259 . 
  	?item wdt:P17 ?layer .
	?layer wdt:P30 wd:Q18 .
  	?item wdt:P625 ?coor
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

Simply defining ?layer in SELECT isn't possible. This is not specific to mapview.

#defaultView:Map
SELECT ?item ?itemLabel (?countryLabel as ?layer) ?coor
{
	?item wdt:P1435 wd:Q9259 . 
  	?item wdt:P17 ?country .
	?country wdt:P30 wd:Q18 .
  	?item wdt:P625 ?coor
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

It could work if one wanted QIDs for layers ;)

#defaultView:Map
SELECT ?item ?itemLabel (?country as ?layer) ?countryLabel ?coor
{
	?item wdt:P1435 wd:Q9259 . 
  	?item wdt:P17 ?country .
	?country wdt:P30 wd:Q18 .
  	?item wdt:P625 ?coor
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

Event Timeline

Esc3300 created this task.Sep 5 2016, 1:27 PM
Restricted Application added a project: Discovery. · View Herald TranscriptSep 5 2016, 1:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Good point thanks!
I will just add ?layerLabel to the used columns.

Esc3300 updated the task description. (Show Details)Sep 5 2016, 1:41 PM

Thanks.

thiemowmde triaged this task as Normal priority.

Change 318503 had a related patch set uploaded (by Jonas Kress (WMDE)):
Add 'layerLabel' to the columns used for map layers

https://gerrit.wikimedia.org/r/318503

Change 318503 merged by jenkins-bot:
Add 'layerLabel' to the columns used for map layers

https://gerrit.wikimedia.org/r/318503

thiemowmde closed this task as Resolved.Oct 28 2016, 1:31 PM
thiemowmde moved this task from ready to go to in progress on the Wikidata board.
thiemowmde removed a project: Patch-For-Review.