MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 22 as of 2019-12-03 12:01:14
  • wikidata

wikidata

Wikidata is a free and open knowledge base that can be read and edited by both humans and machines.

Wikidata acts as central storage for the structured data of its Wikimedia sister projects including Wikipedia, Wikivoyage, Wiktionary, Wikisource, and others.

  • https://www.wikidata.org/wiki/Wikidata:Introduction

  • https://www.wikidata.org/wiki/Wikidata:List_of_properties/science

  • https://www.wikidata.org/wiki/Q597

  • https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples

  • https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial

A triple can be read like a sentence (which is why it ends with a period), with a subject, a predicate, and an object: In fact, it’s possible to express the same abbreviation in SPARQL as well: if you end a triple with a semicolon (;) instead of a period, you can add another predicate-object pair. (And statement).

Query ICAO codes

  • https://query.wikidata.org/#SELECT%20%3Fitem%20%3FitemLabel%20%3Fid%20WHERE%20%7B%0A%20%20%3Fitem%20wdt%3AP239%20%3Fid%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D

  • https://www.wikidata.org/wiki/Property:P239

SELECT ?item ?itemLabel ?id WHERE {
  ?item wdt:P239 ?id
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

SELECT DISTINCT ?id WHERE {
  ?item wdt:P239 ?id
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?id 

Query IATA codes

  • https://www.wikidata.org/wiki/Property:P238

SELECT ?item ?itemLabel ?id WHERE {
  ?item wdt:P238 ?id
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

SELECT DISTINCT ?id WHERE {
  ?item wdt:P238 ?id
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?id 

Get items that are instances of cities of Portugal

  • https://www.wikidata.org/wiki/Property:P31

  • https://www.wikidata.org/wiki/Q15647906

SELECT ?item ?itemLabel WHERE {
  ?item wdt:P31 wd:Q15647906
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}

Get Portugal cities and their freguesias

  • https://www.wikidata.org/wiki/Property:P150 contains administrative territorial entity (P150)

  • https://www.wikidata.org/wiki/Property:P31 instance of (P31)

  • https://www.wikidata.org/wiki/Q15647906 city of Portugal (Q15647906)

  • https://www.wikidata.org/wiki/Q1131296 freguesia

SELECT ?item ?itemLabel ?itemDescription ?freguesia ?freguesiaLabel WHERE {
  ?item wdt:P31 wd:Q15647906 . ?item wdt:P150 ?freguesia.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}

SELECT ?item ?itemLabel ?itemDescription ?otherItem ?otherItemLabel ?otherItemDescription WHERE {
  # items that are instances of portuguese cities
  ?item wdt:P31 wd:Q15647906 . 
  # items that contains administrative territorial entities
  ?item wdt:P150 ?otherItem .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}

Get portuguese airports

SELECT ?item ?itemLabel ?itemDescription ?iataCode ?icaoCode ?coords WHERE {  
  ?item wdt:P31 wd:Q1248784 ; wdt:P17 wd:Q45 ; wdt:P238 ?iataCode; wdt:P239 ?icaoCode; wdt:P625 ?coords.  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}

Get portuguese international airports

SELECT ?item ?itemLabel ?itemDescription ?iataCode ?icaoCode ?coords WHERE {  
  ?item wdt:P31 wd:Q644371 ; wdt:P17 wd:Q45 ; wdt:P238 ?iataCode; wdt:P239 ?icaoCode; wdt:P625 ?coords. 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01