首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DBPedia的奇怪结果

DBPedia的奇怪结果
EN

Stack Overflow用户
提问于 2013-07-19 16:29:24
回答 1查看 224关注 0票数 3

我试图查询所有机场及其IATA代码的列表:

代码语言:javascript
复制
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

执行它看上去很好,但是有一些奇怪的街区,机场被分配了错误的名称,例如:

代码语言:javascript
复制
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

除了以他们的名义拥有“王子”之外,他们似乎没有什么共同之处。单击该资源还表明与所分配的名称无关。

我做错了什么?

编辑-找到的解决方案:

删除“按机场订购”或将其更改为“由国际航空运输协会订购”解决了问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-20 02:27:39

DBpedia本体(dbpedia-owl)数据往往比旧的信息框数据(dbprop)要干净一些,所以我想您可能需要使用使用dbpedia-owl属性的查询:

代码语言:javascript
复制
SELECT ?airport ?iata ?name
WHERE {
    ?airport a dbpedia-owl:Airport ;
             dbpedia-owl:iataLocationIdentifier ?iata ;
             rdfs:label ?name .
    FILTER langMatches( lang( ?name ), "EN" )
}
order by ?airport

SPARQL结果

数据稍好一些,但仍然有一些奇怪的结果,如:

代码语言:javascript
复制
http://dbpedia.org/resource/Prince_Albert_(Glass_Field)_Airport "YPA"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Prince_George_Airport   "YXS"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Prince_Mohammad_Bin_Abdulaziz_Airport   "MED"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Prince_Rupert/Seal_Cove_Water_Airport   "ZSW"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Prince_Rupert_Airport   "YPR"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Prince_Said_Ibrahim_International_Airport   "HAH"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Princess_Juliana_International_Airport  "SXM"@en    "Prince Albert (Glass Field) Airport"@en
http://dbpedia.org/resource/Princeton_Airport_(New_Jersey)  "PCT"@en    "Prince Albert (Glass Field) Airport"@en

为了尝试几种不同的方法,我还决定尝试按?airport?iata分组,然后取样名称:

代码语言:javascript
复制
SELECT ?airport ?iata sample(?name)
WHERE {
    ?airport a dbpedia-owl:Airport ;
             dbpedia-owl:iataLocationIdentifier ?iata ;
             rdfs:label ?name .
    FILTER langMatches( lang( ?name ), "EN" )
}
group by ?airport ?iata
order by ?airport

SPARQL结果

这会得到不同的结果,但同样奇怪的结果,例如:

代码语言:javascript
复制
http://dbpedia.org/resource/%22Solidarity%22_Szczecin-Goleni%C3%B3w_Airport "SZZ"@en    ""Solidarity" Szczecin-Goleniów Airport"@en
http://dbpedia.org/resource/%C3%81ngel_Albino_Corzo_International_Airport   "TGZ"@en    ""Solidarity" Szczecin-Goleniów Airport"@en
http://dbpedia.org/resource/%C3%84ngelholm-Helsingborg_Airport  "AGH"@en    ""Solidarity" Szczecin-Goleniów Airport"@en
http://dbpedia.org/resource/%C3%85lesund_Airport,_Vigra "AES"@en    ""Solidarity" Szczecin-Goleniów Airport"@en
http://dbpedia.org/resource/%C3%85re_%C3%96stersund_Airport "OSD"@en    ""Solidarity" Szczecin-Goleniów Airport"@en

然而,如果我们按名称分组,并选择名称并计算具有给定名称的机场数量,则可以获得1,但有些名称会出现两次!

代码语言:javascript
复制
SELECT count(?airport) ?name
WHERE {
    ?airport a dbpedia-owl:Airport ;
             dbpedia-owl:iataLocationIdentifier ?iata ;
             rdfs:label ?name .
    FILTER langMatches( lang( ?name ), "EN" )
}
group by ?name
order by ?name

SPARQL结果

代码语言:javascript
复制
1   "Abraham González International Airport"@en
1   "Abraham González International Airport"@en
...
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en
1   "Prince Albert (Glass Field) Airport"@en

这真的很奇怪。您的查询看起来没有什么问题,但是在DBpedia中发生了一些奇怪的事情。您可以查看其中一些奇怪的条目,DBpedia将显示的数据与这些结果不匹配。例如,原始查询的结果之一是

代码语言:javascript
复制
http://dbpedia.org/resource/Prince_Mohammad_Bin_Abdulaziz_Airport   "MED"@en    "Prince Albert (Glass Field) Airport"@en

但是,如果您访问机场并在页面中搜索"Albert",您就不会在那里找到它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17751094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档