我正在尝试查询所有机场及其 IATA 代码的列表:
PREFIX p: <http://dbpedia.org/property/>
PREFIX o: <http://dbpedia.org/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?airport ?iata ?name
WHERE {
?airport rdf:type o:Airport ;
p:iata ?iata ;
p:name ?name
}
ORDER by ?airport
执行它看起来大部分都很好,但是有一些奇怪的块机场被分配了错误的名称,例如:
http://dbpedia.org/resource/Prince_Abdul_Majeed_bin_Abdul_Aziz_Domestic_Airport "ULH"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_Albert_(Glass_Field)_Airport "YPA"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_George_Airport "YXS"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_Mohammad_Bin_Abdulaziz_Airport "MED"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_Rupert/Seal_Cove_Water_Airport "ZSW"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_Rupert_Airport "YPR"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Prince_Said_Ibrahim_International_Airport "HAH"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
http://dbpedia.org/resource/Princess_Juliana_International_Airport "SXM"@en "Prince Abdul Majeed bin Abdul Aziz Airport"@en
除了名字中都有“王子”之外,他们似乎没有任何共同点。单击资源也表明与分配给他们的名称无关。
我究竟做错了什么?
编辑 - 找到解决方案:
删除“ORDER by ?airport”或将其更改为“ORDER by ?iata”可以解决问题。