Search code examples
sparqlrdfdbpediawikidatalinked-data

How to get Wikidata ID for DBpedia Entities?


I have a set of DBpedia concepts and would like to get the corresponding wikidata IDs of them. For example, consider word2vec. The wikidata ID of word2vec is wd:Q22673982.

Currently, I am doing it as follows.

SELECT * {
    VALUES ?searchTerm { "word2vec" "fasttext" "natural language processing" "deep learning" "support vector machine" }
    SERVICE wikibase:mwapi {
        bd:serviceParam wikibase:api "EntitySearch".
        bd:serviceParam wikibase:endpoint "www.wikidata.org".
        bd:serviceParam wikibase:limit 10 .
        bd:serviceParam mwapi:search ?searchTerm.
        bd:serviceParam mwapi:language "en".
        ?item wikibase:apiOutputItem mwapi:item.
        ?num wikibase:apiOrdinal true.
    }
    ?item (wdt:P279|wdt:P31) ?type
}
ORDER BY ?searchTerm ?num

However, I noted that when I do it this way, most of my terms do not get a wikidata ID.

Therefore, I would like to know;

  • Are all DBpedia concepts associated with its relevent wikidata ID?
  • How to get the wikidata ID associated with DBpedia using sparql?

I am happy to provide more details if needed.


Solution

  • I used the following SPARQL query to solve my issue:

    SELECT distinct ?wikidata_concept
    
    WHERE {dbr:Word2vec owl:sameAs ?wikidata_concept}
    
    LIMIT 100