Size: 714
Comment:
|
Size: 2924
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
* 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: |
|
Line 8: | Line 15: |
* https://www.wikidata.org/wiki/Property:P239 | |
Line 14: | Line 22: |
{{{ 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". } } }}} |
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:List_of_properties/science
https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples
A triple can be read like a sentence (which is why it ends with a period), with a subject, a predicate, and an object:
Query ICAO codes
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
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
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". } }