使用DBpedia获取Wikipedia页面的超链接 [英] Getting hyperlinks of a Wikipedia page using DBpedia
问题描述
我在DBPedia中有两个资源: dbr:Diabetes_mellitus 和 dbr:高血糖症。在维基百科中,相应的页面是 wikipedia-en:Diabetes_mellitus 和 wikipedia-en:高血糖症。
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月,页面链接存储在< http://dbpedia.org/page_links>
命名图。
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
}
这篇关于使用DBpedia获取Wikipedia页面的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!