Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
706 views
in Technique[技术] by (71.8m points)

sparql - Getting hyperlinks of a Wikipedia page using DBpedia

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.

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.

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 } 
}

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As of May 2018, page links are stored in the <http://dbpedia.org/page_links> named graph.

Your query could be the following one:

SELECT ?prop
FROM <http://dbpedia.org/page_links> WHERE {
       { dbr:Diabetes_mellitus ?prop dbr:Hyperglycemia }
       UNION
       { dbr:Hyperglycemia ?prop dbr:Diabetes_mellitus }
}

Try it!

Using ASK:

ASK
FROM <http://dbpedia.org/page_links> {
dbr:Hyperglycemia dbo:wikiPageWikiLink|^dbo:wikiPageWikiLink dbr:Diabetes_mellitus
}

Try it!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...