Pham Hai
Pham Hai

Reputation: 55

SPARQL to get wikipedia link of resources URIs uri1 and uri2 in DBpedia

In a document I read a piece of information as follows:

Ranker does not use only external information sources but exploits also further information from the original DBpedia dataset. In fact, we also consider Wikipedia hypertextual links mapped in DBpedia by the property dbpedia-owl:wikiPageWikiLink. Whenever in a Wikipedia document w1 there is a hypertextual link to another Wikipedia document w2, in DBpedia there is a dbpedia-owl:wikiPageWikiLink from uri1 to uri2. Hence, if there is a dbpedia-owl:wikiPageWikiLink from uri1 to uri2 and/or vice versa, we assume a stronger relation between the two resources. We evaluate the strength of the connection as follow:

WikiS(uri1, uri2) Algorithm

But I have tried searching for properties wikilink on dbpedia but no results. I tried the following query:

Query 1: 
prefix dbpedia-owl: <http://dbpedia.org/ontology/>
prefix dbpprop: <http://www.w3.org/2006/03/wn/wn20/instances/synset-movie-noun-1>
select count(?s)
where{
   ?s ?p ?o .
   FILTER(?p, dbpprop:wikilink)
}

Query 2:
prefix dbpedia-owl: <http://dbpedia.org/ontology/>
prefix dbpprop: <http://www.w3.org/2006/03/wn/wn20/instances/synset-movie-noun-1>
select count(?s)
where{
  ?s ?p ?o .
  FILTER(?p = dbpedia-owl:wikiPageWikiLink)
}

Query 3:
select *
where{
  ?s ?p ?o .
  FILTER regex(?p, "link")
}

But no results.

How I can install algorithms WikiS (uri1, uri2) on in my program.

Thank so much.

Upvotes: 3

Views: 319

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

Get all object properties that contain the token "link" in its URI:

SELECT DISTINCT ?p WHERE {
  ?p  a <http://www.w3.org/2002/07/owl#ObjectProperty>
  FILTER regex(?p, "link", "i")
}

returns

+-------------------------------------------------------+
|                           p                           |
+-------------------------------------------------------+
| http://dbpedia.org/ontology/linkedTo                  |
| http://dbpedia.org/ontology/provinceLink              |
| http://dbpedia.org/ontology/wikiPageEditLink          |
| http://dbpedia.org/ontology/wikiPageHistoryLink       |
| http://dbpedia.org/ontology/wikiPageInterLanguageLink |
| http://dbpedia.org/ontology/wikiPageRevisionLink      |
| http://dbpedia.org/ontology/wikiPageWikiLinkText      |
| http://dbpedia.org/ontology/wikiPageWikiLink          |
| http://dbpedia.org/ontology/wikiPageExternalLink      |
+-------------------------------------------------------+

The same but with its frequencies:

SELECT  ?p (count(*) AS ?cnt)
WHERE
  { { SELECT DISTINCT  ?p
      WHERE
        { ?p  a                     <http://www.w3.org/2002/07/owl#ObjectProperty>
          FILTER regex(?p, "link", "i")
        }
    }
    ?s  ?p  ?o
  }
GROUP BY ?p

Upvotes: 3

Related Questions