使用 DBpedia 获取维基百科页面的超链接 [英] Getting hyperlinks of a Wikipedia page using DBpedia
问题描述
我在 DBPedia 中有两个资源:dbr:Diabetes_mellitus 和 dbr:高血糖.在维基百科中,对应的页面是wikipedia-en:Diabetes_mellitus和wikipedia-en:Hyperglycemia.
I have two resources in DBPedia: dbr:Diabetes_mellitus and dbr:Hyperglycemia. In Wikipedia, the corresponding pages are wikipedia-en:Diabetes_mellitus and wikipedia-en:Hyperglycemia.
在维基百科中有一个从 Diabetes_mellitus 页面到高血糖页面的超链接.但是当我尝试在 DBpedia 中查找 2 个资源之间的链接时,我找不到它.
In Wikipedia there is a hyperlink from Diabetes_mellitus page to Hyperglycemia page. But when I try to find the link between the 2 resources in DBpedia, I cannot find it.
我尝试使用以下 SPARQL 查询查找链接.
I tried to find the link using the following SPARQL query.
SELECT ?prop WHERE {
{ dbr:Diabetes_mellitus ?prop dbr:Hyperglycemia }
UNION
{ dbr:Hyperglycemia ?prop dbr:Diabetes_mellitus }
}
但答案是否定的.我什么也得不到.有什么办法可以在DBpedia中找到页面之间的链接吗?
But the answer is null. I get nothing as an answer. Is there any way to find a link between the pages in DBpedia?
我想要实现的是获取任何维基百科页面中的所有超链接.有什么办法可以实现吗?
What I am trying to achieve is to get all the hyperlinks in any Wikipedia page. Is there any way I can achieve it?
推荐答案
截至 2018 年 5 月,页面链接存储在
命名图中.
As of May 2018, page links are stored in the <http://dbpedia.org/page_links>
named graph.
您的查询可能如下:
SELECT ?prop
FROM <http://dbpedia.org/page_links> WHERE {
{ dbr:Diabetes_mellitus ?prop dbr:Hyperglycemia }
UNION
{ dbr:Hyperglycemia ?prop dbr:Diabetes_mellitus }
}
使用ASK
:
ASK
FROM <http://dbpedia.org/page_links> {
dbr:Hyperglycemia dbo:wikiPageWikiLink|^dbo:wikiPageWikiLink dbr:Diabetes_mellitus
}
Try it!
这篇关于使用 DBpedia 获取维基百科页面的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!