NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I would like to find all relations that have duplicate wikidata tags. I saw finding dup nodes, but cannot figure out how to adaapt my query to it:

[out:csv(admin_level,::id,wikidata,name,wikipedia,boundary,type,alt_name,designation)]; ( rel["admin_level"]["wikidata"]; );

asked 03 Jan '17, 08:06

nyuriks's gravatar image

nyuriks
71226
accept rate: 0%

edited 03 Jan '17, 19:34

tyr_asd's gravatar image

tyr_asd
1.2k51927


The new OSM+Wikidata SPARQL service can now do it with this query.

SELECT ?osmid ?adminlvl ?wd ?wdLabel {
  # find relation with a wikidata tag
  ?osmid osmm:type 'r' ;
         osmt:wikidata ?wd ;
         osmt:admin_level ?adminlvl .

  # add user's or english label to the found wikidata
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

  # the ?wd variable must also be matching this subquery
  # it finds wd tags that appear more than once
  { SELECT ?wd { 
    ?osmid osmm:type 'r' ;
           osmt:wikidata ?wd ;
           osmt:admin_level ?adminlvl .
    }
    GROUP BY ?wd
    HAVING (COUNT(*) > 1)
  }

} LIMIT 10
permanent link

answered 06 Sep '17, 09:08

nyuriks's gravatar image

nyuriks
71226
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228

question asked: 03 Jan '17, 08:06

question was seen: 1,866 times

last updated: 06 Sep '17, 09:08

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum