Dinoop Nair
Dinoop Nair

Reputation: 2773

Get dbpedia link of entity using stanford NER

I am trying to find entities from text using stanford NER. It is working fine so far. Now I want to find the dbpedia link of the entities. I have seen it is available in alchemy API. Is it possible to find the dbpedia links of entities using stanford NER?

Upvotes: 1

Views: 725

Answers (2)

Pablo Mendes
Pablo Mendes

Reputation: 400

You can use Stanford NER to extract the entity names and DBpedia Spotlight to link to the DBpedia URIs.

Upvotes: 1

Artemis
Artemis

Reputation: 3301

Normally all the entities in Dbpedia have rdfs:label that is a string assigned to the entity. Therefore, when you are faced with a name extracted by your NER, you can use it for filtering purposes. The following example will provide he URI of all the entities that have label Sulfuric acid:

select distinct * 
    where {
    ?URI rdfs:label ?name.
    filter(str(?name)="Sulfuric acid")
} 

However, labels are not always what you seek, you sometimes need to actually look for the name assigned to your URI. For example, if you open sulfuric acid page, you can see that it contains dbpprop:iupacname. As a result you need to change the query to:

select distinct * 
    where {
    ?URI dbpprop:iupacname ?name.
    filter(str(?name)="Sulfuric acid")
} 

In this particular example the result sets are the same. But imagine you are tasked with finding London then you need to change your property to foaf:name and when running both the following queries, the result sets are quite different.

select distinct * 
    where {
    ?URI rdfs:label ?name.
    filter(str(?name)="London")
} 

this contains 8 results while the following query contains 21 results.

    select distinct * 
    where {
    ?URI foaf:name ?name.
    filter(str(?name)="London")
}

So my point is that you need to decide if you want to use labels or names. And if you decide to use names, you need to find the appropriate property to write a SPARQL query. After that, you just need a method to access DBpedia with your query.

Upvotes: 2

Related Questions